Why do I get the error message: "Undefined function 'isinf' for input arguments of type 'struct'."?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I tried running the example code to fit data to an exponential function, found here - https://www.mathworks.com/help/curvefit/confidence-and-prediction-bounds.html:
x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.5*randn(size(x));
fitresult = fit(x,y,'exp1');
MATLAB failed to execute the code, instead giving me the following error message:
Error using fit>iFit (line 340)
Undefined function 'isinf' for input arguments of type 'struct'.
Error in fit (line 108)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
I have the curve fitting toolbox installed, so I don't know why it's not working.
Thanks for any advice.
David
4 Kommentare
Rik
am 23 Mai 2017
On R2015a (CFT v3.5.1) this code works as well. It may be grasping at straws, but did you overlook stuff like accidentally re-defining functions like exp or size?
Or something that shouldn't have any effect on this: did the problem persist after a restart of Matlab (or even a system reboot)?
Antworten (1)
Jan
am 23 Mai 2017
You can check the type of the variables:
x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.5*randn(size(x));
class(x)
class(y)
Are these double vectors as expected?
If this you might have overlaoded another function. Use the debugger to see, what's going on:
dbstop if error
Then run the code again until it stops at the error. Then check to contents of the variable, which has provided to the failing isinf command. What do you see inside this struct? Does it ring any bell?
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!