Problem in running lsqnonlin

1 次查看(过去 30 天)
Shalini
Shalini 2012-3-10
I'm new to matlab and I understand that lsqnonlin requires a function for its call.
Actually, I have run the cftool through GUI and have got reasonable results.I thought I will reduce the error and get still better results through 'lsqnonlin' but I'm not able to run lsqnonlin , below are the problems I'm facing, can anyone help-it's really URGENT!!!
I have coded the function,which is required for lsqnonlin here it is:
function diff = fit_simp(x,X,Y)
% This function is called by lsqnonlin.
% x is a vector which contains the coefficients of the
% equation. X and Y are the option data sets that were
% passed to lsqnonlin.
A=x(1);
B=x(2);
n=x(3);
diff = (A+B*(X.^n)) - Y;
end
Now, I write the following script in command window;
>> X=xlsread('QS2T.xls',9,'V638:V1835');
Y=xlsread('QS2T.xls',9,'W638:W1835');
X0=[800 1537 0.1448];
>> option.Algorithm='trust region'
option =
Algorithm: 'trust region'
Then I call lsqnonlin.I expect the algorithm to be used is trust region and not levenberg marquardt.
>> x=lsqnonlin(@fit_simp,X0,[],[],options,X,Y);
I get this warning:
Warning: Options LevenbergMarquardt and LargeScale will be ignored in a future release. Running Levenberg-Marquardt method. To run the Levenberg-Marquardt method without this warning, set option Algorithm to 'levenberg-marquardt' instead. > In optim\private\lsqncommon at 60 In lsqnonlin at 240 Optimization terminated: the relative change in the sum-of-squares of the functions is less than options.TolFun
Please can anyone advice what to do?
  2 个评论
Shalini
Shalini 2012-3-10
Can anyone tell me how to set options? What is the syntax?
Oleg Komarov
Oleg Komarov 2012-3-10
Why it's not urgent: http://www.mathworks.com/matlabcentral/answers/29922-why-your-question-is-not-urgent-or-an-emergency
Also, keep in mind it's Saturday.

请先登录,再进行评论。

回答(1 个)

Shalini
Shalini 2012-3-10
Actually lasqnonlin gives me an answer. But I want to put some constraints on A,B,n above- I mean upper and lower bounds.
Can anyone help?

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by