给出一组数据怎么拟合matlab
1个回答
展开全部
x=[9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39];
y=[9,12,18,21,12,26,29,36,50,101,192,245,233,117,28,9];
fun=@(p,x) p(1)*exp(-(x-p(2)).^2./2/p(3)^2);
p=nlinfit(x,y,fun,[250 32 10]);
xx=linspace(9,39,100);
yy=fun(p,xx);
plot(x,y,'o');hold on
plot(xx,yy,'r');hold off
legend('数据','拟合','location','northwest');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |