赞
踩
clc,clear x=[0,1,2,3,4]; %y=[0,0.075,0.086,0.052,0.0024]; y=[0,0.037,0.025,0.037,0]; scatter(x,y,'k'); %画出原始数据散点图 hold on duoxiangshi = polyfit(x,y,4); %3次拟合 降幂排列 disp(duoxiangshi); xi = 0:0.001:4.0; yi = polyval(duoxiangshi,xi); %多项式求值 plot(xi,yi,'b'); %观测数据点 hold on xlabel('x'); ylabel('y'); legend('原始数据','拟合曲线');
结果
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。