MATLAB: I want to calculate roots of a polynomial whose coefficients are functions of x where x assume values between an interval

graph in matlabmathematicsmatlab function

Let x =[0:1:10]; polynomial = [ 1 sin(x) x.^3 x]; let v1,v2 and v3 be the three roots of given polynomial in v whose coefficients are functions of x. I want to plot a graph between v1 and x.

Best Answer

You cannot use ROOTS on multiple polynomials at a time. You will have to use a loop over x(i),
for i=1:numel(x)
p =[1 sin(x(i)) x(i).^3 x(i)];
r{i}=roots(p);
%More code...
end