数据拟合问题求大神指教。
显示 更早的评论
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!