How can I get the Secant method to repeat ?
Afficher commentaires plus anciens
Hi everyone , can anyone please show me why my script isn't repeating its calculation? It only calculates the root at theta = 20 and then the loop isn't repeating cheers
clear all
clc
M2=5;
r=1.4;
theta_vec=20:0.1:42;
ciL=35;
cim1L=ciL-1;
fi=((2*cotd(ciL).*((M2.^2).*((sind(ciL)).^2)-1))./((M2.^2).*(r+cosd(2*ciL))+2))-tand(theta_vec);
for n=1:length(theta_vec);
theta=theta_vec(n);
while abs(fi)>1.0e-6;
fi=((2*cotd(ciL).*((M2.^2).*((sind(ciL)).^2)-1))./((M2.^2).*(r+cosd(2*ciL))+2))-tand(theta);
fim1=((2*cotd(cim1L).*((M2.^2).*((sind(cim1L)).^2)-1))./((M2.^2).*(r+cosd(2*cim1L))+2))-tand(theta);
cip1L=ciL-(ciL-cim1L)*fi(n)/(fi-fim1);
cim1L=ciL;
ciL=cip1L;
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!