曲线拟合求参数问题。
显示 更早的评论
过路的大神帮帮忙
dat=importdata('data.txt');
n=length(dat);
x=dat(:,2);
y=dat(:,4);
y1=dat(:,5);
a0=[0 0 0 0];
a=lsqcurvefit('cepian',a0,x,y)这是主程序
函数程序为
function y=cepian(a,x)
Fz=2000;
uy=a(1)+a(2)*Fz+a(3)*Fz^2;
E1=0.5/(1+exp(-(Fz-a(1))/a(2)));
qy=a(4)*tan(x)/(uy*Fz);
z=-abs(qy)-E1*(abs(qy.^2))-(E1^2+1/12)*(abs(qy.^3));
Fy=1-exp(z);
y=(-qy/(abs(qy)))*uy*Fz*Fy;
总是出错如下
dat=importdata('data.txt');
n=length(dat);
x=dat(:,2);
y=dat(:,4);
y1=dat(:,5);
a0=[0 0 0 0];
a=lsqcurvefit('cepian',a0,x,y)
Warning: Rank deficient, rank = 0, tol = NaN.
> In cepian at 8
In lsqcurvefit at 209
??? Error using ==> snls at 46
Objective function is returning undefined values at initial point.lsqcurvefit cannot continue.
Error in ==> lsqncommon at 149
[xC,FVAL,LAMBDA,JACOB,EXITFLAG,OUTPUT,msgData]=...
Error in ==> lsqcurvefit at 258
[xCurrent,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
求神助啊
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 优化 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!