// This function solves finds the roots of an equation in // n dimensions. function [r]=quad_solve (x1, start, ends, increment, w1, w2, P) r = quad_disc ([x1;start], w1, w2, P); vsign = sign (r); rold = r; for x2=start:increment:ends, r = quad_disc ([x1;x2], w1, w2, P); if sign (r) ~= vsign then r=[x2-increment rold; x2 r]; break; end; rold = r; end;