error using fit>iFit with exp1 or power1 in curvefit toolbox
33 views (last 30 days)
Show older comments
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 Comment
Yuntao Chen
on 26 Sep 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, ...
Answers (3)
Torben Ott
on 25 Nov 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 Comments
Amsal Jindani
on 24 Feb 2021
Getting the same error. When I run the command:
which -all iFit
'iFit' not found.
Walter Roberson
on 24 Feb 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 )
Peter He
on 14 Sep 2023
Edited: Walter Roberson
on 14 Sep 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.
1 Comment
Tasadeek Hassan
on 9 Feb 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.
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in Battery.Pulse/compareRelaxationTau
1 Comment
Walter Roberson
on 9 Feb 2024
Are you using the fit against exp1 and exp2 shown in https://www.mathworks.com/matlabcentral/answers/287549-error-using-fit-ifit-with-exp1-or-power1-in-curvefit-toolbox#answer_1310466 ?
I suspect not. We would need to see your code.
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!