数学建模使用MATLAB进行数据拟合.docx

上传人:wj 文档编号:2503497 上传时间:2023-05-03 格式:DOCX 页数:5 大小:319.94KB
下载 相关 举报
数学建模使用MATLAB进行数据拟合.docx_第1页
第1页 / 共5页
数学建模使用MATLAB进行数据拟合.docx_第2页
第2页 / 共5页
数学建模使用MATLAB进行数据拟合.docx_第3页
第3页 / 共5页
数学建模使用MATLAB进行数据拟合.docx_第4页
第4页 / 共5页
数学建模使用MATLAB进行数据拟合.docx_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

数学建模使用MATLAB进行数据拟合.docx

《数学建模使用MATLAB进行数据拟合.docx》由会员分享,可在线阅读,更多相关《数学建模使用MATLAB进行数据拟合.docx(5页珍藏版)》请在冰点文库上搜索。

数学建模使用MATLAB进行数据拟合.docx

1.线性最小二乘法

x=[1925313844]';

y=[19.032.349.073.397.8]';

r=[ones(5,1),x.^2];

ab=r\y%ifAB=CthenB=A\C

x0=19:

0.1:

44;

y0=ab

(1)+ab

(2)*x0.^2;

plot(x,y,'o',x0,y0,'r')

运行结果:

2.多项式拟合方法

x0=[1990199119921993199419951996];

y0=[70122144152174196202];

a=polyfit(x0,y0,1)

y97=polyval(a,1997)

x1=1990:

0.1:

1997;

y1=a

(1)*x1+a

(2);

plot(x1,y1)

holdon

plot(x0,y0,'*')

plot(1997,y97,'o')

3.最小二乘优化

3.1lsqlin函数

例四:

x=[1925313844]';

y=[19.032.349.073.397.8]';

r=[ones(5,1),x.^2];

ab=lsqlin(r,y)

x0=19:

0.1:

44;

y0=ab

(1)+ab

(2)*x0.^2;

plot(x,y,'o',x0,y0,'r')

3.2lsqcurvefit函数

(1)定义函数

functionf=fun1(x,tdata);

f=x

(1)+x

(2)*exp(-0.02*x(3)*tdata);%其中x

(1)=a,x

(2)=b,x(3)=k

(2)

td=100:

100:

1000;

cd=[4.544.995.355.655.906.106.266.396.506.59];

x0=[0.20.050.05];

x=lsqcurvefit(@fun1,x0,td,cd)%x

(1)=a,x

(2)=b,x(3)=k

t=100:

10:

1000;

c=x

(1)+x

(2)*exp(-0.02*x(3)*t);

plot(t,c)

holdon

plot(td,cd,'*')

3.3lsqnonlin函数

(1)定义函数

functionf=fun2(x);

td=100:

100:

1000;

cd=[4.544.995.355.655.906.106.266.396.506.59];

f=x

(1)+x

(2)*exp(-0.02*x(3)*td)-cd;

(2)主函数

x0=[0.20.050.05];%初始值是任意的

x=lsqnonlin(@fun2,x0)

3.4lsqnonneg函数

MATLAB:

c=[0.03720.2869;0.68610.7071;0.62330.6245;0.63440.6170];

d=[0.8587;0.1781;0.0747;0.8405];

x=lsqnonneg(c,d)

4.曲线拟合的用户图形界面求法

Matlab工具箱提供了命令cftool,该命令给出了一维数据拟合的交互式环境。

具体

执行步骤如下:

(1)把数据导入到工作空间;

(2)运行cftool,打开用户图形界面窗口;

(3)对数据进行预处理;

(4)选择适当的模型进行拟合;

(5)生成一些相关的统计量,并进行预测。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2