quarta-feira, novembro 04, 2009

How to plot the state-space output using Matlab

Suppose we need to determine the wave form, overshoot , rise time, settling time and the final value (steady state output value) of a specific process.

Moreover, instead of function transfer G(s) we've got the State-Space equations. How to do it in a easy way? I mean, how to do it without any kind of math ?

Simulink has block named State-Space. It requires four matrices (A, B, C e D) that are the solution of State-Space equations, as shown below.

State-Space equation are


x = state vector (n-vector)
u = control vector (r-vector)
y = system's output vector (m-vector)
A = n x m constant matrix
B  = n x r constant matrix
C = m x n constant matrix
D = m x r constant matrix

All we need to do is to determine these four matrices and to use the State-Space block. Is it too complicated? No at all.

Let me use an example to explain the process.

Suppose we have the following State-Space equations:

We can rewrite these equations in order to let them look like matrices. Take a look:


By inspection we get the four matrices:


Now you must create a new Simulink model and then you will insert the State-Space block (you can find it on Simulink->Continuous)

The next step is to connect Step and Scope blocks, as show below.

You need to use Matlab syntax to express the matrices. So, we have

A = [0 1; -4 -2]
B = [0;4]
C = [1 0]
D = [0;0]

As all D's elements are zero, we can rewrite D matrix as

D = 0

Double-click the State-Space block then insert A, B, C e D values as shown in the picture below.

Ok. Now you just need to simulate it, get the output system's graphic and get all values directly from it.

The graphic to this sample system  can be seen in the next picture.

I recommend you to read Ogata's Modern Control Engineering.

Did you like this post? Please rate it. Did you dislike it? So your rate is much more important!

Did I make any mistake? Wrong theory? Bad English? Wrong command? Please, post a comment complaining about it. So I can improve my posts.

Nenhum comentário: