Problem in running lsqnonlin

1 Ansicht (letzte 30 Tage)
Shalini
Shalini am 10 Mär. 2012
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 Kommentare
Shalini
Shalini am 10 Mär. 2012
Can anyone tell me how to set options? What is the syntax?
Oleg Komarov
Oleg Komarov am 10 Mär. 2012
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Shalini
Shalini am 10 Mär. 2012
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?

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by