MATLAB: How to derive polynomial using given roots

derivepolynomialrootssymbol [~]

Given the known roots -2 -0.5 2 4.5
I am asked to define a symbolic variable 'x'
and derive the symbolic polynomial for the given roots
I have searched google several times to no avail, can anyone help me with this?

Best Answer

v = [-2 -0.5 2 4.5]
x= sym('x')
yourpoly = expand(prod(x-v))