ErrorTest - function Xs = SecantRoot(Fun,X1,X2,imax)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%%This function finds roots using the secant method %Fun is the imput function %X1 and X2 are trial roots %imax is the total number of trial solutions including X1 and X2 %a complete list of trial solutions is returned
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: function Xs = SecantRoot(Fun,X1,X2,imax) X(1)=X1; X(2)=X2; for i = 3:imax X(i)=X2-(feval(Fun,X2)*(X1-X2))/(feval(Fun,X1)-feval(Fun,X2)); X1=X2; X2=X(i); end Xs=X;...
View Full Document

This note was uploaded on 04/01/2011 for the course ECM 006 taught by Professor Higgins during the Spring '07 term at UC Davis.

Ask a homework question - tutors are online