newtonRaphson_dmcgrail3 - f=rootFun(xhat fine f(xi...

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

View Full Document Right Arrow Icon
function root = newtonRaphson_dmcgrail3(rootFun,jacFun,initGuess) f xhat=initGuess; val=rootFun(xhat); %evaluate at initial guess while abs(val(1))>10^-10 || abs(val(2))>10^-10 %terminate if both errors (proximity to zero) are less than 10^-10 J=jacFun(xhat); %define jacobian
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f=rootFun(xhat); %define f(xi) b=(J*xhat)-f; %subtract jacobian*xi-f(xi) to get "b" xhat=J\b; %solve for new xhat val=rootFun(xhat); %evaluate at the new value to see if its close enough to zero again end root=xhat;...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online