Rank deficient warning when performing secant method

3 visualizaciones (últimos 30 días)
Mhamed Abdlla
Mhamed Abdlla el 24 de Abr. de 2020
Comentada: Pravin Jagtap el 27 de Abr. de 2020
I am trying to find an a that returns the value from roret(n,a) to 120. this is my code so far. How can I make it stop when I get an a that gives me roret(n,a) = 120?
I get this following error: Error in roret (line 26)
A(n+1,n-1:n+1) = [(k/(2*h)) (-4*k/(2*h)) ((3*k)/(2*h))+a]; %last row in matrix
Even though when I run roret(n,a) seperatly it works fine.
Please help!
format long
n = 200;
a0 = 20;
a1 = 21;
iter = 0;
tol = 1e-90;
d0 = roret(n,a0);
while abs(a0-a1)>tol % Secant method
d1 = roret(n,a1);
a2 = a1 - ((d1*(a1-a0))/(d1-d0));
d0 = d1;
a0 = a1;
a1 = a2;
iter = iter +1;
d2 = roret(n,a0);
if d2 == 120
break
end
end
a = a0
  1 comentario
Pravin Jagtap
Pravin Jagtap el 27 de Abr. de 2020
Hello Mhamed,
To understand what's going wrong in the user-defined function 'roret', we need access to it. Share the implementation of 'roret' so that we can help.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by