马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
今天做了一个拟合的题目,用的是lsqnonlin,matlab提示如下:
Optimization terminated: directional derivative along
search direction less than TolFun and infinity-norm of
gradient less than 10*(TolFun+TolX).
Optimization terminated: directional derivative along
search direction less than TolFun and infinity-norm of
gradient less than 10*(TolFun+TolX).
我的代码如下,请问怎么回事情啊??
function exam74
x=[0 8.20 0.50 5.70 0.77 2.87 4.43 2.58 0.72 9.76 3.19 5.55];
y=[0 0.50 4.90 5.00 6.49 8.76 3.26 9.32 9.96 3.16 7.20 7.88];
r=[600 1000 800 1400 1200 700 600 800 1000 1200 1000 1100];
x0=[0,0];
opt1=optimset('LargeScale','off','MaxFunEvals',1000);
opt2=optimset(opt1,'LevenbergMarquardt','off');
[site1,norm2,res3]=lsqnonlin(@rget,x0,[],[],opt1,x,y,r);
[site1,norm2,res3]=lsqnonlin(@rget,x0,[],[],opt2,x,y,r);
function f=rget(xx,x,y,r)
for i=1:12
f(i)=sqrt((x(i)-xx(1))^2+(y(i)-xx(2))^2)/r(i);
end |