Hi everyone, I'm trying to write a function that finds a point at
which two functions f(x) and g(x) intersect, i.e., f(x) = g(x). I'm using
Newton's Method and making and h(x)=f(x)-g(x) and h'(x) as well, but I'm not getting the right x-value. Please help me debug my code!
% function x = fgIntersect(f, df, g, dg, x0, tol, maxIter) h=f(x0)-g(x0) dh=df(x0)-dg(x0) k=1; while k<=maxIter x=x0-h/dh; if abs(x-x0)<tol*abs(x) return end x0=x; k=k+1; end
No products are associated with this question.
Play games and win prizes!Learn more