Problem with fzero function
Mostrar comentarios más antiguos
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 comentario
jgg
el 22 de Feb. de 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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!