필터 지우기
필터 지우기

Problem in running lsqnonlin

조회 수: 2 (최근 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?

Community Treasure Hunt

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

Start Hunting!

Translated by