- #1

dabargo

- 2

- 0

## Homework Statement

I have calculated the following mechanical system

[tex]

\left( \begin{array}{c}\dot{\mathbf{x_1}}(t) & \dot{\mathbf{x_2}}(t) \end{array} \right) = \left( \begin{array}{cc}-0.5 & 0 & 0 & -1\end{array} \right) \cdot \left( \begin{array}{c}x_{1}(t) & x_{2}(t)\end{array} \right) + \left( \begin{array}{c}0.5 & 1\end{array} \right)\cdot u(t)

[/tex]

[tex]

\left( \begin{array}{c}y_{1}(t) & y_{2}(t)\end{array} \right) = \left( \begin{array}{cc}1 & 0\end{array} \right) \cdot \left( \begin{array}{c}x_{1}(t) & x_{2}(t)\end{array} \right)

[/tex]

The question is to find the expression for u(t) that brings the system to its restposition in 2 seconds. Afterwards i have to simulate this time response in MATLAB with the function lsim.

The initial conditions of the system are:

[tex]

x_1(0) = 10

[/tex]

[tex]

x_2(0) = -1

[/tex]

## Homework Equations

[tex]

u(t) = -B^T\exp^{A^T(t_1-t)}W_c^{-1}(t_1)[\exp^{At_1}x_0-x_1]

[/tex]

[tex]

W_c(t_1) = \int_0^{t_1} \exp^{A\gamma}BB^T\exp^{A^T\gamma} d\gamma

[/tex]

## The Attempt at a Solution

I calculated u(t) with MATLAB with the following code

Code:

```
A = [-0.5 0;0 1];
B = [0.5; 1];
C = [1 0];
D = 0;
syms t;
Wc = int(expm(A*t)*B*transpose(B)*expm(transpose(A)*t),0,2);
u = -transpose(B)*expm(transpose(A)*(2-t))*inv(Wc)*(expm(A*2)*[10;-1]-[0;0]);
sys = ss(A,B,C,D);
t = 0:0.1:2;
u = subs(u,t);
lsim(sys,u,t)
```

But the result i get with lsim doesn't fulfill my expectations at all.

The result i get is given in the lsimresults.bmp.

While i expect it to curve a bit down/up the original time responses (1st and 2nd thumbnails) where u(t) = 0, so that the amplitude of the system becomes 0 at 2 seconds.

So, if you there is anybody who can give me some help where it goes wrong. Or if i interpretate something wrong maybe?