lsqnonlin question
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Sean de Wolski
2012년 4월 18일
It is x, the output from lsqnonlin. It doesn't look like the above code ever uses the actual optimized value.
Shalini
2012년 4월 18일
댓글 수: 2
Sean de Wolski
2012년 4월 18일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!