Warning: Rank deficient, rank = 0, tol = NaN.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sitra
el 15 de Ag. de 2018
Comentada: Sitra
el 15 de Ag. de 2018
Hi Dears,
I'm using lsqcurvefit to fit my data. Sometimes, when I select an initial guess I get the following error:
Warning: Rank deficient, rank = 0, tol = NaN.
My question is not about how to fix that error. Rather, I hope to see how to avoid that fitting process entirely when it detects that error!
I mean, suppose the curve fitting (using lsqcurvefit or any other optimization tool; such as: NonLinearModel.fit, etc) is located in a function that is called via a main m-file. If the previous warning is detected, then the m-file should ignore or bypass that function and proceeds normally without stopping the program on a red error message says: Error using lsqcurvefit (line 251) Function value and YDATA sizes are not equal.
All what I need is like an if-statement. If the initial guess is healthy then please fit the data; otherwise, ignore the curve fitting stage and jump to the next lines in the main m-file.
Could you please guide me in resolving this issue.
Thank you so much
0 comentarios
Respuesta aceptada
Bjorn Gustavsson
el 15 de Ag. de 2018
Have a look at
try
catch
end
That way you might be able to put the curve fitting (or other fragile attempts) in the try part and handle the occasional errors in the catch part.
HTH
Más respuestas (0)
Ver también
Categorías
Más información sobre Least Squares 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!