f(x)=3x^2+2x+9 to [3 2 9]

Hello
How can I transform the formula f(x) to a array notation? (x is a symbol)
f(x)=3x^2+2x+9 to [3 2 9]
Thanks in advance

 Accepted Answer

syms x;
y = 3*x^2+2*x+9
coeffs(y)
That gives you the coefficients ordered from lowest power of x to the highest.
Or is this not a symbolic computation. Is x a vector?
Wayne

2 Comments

JR
JR on 15 Mar 2012
Ok, thank you. It only returns the values in the wrong order. (x^2 as last)
Exactly, that's what I said -- lowest power of x to the highest.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 15 Mar 2012

0 votes

This will be in the order of the highest degree term to the lowest.

Categories

Asked:

JR
on 15 Mar 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!