Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-07-06
年龄: 40
帖子: 11
声望力: 17 ![]() |
![]()
在拟合曲线时遇到了问题,希望能够得到到家的帮助哦,:smile:
我想要拟合一曲线,原始数据是: yt=[ 521.486755 161.973785 130.258820 120.327599 90.597206 51.033958 29.523090 19.248325 11.156927 10.221434 4.437991 3.455873 2.075573 1.551129 1.744870 0.761403 0.754921 0.532298 0.324880 0.587357 0.236039 0.227544 0.132627 2.709515] x=0.2:0.2:4.8 想要把它拟合成自定义的函数形式:yt=a*exp(-bx)形式,自己编的程序如下: yt=[……]; x=0.2:0.2:4.8; function yt=mymodel(beta,x) ; a=beta(1); b=beta(2); yt=a*exp(-b*x); betafit=nlinfit(x,yt,@mymodel,beta); plot(x,yt,'-br'); 但是运行时提示说:??? Error: File: nihe.m Line: 3 Column: 1 Function definitions are not permitted at the prompt or in scripts. 不知道怎么改啊?应该是函数不能够在这里定义吧,我看的下面网页的知识:http://chxue.cuit.edu.cn/sxjm/sxsy7_...��件:fff6.m function yy=model(beta0,x) a=beta0(1); b=beta0(2); yy=a+(0.49-a)*exp(-b*(x-8)); 貌似好像是在另一个文件里头再输入:betafit = nlinfit(x,y,'sta67_1m',beta0) 上面的我已经按照您给的思路拟合出了yt=a*exp(-bx),可是拟合yt=a*(x^b)*exp(-cx)时就是有问题出不来,烦请帮忙解释下咯,并且我想把最后拟合的方程自动的添加到图上去,同时求出拟合的相关系数之类的数值,这样的东西怎么弄啊? 请求帮助,如果是想做拟合最后一个拟合曲线的话,程序应该怎么改?谢谢大家! |
![]() |
![]() |
主题工具 | |
显示模式 | |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[求助]Error, (in writedata[APPEND]) Bad data found yrG = .2540855059 | lanmanhuayu | Maple论坛 | 0 | 2009-01-09 21:58 |
[求助]关于三维画图的问题 | duckliton | MATLAB论坛 | 6 | 2008-12-15 18:55 |
Studying the World's Most Complex Dynamic Systems | TechnicalArticles | MATLAB技术文章 | 0 | 2008-08-29 00:40 |
[求助]在SIMULINK里,如何将inegrator上方的箭头移到下面去 | yijianmei | MATLAB论坛 | 1 | 2008-07-24 10:15 |
Simplify Instrument Communication: Using Instrument Drivers with the Instrument Contr | TechnicalArticles | MATLAB技术文章 | 0 | 2008-01-06 16:32 |