数模论坛

 找回密码
 注-册-帐-号
搜索
热搜: 活动 交友 discuz
查看: 9143|回复: 2

怎么用matlab进行非线性的多元函数拟合?

[复制链接]
发表于 2006-12-21 06:20:11 | 显示全部楼层 |阅读模式
<p>如题,请教各位高手,怎么用matlab进行非线性的多元函数拟合?</p><p>例如:</p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &quot;Times New Roman&quot;; mso-hansi-font-family: &quot;Times New Roman&quot;;">变量</span><span lang="EN-US"><font face="Times New Roman">y \ </font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &quot;Times New Roman&quot;; mso-hansi-font-family: &quot;Times New Roman&quot;;">变量</span><span lang="EN-US"><font face="Times New Roman">x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 25<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>35<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</span>45<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>60<p></p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp; </span>50<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>46.5<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>30.8<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>21.3<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>13.6<p></p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp; </span>75<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>145.0<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>78.6<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>57.4<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>31.40<p></p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp; </span>90<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>328.3<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>152.4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 86.22<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span>43.91<p></p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &quot;Times New Roman&quot;; mso-hansi-font-family: &quot;Times New Roman&quot;;">拟合的非线性曲线为</span><span lang="EN-US"><font face="Times New Roman">:z=a1+a2*x^a3+a4*y^a5</font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; tab-stops: decimal 18.0pt;"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &quot;Times New Roman&quot;; mso-hansi-font-family: &quot;Times New Roman&quot;;">不知道</span><span lang="EN-US"><font face="Times New Roman">matlab</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &quot;Times New Roman&quot;; mso-hansi-font-family: &quot;Times New Roman&quot;;">里面有没有函数可以拟合上面的非线性曲线</span><span lang="EN-US"><font face="Times New Roman">,</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &quot;Times New Roman&quot;; mso-hansi-font-family: &quot;Times New Roman&quot;;">拜托高手赐教</span><span lang="EN-US"><font face="Times New Roman">!</font></span></p><p>谢谢各位</p>
 楼主| 发表于 2006-12-21 18:15:07 | 显示全部楼层
怎么没有人顶下
发表于 2006-12-23 01:12:27 | 显示全部楼层
<p>用最小二乘法咯!</p><p>程序大概像这样:</p><p>f=inline('a(1)+a(2)*x(:,1).^a(3)+a(4)*x(:,2).^a(5)','a','x');<br/>x=[25 50;<br/>35 50;<br/>45 50;<br/>60 50;<br/>25 75;<br/>35 75;<br/>45 75;<br/>60 75;<br/>25 90;<br/>35 90;<br/>45 90;<br/>60 90];<br/>z=[46.5 30.8 21.3 13.6 145.0 78.6 57.4 31.40 328.3 152.4 86.22 43.91];<br/>[a,r,j]=nlinfit(x,z,f,[1;1;1;1;1])</p><p>因为MATLAB重装系统时格式掉了,所以没有办法验证,你自己试试吧!</p>
您需要登录后才可以回帖 登录 | 注-册-帐-号

本版积分规则

小黑屋|手机版|Archiver|数学建模网 ( 湘ICP备11011602号 )

GMT+8, 2024-11-30 10:16 , Processed in 0.052125 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表