Work Around a Curve Fit Error
heelis
I am using the user defined CurveFit function, which works like a charm by the way!!
However, I have some instances of fitting that yield a singular matrix and cause the fitting to fail.
I would like to recover from this error and continue to the next instance of fitting but presently cannot find a way to suppress the message and move on.
Does anyone have similar experience with a fix??
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
You can create a special variable, "V_FitError" to catch the error. To learn more about that, read in the help: DisplayHelpTopic "V_FitError and V_FitQuitReason"
Your code will look like this (careful- uncompiled and untested pseudocode):
Variable V_FitError=0
FuncFit ...
if (V_FitError) // non-zero on any error
if (V_FitError & 2) // a singular matrix error
... do something appropriate, which might be ...
continue // skip doing what you ordinarily do, and simply go to the next fit
endif
endif
ProcessFitResults()
while(I should continue fitting)
You might wish to look through the list of errors and add handling for them as well.
You might also wish to look at V_FitQuitReason. That variable reports an abnormal termination that isn't considered to be a real error. The distinction may be subtle :)
October 4, 2019 at 10:52 am - Permalink