MATLAB Answers


How to obtain values symbolically

Asked by Vicky
on 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).



No products are associated with this question.

2 Answers

Answer by Azzi Abdelmalek
on 22 Feb 2013
Edited by Azzi Abdelmalek
on 22 Feb 2013


c=sym('c',[1 10])


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.

on 23 Feb 2013

there should be sth else, but i cant find the answer...thank You, Walter, anyway.

Answer by bym
on 23 Feb 2013


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


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!