0% found this document useful (0 votes)
69 views2 pages

Simulation PDF

This document demonstrates two techniques for simulating dynamic systems using Matlab: 1) using state space equations and 2) using transfer functions. It simulates the step response of a mass-damper system and a mass-spring-damper system using each technique. Technique 1 models the systems using state matrices A, B, C, and D, while Technique 2 uses the coefficients of the transfer function. The results are plotted on four subplots to compare the step responses of the two systems using the two modeling techniques.

Uploaded by

reza azimzadeh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views2 pages

Simulation PDF

This document demonstrates two techniques for simulating dynamic systems using Matlab: 1) using state space equations and 2) using transfer functions. It simulates the step response of a mass-damper system and a mass-spring-damper system using each technique. Technique 1 models the systems using state matrices A, B, C, and D, while Technique 2 uses the coefficients of the transfer function. The results are plotted on four subplots to compare the step responses of the two systems using the two modeling techniques.

Uploaded by

reza azimzadeh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Matlab Simulation Examples

3/2/01

Step Response Step Response


Mass-Damper system, Technique 1 Mass-Damper system, Technique 2
1 1

0.8 0.8
Amplitude

Amplitude
0.6 0.6

0.4 0.4

0.2 0.2

0 0
0 1 2 3 4 5 6 0 1 2 3 4 5 6
Time (sec.) Time (sec.)

Step Response Step Response


MSD System, Technique 1 MSD System, Technique 2

0.2 0.2
Amplitude

Amplitude

0.1 0.1

0 0

-0.1 -0.1

0 2 4 6 8 10 12 0 2 4 6 8 10 12
Time (sec.) Time (sec.)
% Examples of simulations using Matlab
% Two methods of simulting dynamic systems are demonstrated:
% 1. Technique 1 uses state equations
% 2. Technique 2 uses transfer functions
% Two systems are considered: a mass-damper and mass-spring-damper system.
% M.A. Minor - 3/02/01 - ME3210

clear all

% MASS-DAMPER VELOCITY SIMULATIONS (First order system)

% Technique #1 - Using state space matrices: xdot=Ax+Bu, y=Cx+Du


% Defining system variables
m=1;
b=1;

% Defining the A,B,C,D matrices


A=-b/m;
B=1/m;
C=1;
D=0;

sys=ss(A,B,C,D)
subplot(2,2,1) %figure(1)
% The step command simulates the response of the system to a step input and plots the
result.
step(sys);
title('Mass-Damper system, Technique 1')

% Technique #2 - Using the coefficients of the transfer function, V(s)/F(s)=(1/(ms+b))


num=1;
den=[m b]
sys=tf(num,den)
subplot(2,2,2) %figure(2)
step(sys);
title('Mass-Damper system, Technique 2')

% MASS-SPRING-DAMPER VELOCITY SIMULATIONS (Second order system)


% Simulating a second order system is very similar. Consider a MSD system:
k=10;

% First by technique 1:
subplot(2,2,3) %figure(3)
A=[-b/m -1/m
k 0]
B=[1/m 0]'
C=[1 0]
D=[0]
sys=ss(A,B,C,D);
step(sys);
title('MSD System, Technique 1')

% Technique 2: transfer function,


subplot(2,2,4) %figure(4)
num=[1 0];
den=[m b k];
sys=tf(num,den);
step(sys)
title('MSD System, Technique 2')

You might also like