Matlab 曲线拟合 lsqcurvefit函数问题,老是运行有错,但自己手动拟合的曲线拟合性很好,求大神帮忙解决xdata = 0:1:24;ydata = [1,1.01573,1.031006579,1.045842764,1.059417803,1.071707049,... 1.083978095,1.09612949,1.107693

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 07:40:47
Matlab 曲线拟合 lsqcurvefit函数问题,老是运行有错,但自己手动拟合的曲线拟合性很好,求大神帮忙解决xdata = 0:1:24;ydata = [1,1.01573,1.031006579,1.045842764,1.059417803,1.071707049,...    1.083978095,1.09612949,1.107693
xTNA~1[[Z/.@4iB1Wh @#@0Ġh"2--Im dwΙ3w9{;j4ofKwӵe<ɩմv6v_u?lcZެt׷Qrԩ'j~گŃ|9?CIw6vc=(UK-0;  Lf cDdl$%Scخ 4BA8S2t4b&q 5l oi h`jpƍ  $B ŒHQ0pCam)$F$YA)A Ɩ ,LČ  -4{" @%Bk3)t!2e+噪g%GB69ςftLi]B,5~n2xC~k![|d(v8v@ ɘ_嗽JF@dtd{ij^l ~oq]#7vkW3j;}ѮNIPm֒?]w'փ

Matlab 曲线拟合 lsqcurvefit函数问题,老是运行有错,但自己手动拟合的曲线拟合性很好,求大神帮忙解决xdata = 0:1:24;ydata = [1,1.01573,1.031006579,1.045842764,1.059417803,1.071707049,... 1.083978095,1.09612949,1.107693
Matlab 曲线拟合 lsqcurvefit函数问题,老是运行有错,但自己手动拟合的曲线拟合性很好,求大神帮忙解决
xdata = 0:1:24;
ydata = [1,1.01573,1.031006579,1.045842764,1.059417803,1.071707049,...
1.083978095,1.09612949,1.107693656,1.119235824,1.130495336,...
1.140828063,1.150160037,1.15887825,1.166932454,1.174459168,...
1.181517668,1.188453177,1.195453166,1.201765158,1.207978284,...
1.214114814,1.220027553,1.225871485,1.23174341];
plot(xdata, ydata, '*');
hold on;
f = '1.308/(1+(1.308-1)*exp(-1*1.308*0.051*x))';ezplot(f,[0 60 1 1.32]);% 我自己拟合的曲线,拟合性很好
x0 = [1.308,0.051];
curvefun = @(x,xdata)x(1)/(1+(x(1)-1)*exp(-1*x(1)*x(2)*xdata)),'x','xdata';% 函数单独一个文件也一样,这样方便些.
x = lsqcurvefit(curvefun, x0, xdata, ydata); % 提示出错
y = curvefun(x, xdata);

Matlab 曲线拟合 lsqcurvefit函数问题,老是运行有错,但自己手动拟合的曲线拟合性很好,求大神帮忙解决xdata = 0:1:24;ydata = [1,1.01573,1.031006579,1.045842764,1.059417803,1.071707049,... 1.083978095,1.09612949,1.107693
把curvefun修改了下,拟合很好.
xdata = 0:1:24;
ydata = [1,1.01573,1.031006579,1.045842764,1.059417803,1.071707049,...
1.083978095,1.09612949,1.107693656,1.119235824,1.130495336,...
1.140828063,1.150160037,1.15887825,1.166932454,1.174459168,...
1.181517668,1.188453177,1.195453166,1.201765158,1.207978284,...
1.214114814,1.220027553,1.225871485,1.23174341];
plot(xdata, ydata, '*');
hold on;
f = '1.308/(1+(1.308-1)*exp(-1*1.308*0.051*x))';ezplot(f,[0 60 1 1.32]);% 我自己拟合的曲线,拟合性很好
x0 = [1.308,0.051];
curvefun = @(x,xdata)x(1)./(1+(x(1)-1)*exp(-1*x(1)*x(2)*xdata));% 函数单独一个文件也一样,这样方便些.
x = lsqcurvefit(curvefun, x0, xdata, ydata); % 提示出错
y = curvefun(x, xdata);
plot(xdata, ydata, '*',xdata,y)