数据拟合问题求大神指教。
古いコメントを表示
clear ;
clc;
x=0.001:0.001:0.241;
z=load('C:\Users\Administrator\Desktop\y.txt');
a=mean(z);
y=z-a;
f=@(c,x)(c(1)*sin(c(2)*pi*x+c(3)));
c0=[0.016,250,-2];
lsqcurvefit(f,c0,x,y);
plot(x,y,'.-',x,f(c,x),'r:x')
legend('原始数据','拟合数据')
错误显示: 错误使用 lsqcurvefit (line 248)Function value and YDATA sizes are not equal.
出错 Untitled2 (line 9)
lsqcurvefit(f,c0,x,y);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!