how to get the roots of x using newton raphson method in matlab [closed]
Date: 2022-11-29 11:13:16
a=2
b=3
c=7
d=5
w=14
Find x using newton raphson method in matlab
enter code here
4.w.d^2.(1-x^2)^2=a.b.c^3.x.sqrt(pi^2.(1-x^2)^2+16.x^2)
Answer:
There is a ton of posts similar to this, even on StackOverflow, like this one, or this one. Even more on the web like Matlab Central, or other educational sites like here. So, I think you could have come to the table a little more prepared. I'll put my two cents in here as far as the method I like the best.
function x = newton(f,dfdx,x0,tolerance)
err = Inf;
x = x0;
while abs(err) > tolerance
xPrev = x;
x = xPrev - f(xPrev)./dfdx(xPrev);
% stop criterion: (f(x) - 0) < tolerance
err = f(x); %
% stop criterion: change of x < tolerance
% err = x - xPrev;
end
f = @(x) ((x-4).^2-4);
dfdx = @(x)(2.*(x-4));
x0 = 1;
xRoot = newton(@f,@dfdx,x0,1e-10);
f(x) = 4wd2(1-x2)2 - abc3x√(π2*(1-x2)2+16*x2)
So just differentiate the above equation with respect to x and then you have your df/dx. Plug the equations into the file handles and run the routine! Also, I'm fine with moving this to SE Math, but I don't know how to do that either. :-)