Вы находитесь на странице: 1из 7

# In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.

htm

In this example we will once again consider a truck pulling a trailer where the friction
and wind resistance acts as a velocity dependant force, with a coefficient B.

The state space model of this first order system in the form

v’ = A v + B u

Selecting states

## Determining other state equations using element laws and interconnections

Vector-matrix form

## IDENTIFY ENERGY STORAGE ELEMENTS

In order to determine your state variable, you must identify energy storage elements.

In this case we have 3 forces acting on the body, the applied force, the friction force,
and the inertial force.

## Energy Storage Element Energy Storage Relation State Variables

Inertia ½ Mv 2 v

SELECTING STATES

So we can see from this table that the only state variable in our first order
system is v.

## IDENTIFYING TRIVIAL STATE EQUATIONS

This first order system does not have any trivial state equations.

## DETERMINING OTHER STATE EQUATIONS USING ELEMENT LAWS AND

1 of 7 05/10/2010 00:24
In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.htm

INTERCONNECTIONS

## The equation gathered from the free body equation was

mv' + bv – f(t) = 0

Rearranging we get:

## v' = -b/m v + f(t)/m

and the output we are seeking is for the state variable, v, so:

y=v

Now we have the derivative of the state variable in terms of the state variable
and other known quantities.

v' = Av + Bf(t)

y = Cv + Df(t)

so

A = -b/m

B = 1/m

C=1

D=0

## HOW TO INPUT THE STATE SPACE MODEL INTO MATLAB

We will now enter this state space model into MATLAB. Because MATLAB cannot
manipulate symbolic variables, we will now assign numerical values to each variable.

m = 20,000kg

b = 500kg/s

>> m = 20000;

>> b = 500;

>> A = -b/m;

2 of 7 05/10/2010 00:24
In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.htm

>> B = 1/m;

>> C = 1;

>> D = 0;

## EXTRACTING A, B, C, D MATRICES FROM A STATE SPACE MODEL

In order to extract the A, B, C, and D matrices from a previously defined state space
model, use MATLAB's ssdata command.

A =

-0.0250

B =

5.0000e-005

C =

D =

## STEP RESPONSE USING THE STATE SPACE MODEL

Now that we have the state space model entered into MATLAB we can use MATLAB
to do many useful calculations including determining the step response. In this case
we will plot the unit step response, taking the input to be 1 unit.

>> u = 1;

## >> step(u * first_ss)

The MATLAB output will be the following plot of the step response:

3 of 7 05/10/2010 00:24
In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.htm

## IMPULSE RESPONSE USING THE STATE SPACE MODEL

MATLAB can also plot the impulse response of a state space model.

## >> impulse(u * first_ss)

The MATLAB output will be the following plot of the impulse response:

4 of 7 05/10/2010 00:24
In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.htm

## BODE PLOT USING THE STATE SPACE MODEL

MATLAB’s bode command plots the frequency response of a system as a bode plot.

>> bode(first_ss)

## The MATLAB output will be the following bode plot:

5 of 7 05/10/2010 00:24
In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.htm

## TRANSFER FUNCTION FROM STATE SPACE

To find the transfer function of the system from the state space model use MATLAB's
ss2tf command:

## The MATLAB output will be:

num =

1.0e-004 *

0 0.5000

den =

1.0000 0.0250

In order to find the transfer function itself instead of the numerator and denominator
from the state space model, use the following command:

## >> first_tf = tf(first_ss)

MATLAB will assign the transfer function under the name first_tf, and output the
following:

6 of 7 05/10/2010 00:24
In this example we will once again consider a sliding block where the fric... http://www.me.cmu.edu/ctms/modeling/firstorder/statespace/content.htm

Transfer function:
5e-005
---------
s + 0.025

7 of 7 05/10/2010 00:24