MATLAB Answers

0

How to obtain values symbolically

Vicky 님이 질문을 제출함. 22 Feb 2013
Hi! Im using Matlab version 7.9.0(R2009b) and i would like to sum e.g. first 10 terms of expression c_i*x^i, where c_i should be obtained symbolically. how should i do that, so that this expression is dependent on x / function of x (so when i enter exact number for x, i get real number - not expression with c_i).

  댓글 수: 0

로그인 to comment.

답변 수: 2

Azzi Abdelmalek 님의 답변 22 Feb 2013
Azzi Abdelmalek 님이 편집함. 22 Feb 2013

EDIT
c=sym('c',[1 10])
x=sym('x')
f=@(x,n)sum(c(1:n).*x.^(1:n))
f(x,5)

  댓글 수: 8

표시 이전 댓글 수: 5
Ity seems like a homework, I think you get enough help to finish the work.
If that is the complete instruction you are given, then the c_i are just the symbolic variables, and you will not be able to complete the second part.
If there are instructions before that point, then you might be able to proceed further.
there should be sth else, but i cant find the answer...thank You, Walter, anyway.

로그인 to comment.


bym 님의 답변 23 Feb 2013

alternative:
c =sym(1:10)
f = @(x) sum(c.*x.^(1:length(c)));

  댓글 수: 0

로그인 to comment.



Translated by