Help with error in fit re NaN and Inf values
Mostra commenti meno recenti
I'm hoping someone can help me determine why I'm getting the following error:
Error using fit>iFit (line 415)
Input to EIG must not contain NaN or Inf.
Error in fit (line 109)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in mainnew>oneload (line 172)
powerfit=fit(x2,y2,'power1');
The code is as follows. I start with two arrays, of the same length. Each y value has an associated x value, and some of the y values are occasionally NaN. They should never be Inf. I want to do a power fit on the valid y values, so I cut the NaN and Inf values out. Then I do a fit.
y1=y(~isnan(y));
y2=y1(~isinf(y1));
x1=x(~isnan(y));
x2=x1(~isinf(y1));
if length(y2)>1
powerfit=fit(x2,y2,'power1');
end
Given that I have just removed all the NaN and Inf values, I'm baffled as to why I'm being told I can't input NaN or Inf, since I just removed all those terms. I am also unclear as to what EIG is, because the function eig() is not called in iFit to the best of my knowledge. It appears to me that something is failing between lines 359 and 410 of iFit, I just don't know what nor why, and would appreciate any help.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Get Started with Curve Fitting Toolbox in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!