how to get a polynomial eqn in variable i want ?

1 view (last 30 days)
>>poly2sym([1 2 -1 1], s)
while using the poly2sym function as " >>poly2sym(c,y), " where c is the coeff. vector array ,i'm getting the error "undefined variable or func. y" , how do i get a pol. eqn . in variable i desire ?

Answers (1)

Star Strider
Star Strider on 30 Aug 2014
Declare y as a symbolic variable first:
c = [1 2 -1 1]; % Polynomila Coefficients
syms y
poly2sym(c,y)
produces:
ans =
y^3 + 2*y^2 - y + 1

Tags

Community Treasure Hunt

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

Start Hunting!