I have a mass - spring - damper system with external force and I am trying to simulate it using Matlab. I want to have a linearly parameterized form and use the least squares method to find the estimators. I have reached the stage where I have the form:
$$ y = \theta^T z $$ $$\theta = [\theta_1 \ \ \theta_2 \ \ \theta_3]^T$$ $$z = [-s\frac{y}{Λ(s)} \ \ -\frac{y}{Λ(s)} \ \ \frac{u}{Λ(s)}]^T$$
where $\ Λ(s) $ is a stable filter $\ Λ(s) = s^2 + 3s + 2 $ and $\ y $ is the output of the system (the mass relocation) and $\ u $ is the input of the system (the external force).
I am trying to calculate the elements of $\ z $ vector and for $\ z_1 = -s\frac{y}{Λ(s)} $ for example I have done the following:
$$ z_1 = -s\frac{y}{Λ(s)} \Rightarrow \ddot{z_1}+3\dot{z_1}+2z_1 = -\dot{y} $$
$$x_1 = z_1 \Rightarrow \dot{{x_1}} = x_2 - y$$
$$x_2 = \dot{z_1}+y \Rightarrow \dot{{x_2}} = -3x_2 - 2x_1 + 3y$$
From now on I want to use the ode45(...)
function but I am not able to figure out how to finally calculate $\ z_1 $ and then put it in the $\ z $ vector.