error using fit>iFit with exp1 or power1 in curvefit toolbox

40 visualizaciones (últimos 30 días)
Anna Nagle
Anna Nagle el 3 de Jun. de 2016
Comentada: Walter Roberson el 9 de Feb. de 2024
I am trying to use the fit function in the curvefit toolbox in 2016a. Here's an example:
>> x = [1:100]';
>> y = x.^2;
>> results = fit(x,y, 'exp1')
Error using fit>iFit (line 340)
Too many input arguments.
Error in fit (line 108)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
I get the same problem if I use fittype 'power1' but the function works fine if I use 'poly1' or 'poly2'. On my home computer, I'm still using MATLAB 2011a, and all of the fittypes work fine. Any ideas?
  1 comentario
Yuntao Chen
Yuntao Chen el 26 de Sept. de 2019
Same issue here, have not been able to figure out the reason.
>> f2=fit([1;2;3;4],[1;4;9;16],'exp1')
Error using fit>iFit (line 348)
Too many input arguments.
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...

Iniciar sesión para comentar.

Respuestas (3)

Torben Ott
Torben Ott el 25 de Nov. de 2020
I get the same error with R2020b.
I use the code all the time on my laptop, now I set up my desktop and get this error. No idea what's going on.
>> x = [1:100]';
y = x.^2;
results = fit(x,y, 'exp1')
Error using fit>iFit (line 348)
Too many input arguments.
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
  3 comentarios
Amsal Jindani
Amsal Jindani el 24 de Feb. de 2021
Getting the same error. When I run the command:
which -all iFit
'iFit' not found.
Walter Roberson
Walter Roberson el 24 de Feb. de 2021
Please show the complete error message, including the line number; also please indicate your version.
If you happen to be using a version R2018b or later, please
edit fit
and examine line 116 (the line that is being complained about), which these days would be expected to be
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
useroptions, useroptargs, probparams, errorFcn, warningFcn );
See if the line has the same thing for you.
Then look down at line 124 which is where function iFit is defined, which should look like
function [fitobj,goodness,output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
useroptions, useroptargs, probparams, errorFcn, warningFcn )
and match up the arguments of the definition against the parameters of the call.
If everything matches up, it becomes difficult to figure out where the problem might be, as the function is defined in the same file, and so should have priority. But you could take the step of putting in a breakpoint at line 116 (which has the call to iFit) and run from the command line passing in whatever is triggering the error, and then when it stops at the command line, ask
which iFit( xdatain, ydatain, fittypeobj,useroptions, useroptargs, probparams, errorFcn, warningFcn )

Iniciar sesión para comentar.


Peter He
Peter He el 14 de Sept. de 2023
Editada: Walter Roberson el 14 de Sept. de 2023
Different error with fit using 'exp1'. I have a series of data. Some data works fine, others (usually shorter) don't. Here is an example:
x = (1:6)';
y = [1.0188
1.0916
1.1736
1.2574
1.3667
1.4817];
fit_exp1 = fit(x,y,'exp1','Normalize','on','Lower',[0 0]);
fit_exp2 = fit(x,y,'exp2','Normalize','on','Lower',[0, -inf, 0, -inf]);
fit_exp1 returns an error (R2023a):
Error using fit>iFit
Output argument "output" (and possibly others) not assigned a value in the execution with "evriio" function.
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
fit_exp2 runs fine.
Again, it works for longer data, but somehow it fails on this one.

Tasadeek Hassan
Tasadeek Hassan el 9 de Feb. de 2024
i get this error where ever i add data to this code.how to reduce the error.
Error using fit>iFit
Exiting due to infeasibility: 1 lower bound exceeds the corresponding upper bound.
Error in fit (line 117)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in Battery.Pulse/compareRelaxationTau

Categorías

Más información sobre Get Started with Curve Fitting Toolbox 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!

Translated by