How to obtain values symbolically
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
답변 (2개)
Azzi Abdelmalek
2013년 2월 22일
편집: Azzi Abdelmalek
2013년 2월 22일
EDIT
c=sym('c',[1 10])
x=sym('x')
f=@(x,n)sum(c(1:n).*x.^(1:n))
f(x,5)
댓글 수: 8
Vicky
2013년 2월 23일
Walter Roberson
2013년 2월 23일
Note: R2009b does not allow sym('c', [1 10])
Walter Roberson
2013년 2월 23일
2*c1 + 4*c2 + 8*c3 + 16*c4 + 32*c5 would be the answer to the question based on the information you have given us. You might possibly have been given other information that defined c_i that you did not happen to share with us.
Vicky
2013년 2월 23일
Vicky
2013년 2월 23일
Azzi Abdelmalek
2013년 2월 23일
Ity seems like a homework, I think you get enough help to finish the work.
Walter Roberson
2013년 2월 23일
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.
Vicky
2013년 2월 23일
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!