roots

roots(v) returns the zeros of the polynomial represented by v.

Examples

>> r = roots([1,3,-7])	

% solve x2+3x-7

r# -4.54138 1.54138 >> f = @(x) x.^2+3*x-7 x = [-5:0.2:2] o = struct('show',false) overlay({plot(x,f(x),o), scatter(r,zeros(numel(r)),o)}) [x:1x36 double] [o:1x1 struct] [ans:1x1 struct] 0.216000s

See also

bisection