1
$\begingroup$

The code in this page solves the Least Squares problem for the following dynamic model:

$\dot{y}=ay+bu$

where $a$ and $b$ are constants, $u$ is an input. The code is as follow:

t=[0:0.1:10];
m=length(t);
y=zeros(m,1);
a=-1;b=1;c=1;d=0;u=[100;zeros(m-1,1)]; % u: impulse with magnitude of 100
[ad,bd]=c2d(a,b,0.1);
y=dlsim(ad,bd,c,d,u);
ym=y+0.08*randn(m,1); %adding Gaussian noise

w=inv(0.08^2);
h=[ym(1:m-1) u(1:m-1)];
xe=inv(h'*w*h)*h'*w*ym(2:m)

ye=dlsim(xe(1),xe(2),c,d,u);

What's is not clear to me is why $a=-1$ and $b=1$. The model as given does not specify a value for either of $a$ and $b$. ($c=1$ and $d=0$ are fine, however).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.