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

9/28/2017

Simulation in Matlab

A Dynamic System
Let a 2 DoF and 4th order LTI system be
+ 2 + 9 =
+ 2 + 2.25 =
Which may be represented in
1. State space
= +
=

With = 1 2 3 =

2. Transfer function in s-domain for the output


1
=

1
9/28/2017

A Dynamic System in SS
State space representation in matrix form is

2 0 1 0 0 0 0
1 3 1
= 9 2 + = 0 0 0 1 0
2 + 1
2 2 9 0 2 0
3 2.251 23 + 0 2.25 0 2 3 1
Output
= 0 1 0 0
with
0 1 0 0 0
= 0 0 0 1 B= 0 C= 0 1 0 0
9 0 2 0 1
0 2.25 0 2 1

LTI System Simulation in Matlab


Define matrices A, B, C, D in Matlab syntax
Call matlab function to define an LTI system >> G=ss(A,B,C,D)
Use Matlab function for step response of the system >> step(G);
0
0 1 0 0 B= 0
1
= 0 0 0 1 1
9 0 2 0
0 2.25 0 2

C= 0 1 0 0

2
9/28/2017

Fast Step Response Simulation


Call matlab function to define an LTI system >> G=ss(A,B,C,D)
Use Matlab function for step response of the system >> step(G);

General System Response


For any input LTI system response may be simulated by command LSIM as

3
9/28/2017

Step response of the same system G for 10 sec at 10 ms increments

LTI Systems Simulation Using LTIVIEW


Most versatile Matlab function to analyze LTI systems is LTIVIEW
>> ltiview(G)

Edit -> Plot Configuration

4
9/28/2017

Two plots on the same figure


1st one to simulate step response
2nd one for generic Linear simulation
Click Apply

Define input signal and time for the 2nd Linear Simulation Tool
t=0:0.01:10
Use the Design Signal button to Insert Square wave
Click the Simulate button

5
9/28/2017

For 20 sec. simulation

6
9/28/2017

Simulation in Simulink
Using S-function Builder

A Dynamic System
Use to simulate dynamic systems
Let a twodof system be
+ 2 + 9 =
+ 2 + 2.25 =
Turn it to
= (, )
With = 1 2 3 =

2
1 3
= 9 2 +
2 2
3 2.251 23 +
Output
=

7
9/28/2017

8
9/28/2017

Outputs

9
9/28/2017

Derivatives

2
1 3
= 9 2 +
2 2
3 2.251 23 +

Building the Simulation Model

Requires a supported C compiler installed in Matlab


>> mex setup
Then follow the instructions

10
9/28/2017

Step Response

Reference
http://ctms.engin.umich.edu/CTMS/index.php?aux=Home

11

Вам также может понравиться