Hi everyone, I have problem with Newton Raphson method. I dont really understand question 3 and question 4. From my code, can someone explain what should i put and where is my mistake. Attached file below..
2 次查看(过去 30 天)
显示 更早的评论
Scrpit Body
%question (3) & question (4) x0 =transpose(1:19); tol = 10e-10; nmax = 100; x,niter = NewtonRaphson( x0,tol,nmax );
Main Body
function [ x,niter ] = NewtonRaphson( x0,tol,nmax )
%DATA N = 20; niter = 0; error = 1; x0 = zeros(N,1); dx = zeros(N,1);
while (error > tol && niter < nmax)
niter = niter + 1;
x = x0 - ((J_springs(x0))/(F_springs(x0)));
x0 = x;
error = max(abs(x-g(x0)));
end
for i = 2:N-2
dx(i) = x(i)-x(i-1);
end
end
1 个评论
Ben Drebing
2017-12-18
Let us know what specifically is going wrong or what is confusing you. This will greatly increase your chances of getting an answer that you find helpful.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!