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..

3 vues (au cours des 30 derniers jours)
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 commentaire
Ben Drebing
Ben Drebing le 18 Déc 2017
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.
You can find the guidelines for posting homework questions here

Connectez-vous pour commenter.

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by