Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2021-05-30
帖子: 1
声望力: 0 ![]() |
![]()
已知数据和相应的拟合函数,通过该数据求该拟合函数中的未知系数,
计划是使用fittype函数进行求解,写的程序如下: x=[1,2,3,4,5,6,7,8,9]'; y=[4.1,133,184.7,216.4,238.9,256.3,270.4,282.1,292.2]'; %x和y待拟合的数据, [xData, yData] = prepareCurveData(x, y); syms D n alpha x; f1=sym((1/n)*exp(-(n.^2)*(pi.^2)*D*((1+x).^(1-alpha)-1))/(0.375*0.375*(1-alpha))); f2=symsum(f1,1,100); f3=6/(pi.^2) f4 = fittype('292.2*(1-f3*f2)',... 'dependent',{'f2'},'independent',{'x'},... 'coefficients',{'D','alpha'}); st=[0 0]; [curve, goodness]= fit(t,y,f4 ,'Startpoint',st); figure plot(curve,'predobs',0.99); hold on,plot(x,y,'b*'); 取的是数据的一部分,运行不了 |
![]() |
![]() |