Constrained linear least squares

조회 수: 2 (최근 30일)
Hui
Hui 2014년 7월 1일
편집: Star Strider 2014년 7월 1일
Hi everyone! I have a set of data such as:
y=[0.007696733 0.004758526 0.00547575 0.009628829 0.009749457 0.009073008 0.009647521 0.009795106 0.014071997 0.014208544 0.01758061 0.015072178 0.018425671 0.019217437 0.020314108 0.018246917 0.022694743 0.041827743 0.040799924 0.033812901 0.043516698];
y(t)=y(2:n);
y(t-1)=y(1:n-1);
I want to figure out the two parameters [b,c] of: y(t)=(1+b)*y(t-1)-b/c*(y(t-1))^2
What's more the two parameters need to be over 0;
Thank you so much for reading my question!

답변 (1개)

Star Strider
Star Strider 2014년 7월 1일
편집: Star Strider 2014년 7월 1일
It is actually nonlinear, because it is nonlinear in the parameters (the partial derivatives of the function with respect to each parameter are functions of themselves or of other parameters).
Using lsqcurvefit (Optimization Toolbox), the code is:
n = length(y);
yd = y(2:n);
yi = y(1:n-1);
f = @(B,y) (1 + B(1)).*y - (B(1)./B(2)).*y.^2; % Objective function
yp = linspace(min(yi), max(yi)); % Plot vector for ‘yi’
bc = lsqcurvefit(f, rand(2,1)*100, yi, yd, [1; 1]*eps, [Inf; Inf])
figure(1)
plot(yd, yi, 'xb')
hold on
plot(yp, f(bc,yp), '-r')
hold off
grid
The fit produces:
b = 2.989459285195542E-01
c = 3.990401160101856E-02
b/c = 7.491625942488537E+00

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by