for loop results in NaN after 453 loops
Ältere Kommentare anzeigen
I am trying to approximate an infinte sum expression. I dicovered that for whatever reason the sum becomes NaN after 453 loops.
Here is a sample of my code (just the portion I am having trouble with):
L = 1; H = 1; T0 = 373; T1 = 473;
theta_center = 0;
for p = 1:452 theta_center = theta_center + ((-1)^(p+1)+1)/p*sin(p*pi/2)*sinh(p*pi/L*H/2)/sinh(p*pi*H/L);
end
When I set the for loop to be any number less than 453, theta_center is a number, but when I set the for loop to any number greater 452, theta center becomes NaN.
Any help?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!