FindRoots - f function Roots = FindRoots(F,xMin,xMax) % % %...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function Roots = FindRoots(F,xMin,xMax) f % F is a handle to a function of a single variable that is defined on the % interval [xMin,xMax]. % Roots is a row vector--possibly empty--of roots of F in the interval % Roots established via a graphical interface: click the blue rectangle to % highlight AND find the root AND add it to the vector Roots if, in the % green interval L-->R, the function crosses the x axis only once. % Click in red interval = zoom out / Click in green = zoom in. % % Set up x based on xMin and xMax: % x = linspace(xMin,xMax,100000); x % Store fcn values in y: % y = MyF(x); y yMax = max(abs(y)); y yMin = -yMax; y Roots = []; % Out put of fcn. initialized as an empty vector R [a, b] = BWindow(x,y,Roots); % Call function BWindow for click coordinates [ % if x coordinate of mouse click is between xMax and xMin, continue loop: % w % a is less than L OR greater than R: if (a<(xMin + (1/4)*(xMax - xMin)))||((a>(xMin + (3/4)*(xMax - xMin)))) interval = xMax-xMin;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/12/2009 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell University (Engineering School).

Page1 / 2

FindRoots - f function Roots = FindRoots(F,xMin,xMax) % % %...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online