because NaN or Inf function value encountered during search while using fzero
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Miraboreasu
el 2 de Jun. de 2022
I have a nonlinear equation---5e6-5e6*(exp(-aa*xt)-exp(-bb*xt))/(exp(-aa*1e-6)-exp(-bb*1e-6))=0
I am thinking is that due to the function is too nonlinear, and fzero cannot find the result?
For reference, the results should be 1e-6
aa=810930;
bb=1216395;
func = @(xt) 5e6-5e6*(exp(-aa*xt)-exp(-bb*xt))/(exp(-aa*1e-6)-exp(-bb*1e-6));
x0 = 0.00001;
roots = fzero(func,x0)
0 comentarios
Respuesta aceptada
Matt J
el 2 de Jun. de 2022
Editada: Matt J
el 2 de Jun. de 2022
The problem occurs because func() has no axis crossing.
aa=810930;
bb=1216395;
func = @(xt) 5e6-5e6*(exp(-aa*xt)-exp(-bb*xt))/(exp(-aa*1e-6)-exp(-bb*1e-6));
x0 = 0.00001;
fplot(func,[0,10e-6])
Based on the plot, it appears you should be looking for the minimum of func() rather than a root.
xmin=fminsearch(func,x0)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Optimization 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!