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

3 visualizaciones (últimos 30 días)
Andreas Baas
Andreas Baas el 21 de Jun. de 2019
Respondida: Andreas Baas el 19 de Feb. de 2023
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 comentarios
Andreas Baas
Andreas Baas el 21 de Jun. de 2019
OK, I tried the debub stop, see here screenshot with outcome:
screenshot3.jpg
Not much more informative, unfortunately...
dpb
dpb el 21 de Jun. de 2019
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...

Iniciar sesión para comentar.

Respuestas (2)

Matt J
Matt J el 21 de Jun. de 2019
Editada: Matt J el 21 de Jun. de 2019
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 comentarios
dpb
dpb el 21 de Jun. de 2019
Editada: dpb el 22 de Jun. de 2019
"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 el 18 de Feb. de 2023
Editada: J.D. Johnston el 18 de Feb. de 2023
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.

Iniciar sesión para comentar.


Andreas Baas
Andreas Baas el 19 de Feb. de 2023
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"...)

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by