![]() |
已知数据和拟合函数,求函数中的系数
已知数据和相应的拟合函数,通过该数据求该拟合函数中的未知系数,
计划是使用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*'); 取的是数据的一部分,运行不了 |
所有时间均为北京时间。现在的时间是 12:35。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.