Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2012-03-29
年龄: 40
帖子: 1
声望力: 0 ![]() |
![]()
问题是这样的,现在需要将
![]() ![]() clear all clf x=-120:1:120;%x的取值范围 N=length(x);%x的向量长度 %A=(pi/1.54)-(pi/1.56)=0.0262; y=((0.0262*x).^-1).*sin(0.0262*x);%产生y plot(x,y) f=inline('a(1)*((0.0262*(x-a(2))).^-1).*sin(0.0262*(x-a(2)))+a(3)','a','x'); [xx,res]=lsqcurvefit(f,[1,0,0],x,y); xx',res 运行一直不成功,返回下列结果 ??? Error using ==> optim\private\snls lsqcurvefit cannot continue: user function is returning Inf or NaN values. Error in ==> optim\private\lsqncommon at 222 [x,FVAL,LAMBDA,JACOB,EXITFLAG,OUTPUT,msg]=... Error in ==> lsqcurvefit at 149 [x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ... 请问下这个的问题大概在哪里?应该怎么改?请帮我看看,非常感谢!!!! |
![]() |
![]() |