哪位大神能帮忙用MATLAB拟合一下X=0,8.65,19.83,30.35,39.72,47.66,56.58 40
Y=337.7,298.1,101.1,60.8,39.6,24.3,11.6,公式:Y=1/(1+A*exp(-B*X^C))...
Y=337.7,298.1 ,101.1,60.8,39.6,24.3,11.6,公式:Y=1/(1+A*exp(-B*X^C))
展开
1个回答
展开全部
参考代码:
X=[0, 8.65, 19.83, 30.35, 39.72, 47.66, 56.58];
Y=[337.7, 298.1 , 101.1, 60.8, 39.6, 24.3, 11.6];
% c(1)=A, c(2)=B, c(3)=C
f = @(c,x) 1./(1+c(1)*exp(-c(2)*x.^c(3)));
c0 = [-0.997 0.01 2];
c = lsqcurvefit(f,c0,X,Y);
fprintf('A = %.4g, B = %.4g, C = %.4g\n',c)
plot(X,Y,'ro',X,f(c,X))
需要注意拟合系数初值的选择(我是对拟合系数取不同值进行试探,得到大致可以接受的初值再进行拟合的)。程序输出为:
A = -0.9971, B = 1.885e-006, C = 2.669
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询