Problem with fzero function
Ältere Kommentare anzeigen
I had some troubles in using fzero.
Here is my script: lambda=0.23; T_orb=86400; D=130*1000; omega=2*pi/T_orb; distance=1000*[37700;38400;39000;39600]; for q=1:4 APS.tint(q)=fzero(@(T_int)[distance(q)*lambda/(2*D/2*-(cos(omega*T_int+omega*(T_orb/4-T_int/2))-cos(omega*(T_orb/4-T_int/2))))-2000],100);
end
and it gives me as result tint=[1.527152190882263e-12 1.527032893943011e-12 1.526723991273891e-12 1.527144367230523e-12], but using this values the function has not a zero! Using a bigger first guess (like 1000) it finds the correct first solution (the function is periodical). Why it gives me this result of magnitude 10^-12?
1 Kommentar
jgg
am 22 Feb. 2016
If your function is non-linear, fzero can find local near-zeroes. You will want to trial it from several points.
I can't debug your code further because you didn't include lambda.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!