嗨,我正在尝试使用 MatLab 的拟合函数将幂模型拟合到我的数据中
fo = fit(log2(x(:)),log2(y(:)),'power1');
plot(fo,'g'), hold on
但是,当我运行它时,我得到了错误
Error using fit>iFit (line 282)
Cannot fit Power functions to data where X has nonpositive values.
Error in fit (line 108)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in CurvedPowerLaw (line 20)
fo = fit(log2(x(:)),log2(y(:)),'power1');
查看我的数据并检查是否有小于 1 的数据时,没有显示任何内容
x(count_1)=M(i,1);
y(count_1)=M(i,2);
count_1= count_1+1;
if(M(i,2)<1)
display(M(i,1))
end;
M 是一个包含两列的 csv 文件。我还重新运行了代码
if(M(i,1)<1)
并没有显示任何内容。手动检查,似乎也没有低于 1。
i 只是正在解析的文件中的行。该文件看起来像
344,17
345,13
346,13
347,16
340,12
M(i,1) 将导致返回 >300 个数字之一,并且 M(i,2) 将返回 ~10 值任何帮助将不胜感激!
谢谢