lsqnonlin question
2 views (last 30 days)
Show older comments
Consider the following code:
X(1:10304)=xlsread('qs_comp_2.xls',2,'G3822:G14125');
Y(1:10304)=xlsread('qs_comp_2.xls',2,'H3822:H14125');
X(10305:12631)=xlsread('comp.xls',3,'T4259:T6585');
Y(10305:12631)=xlsread('comp.xls',3,'U4259:U6585');
X0=[1012 1400 0.17 -0.0001];
lb = [1012;900;0.17;-0.0001];
ub=[1300;1600;0.3119;10];
StartAt = [1012;900;0.17;-0.0001];
options = optimset('MaxFunEvals',10000);
x=lsqnonlin(@(X0)fit_simp(X0,X,Y),StartAt,lb,ub,options);
[total_readings,epsilon_dot_QS,epsilon_dot_MR] = GetMRDetails;
for i=1:total_readings
Y_new(i)=(X0(1)+X0(2)*(X(i)^X0(3))+X0(4)*log(epsilon_dot_QS/epsilon_dot_MR));
end
Please can anyone help me here:
1) Is the final optimised vector X0 or is it x? That is: which id the final answer X0 or X 2)Is there anything I'm missing in this code?
0 Comments
Answers (2)
Sean de Wolski
on 18 Apr 2012
It is x, the output from lsqnonlin. It doesn't look like the above code ever uses the actual optimized value.
Shalini
on 18 Apr 2012
2 Comments
Sean de Wolski
on 18 Apr 2012
That looks fine, it's that your call to LSQNONLIN generates a vector called 'x'. This vector is not used in the remainder of the code you showed us.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!