State Space Question

Thread Starter

Kayne

Joined Mar 19, 2009
105
Hi All,

Just wondering if I have done this correctly. To write the system below into a state space form with a unit step.
100(s+5)/ (s+2)(s+3)


100s+500/s^2+5s+6

d^2y/dt^2 + 5dy/dt + 6y = 100du/dt+500u

Y(s) = 100s^-1+500s^-2/ 1+5s^-1+6s^2
Y(s) = (100s^-1+500s^-2)E(s)
E(s)= U(s)/1+5s^-1+6s^-2 therefore
E(s) = U(s) - 5s^-1E(s)-6s^-2E(s)

dx1/dt=x2
dx2/dt2=x3
dx3/dt3= -6x3-5x2+u

y= 500x1 +100x2

d/dt
:x1: :0, 1, 0: :x1: :0:
:x2:=:0, 0, 1: :x2:+:0: u(t)
:x3: :0,-6,-5: :x3: :1:

y=:500, 100, 0:


I would also like to know where I can find the information to write the above in correct equations so it make more sence to the reader.


Thanks
 
Last edited:

t_n_k

Joined Mar 6, 2009
5,455
I think it should be ....

\(\frac{Y(s)}{U(s)}=\frac{100(s+5)}{s^2+5s+6}\)

\(\frac{Y(s)}{U(s)}=\frac{100(s^{-1}+5s^{-2})}{1+5s^{-1}+6s^{-2}}\)

\(E(s)=\frac{U(s)}{1+5s^{-1}+6s^{-2}\)

\(E(s)=U(s)-E(s)(5s^{-1}+6s^{-2})\)

and so on ....
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
Thanks for the heads up on the code I have managed to write the answer so it is more understandable

\( \frac {Y(s)}{U(s)}=\frac {100s+500}{s^{2}+5s+6}\)

\(Y(s)=\frac {100s^{-1}+500s^{-2}}{1+5s^{-1}+6s^{-2}}\)

\(Y(s)=(100s^{-1}+500s^{-2})E(s)\)

\(E(s)=\frac {U(s)}{1+5s^{-1}+6s^{-2}}\)

\(E(s)=U(s)-5s^{-1}E(s)-6s^{-2}E(s)\)

\( \frac {dx_{1}}{dt}= x_{2} \)

\( \frac {dx_{2}}{dt}= x_{3} \)

\( \frac {dx_{3}}{dt}= -6x_{2}-5x_{3} \)

\( y = 500x_{1}+100x_{2}\)



\(\frac {d}{dt}=(\begin{array}{cc}x_{1}\\x_{2}\\x_{3}\end{array})=(\begin{array}{cc}0&1&0\\0&0&1\\-6&-5&0\end{array})(\begin{array}{cc}x_{1}\\x_{2}\\x_{3}\end{array})+(\begin{array}{cc}0\\0\\1\end{array})u(t)\)

\( y=(\begin{array}{cc}500&100&0\end{array}) (\begin{array}{cr}x_{1}\\x_{2}\\x_{3}\end{array})\)

Hopefully what I have done is correct, thanks for your help
 

t_n_k

Joined Mar 6, 2009
5,455
You've obtained what appears to be a 3rd order representation of a 2nd order system. Is this how you were taught to do it?

The normal representation would be

d(X(t))/dt=A.X(t)+B.u(t)
y(t)= C.X(t)+D.u(t)

In a 2nd order system there would be two state variables, so A would be a 2x2 matrix .....
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
This is why i may be having trouble with the the rest of the question. I found a question that is similar and followed the example. Will go back and have another look

Thanks for the info
 

Ethan

Joined Feb 7, 2009
6
t_n_k is correct. You need to select a minimal set of variables that completely describe the system. In your case you only need 2 not 3 because it is a second order system.
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
Have had another look at the question and found another example that is similar so hopefully this may be correct.


\( \frac {Y(s)}{U(s)}=\frac {100s+500}{s^{2}+5s+6}\)

\(Y(s)=\frac {100s^{-1}+500s^{-2}}{1+5s^{-1}+6s^{-2}}\)

\(Y(s)=(100s^{-1}+500s^{-2})E(s)\)

\(E(s)=\frac {U(s)}{1+5s^{-1}+6s^{-2}}\)

\(E(s)=U(s)-5s^{-1}E(s)-6s^{-2}E(s)\)

\( \frac {dx_{1}}{dt}= x_{2} \)

\( \frac {dx_{2}}{dt}= -6x_{1}-5x_{2} \)

\( y = 500x_{1}+100x_{2}\)



\(\frac {d}{dt}=(\begin{array}{cc}x_{1}\\x_{2}\end{array})=(\begin{array}{cc}0&1\\-6&-5\end{array})(\begin{array}{cc}x_{1}\\x_{2}\end{array})+(\begin{array}{cc}0\\0\end{array})u(t)\)

\( y=(\begin{array}{cc}500&100\end{array}) (\begin{array}{cr}x_{1}\\x_{2}\end{array})\)

thanks for the help
 

t_n_k

Joined Mar 6, 2009
5,455
Probably an oversight - You need a '1' in the first state space equation B matrix (the equation second from the bottom) to include u(t) in the function.
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
Thanks for pointing that out TNK. You are correct it was an oversight.


\(\frac {d}{dt}=(\begin{array}{cc}x_{1}\\x_{2}\end{array})=(\begin{array}{cc}0&1\\-6&-5\end{array})(\begin{array}{cc}x_{1}\\x_{2}\end{array})+(\begin{array}{cc}0\\1\end{array})u(t)\)

\( y=(\begin{array}{cc}500&100\end{array}) (\begin{array}{cr}x_{1}\\x_{2}\end{array})\)

To continue on from this to a discrete time system in the form

\( X(k+1)=\Phi X(k)=\Gamma u(k)\) ,
\( y=CX(k)\)

I have done the following

\(A= (\begin{array}{cc}0&1\\-6&-5\end{array}) B=(\begin{array}{cr}0\\1\end{array})\)


\(\Phi(t)= L^-1[(\begin{array}{cc}s&0\\0&s\end{array})- (\begin{array}{cr}0&1\\-6&-5\end{array})]^-1\)


\(= L^-1[(\begin{array}{cc}s&-1\\6&s+5\end{array})]^-1\)

\(= L^-1[(\begin{array}{cc}\frac{1}{s}&\frac{-1}{s^2}\\6&\frac{1}{s+5}\end{array})]\)

\(\Phi(t)=[(\begin{array}{cc}1&-t\\6&e^-5t)\end{array})]\)

I would like to know if what I have worked out for \(\Phi(t)\) is correct I am not sure about changing \( \frac {1}{s+5}\) that is all and this is required to work out \(\Gamma \)


Thanks for any help
 

t_n_k

Joined Mar 6, 2009
5,455
Keeping in mind that ....

\(A_{d}=e^{AT}\)

Where Ad is the discretized form of continuous matrix A. You called this \(\Phi(t)\) rather than \(A_{d}\) which is just a matter of convention.

Are you confident that ...

\(A_{d}=e^{AT}=L^{-1}\left\{(sI-A)^{-1}\right\}_{t=T}\)

is satisfied in your derivation?

You might show how you derived

\((sI-A)^{-1}\)

which leads to Ad or \(\Phi(t)\) as you have it in the post.
 

t_n_k

Joined Mar 6, 2009
5,455
I believe this is not accurate. You need to do partial fraction expansion.
I agree.

You can do the expansion of

\(e^{AT}\)

using Taylor's expansion or do the inversion of the matrix [sI-A] and apply the inverse Laplace transform at t=T.
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
Have taken on board what has been said and have work though the question again.

\(\frac {d}{dt}=(\begin{array}{cc}x_{1}\\x_{2}\end{array})=(\begin{array}{cc}0&1\\-6&-5\end{array})(\begin{array}{cc}x_{1}\\x_{2}\end{array})+(\begin{array}{cc}0\\1\end{array})u(t)\)

\( y=(\begin{array}{cc}500&100\end{array}) (\begin{array}{cr}x_{1}\\x_{2}\end{array})\)

To continue on from this to a discrete time system in the form

\( X(k+1)=\Phi X(k)=\Gamma u(k)\) ,
\( y=CX(k)\)

I have done the following

\(A= (\begin{array}{cc}0&1\\-6&-5\end{array}) B=(\begin{array}{cr}0\\1\end{array})\)


\(\Phi(t)= L^-1[(\begin{array}{cc}s&0\\0&s\end{array})- (\begin{array}{cr}0&1\\-6&-5\end{array})]^-1\)


\(= L^-1[(\begin{array}{cc}s&-1\\6&s+5\end{array})]^-1\)

\(=L^-1\frac{1}{s^2+5s+6} (\begin{array}{cc}\ s+5&1\\-6&s\end{array})\)

\(=L^-1[(\begin{array}{cc}\frac{s+5}{s^2+5s+6}&\frac{1}{s^2+5s+6}\\\frac{-6}{s^2+5s+6}&\frac{s}{s^2+5s+6}\end{array})]\)

\(=L^-1[(\begin{array}{cc}\frac{3}{(s+2)}-\frac{2}{(s+3)}&\frac{1}{(s+2)}-\frac{1}{(s+3)}\\\frac{-6}{(s+2)}+\frac{6}{(s+3)}&\frac{-2}{(s+2)}+\frac{3}{(s+3)}\end{array})]\)


\(\Phi=[(\begin{array}{cc}\3e^-2T-2e^-3T&e^-2T-e^-3T\\-6e^-2T+6e^-3T&-2e^-2T+3e^-3T\end{array})]\)

\(\Gamma=\int^{T}_{0}e^Aq Bdq=\int^{T}_{0}[(\begin{array}{cc}\3e^-2q-2e^-3q&e^-2q-e^-3q\\-6e^-2q+6e^-3q&-2e^-2q+3e^-3q\end{array})][(\begin{array}{cc}\0\\1\end{array})]dq\)

\(=[(\begin{array}{cc}\\\frac{1}{2}-e^-2T+\frac{1}{2}e^-3T\\e^-2T-e^-3T\end{array})]\)


So the original equation
\( X(k+1)=\Phi X(k)=\Gamma u(k)\) ,
\( y=CX(k)\)

is then worked out to be

\( X(k+1)=[(\begin{array}{cc}\3e^-2T-2e^-3T&e^-2T-e^-3T\\-6e^-2T+6e^-3T&-2e^-2T+3e^-3T\end{array})][(\begin{array}{cc}\\x_{1}(k)\\x_{2}(k)\end{array})] +[(\begin{array}{cc}\\\frac{1}{2}-e^-2T+\frac{1}{2}e^-3T\\e^-2T-e^-3T\end{array})]u(k)\)

\(y=(\begin{array}{cc}\500&100\end{array})[(\begin{array}{cc}\\x_{1}(k)\\x_{2}(k)\end{array})]\)


This looks better than the first attempt so hopefully this method is correct.Thanks for the help given so far
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
\(\Gamma=\int^{T}_{0}e^Aq Bdq=\int^{T}_{0}[(\begin{array}{cc}\3e^-2q-2e^-3q&e^-2q-e^-3q\\-6e^-2q+6e^-3q&-2e^-2q+3e^-3q\end{array})][(\begin{array}{cc}\0\\1\end{array})]dq\)

\(=[(\begin{array}{cc}\\\frac{-1}{3}e^-2T+\frac{1}{2}e^-3T\\e^-2T-e^-3T\end{array})]\)

I think that I may have got the derivatives incorrect last post, hopefully this is the correct answer for \(\Gamma\)..
 

Thread Starter

Kayne

Joined Mar 19, 2009
105
Thanks TNK, I thought that the 1/6 had to be subtracted from the equation not just added into the equation.
 
Top