curve-fitting problem: Unrecognized option name 'showstatus' in OPTIMSET ?

5 次查看(过去 30 天)
Hi all,
I'm having problems fitting a custom model because I keep getting an error message I don't know what to do about.
I have vector data X and vector data Y, and I want to curve-fit (nonlinearleastsquares) a custom equation.
Here's a snippet of code:
given: independent data vector X, dependent data vector Y
fo=fitoptions('Method', 'NonlinearLeastSquares', 'StartPoint', [1, 4]);
g = fittype( @(a, b, x) a*((x-b).^2), 'options', fo)
[fitobject,gof,output] = fit(X, Y, g);
This generates an error message:
Error using fit>iFit (line 340)
Unrecognized option name 'showstatus'. See OPTIMSET for possibilities.
Error in fit (line 108)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
I have used curve-fitting with library models without any problems. The error occurs when I try to fit a custom model.
Can anyone help?
Thanks,
Andy
  15 个评论
Andreas Baas
Andreas Baas 2019-6-21
OK, I tried the debub stop, see here screenshot with outcome:
screenshot3.jpg
Not much more informative, unfortunately...
dpb
dpb 2019-6-21
But that does show that the property name 'showstatus' was somehow passed to the optimget routine and as doc shows, there isn't any such property.
Now, how that got generated as a parameter is the kicker...perhaps there is some sort of namespace resolution thingie going on and it did somehow get into a ML object when should have been calling some Java method--TMW has got everything so entwined now it's impossible to know just what might end up using it.
You could just confirm the input arguments to the function when in debug mode, but backtracking to how that got generated is, as you say, probably only something the developers can manage.
Looks like time for an official bug report to me...

请先登录,再进行评论。

回答(2 个)

Matt J
Matt J 2019-6-21
编辑:Matt J 2019-6-21
Not much more informative, unfortunately...
But now that you've trapped the error with dbstop you can dbup and dbdown through the call stack and investigate how that call was made...
Personally, I wonder why any code in R2018a is using optimset. It should be deprecated in that version in favor of optimoptions. I begin to wonder if code from a previous partially uninstalled version of Matlab has made its way into the mix. A complete, clean reinstall of Matlab might be necessary. "Clean" means you delete the entire R2018a install folder before re-installing.
  2 个评论
dpb
dpb 2019-6-21
编辑:dpb 2019-6-22
"I wonder why any code in R2018a is using optimset. It should be deprecated in that version in favor of optimoptions"
But, TMW has made such a convoluted mess out of all these it's impossible to know what is/isn't "the right stuff!" The doc for optimset says optimoptions is recommended instead of optimset for all solvers except fzero, fminbnd, fminsearch, and lsqnonneg" until they've changed their tune in current release. It's absolutely impossible to keep up... :(
To make it even worse, optimset and optimoptions are defined for the optimization routines in the Optimization Toolbox; fit and fitoptions belong to their own TB and have a different class name.
It's just a proverbual bollux of competing stuff stumbling all over itself. There doesn't seem to be any one coherent design for Matlab at all, any more...
J.D. Johnston
J.D. Johnston 2023-2-18
编辑:J.D. Johnston 2023-2-18
Not sure if this is helpful, but I had the same error. It had something to do with one of the custom subroutines included in my PATH. When I revised everything in PATH to just the basics, custom fitting worked fine.

请先登录,再进行评论。


Andreas Baas
Andreas Baas 2023-2-19
Thanks J.D.; yes I found the same resolution: I removed all my own scripts and functions from the PATH and then it worked. I must have had a .m file in there with the same name as something in this OPTIMSET thing (though I certainly didn't have a script or function called "showstatus"...)

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by