matlab step
TRANSCRIPT
-
7/30/2019 MATLAB STEP
1/12
Time Response Analysis
Nader Sadegh
George .W. Woodruff School of Mechanical Engineering
Georgia Institute of technology
ME3015,
SystemD
ynamics&Control
Under Damped 2nd System
10),(222
-
7/30/2019 MATLAB STEP
2/12
ME3015,
Syste
mD
ynamics&Control
Step Response Characteristics
Mp=Maximum Overshoot=ts= Settling Time= 4/
tp= Peak Time=/dTd= Period of oscillations= 2/d
21
e
Mp
ME3015,
SystemD
ynamics&Contr
ol
Relationship between Mp and
22
1
)ln(
|)ln(|
2
p
p
p
M
M
eM
+=
=
c
Maximum overshoot is directly related to the
damping ratio:
-
7/30/2019 MATLAB STEP
3/12
ME3015,
Syste
mD
ynamics&Control
Design Example
Find kand b of the vibration isolatorshown such that its step response meets
the following specifications:
Maximum overshoot=5%
Settling time = 0.5 sec
Solution: ts=0.5 and Mp=0.05. Thus
69.03
3
)ln(
|)ln(|
2222=
+=
+=
p
p
M
M
= = = =
48
81159
tsn .
=== 222 )59.11)(10(nn mkm
kN/m1344=k
= = = b
Mb M
n22 2 10 8( )( ) N.sec/m160=b
k
m=10
yb
f
fkyybym =++ &&&
ME3015,
SystemD
ynamics&Contr
ol
Resulting Step Response
Time (sec.)
Amplitude
Step Response
0 0.14 0.28 0.42 0.56 0.70
0.2
0.4
0.6
0.8
1
1.2
1.4
From: U(1)
To:Y(1)
*f/k
-
7/30/2019 MATLAB STEP
4/12
ME3015,
Syste
mD
ynamics&Control
Higher order systems
Higher order systems can be expressedassuperposition of 1st and 2nd order systems
Example:
( )( ) 5215211
22 +++
++
=+++ ss
cbs
s
a
sss
3
rd
tf=1
st
order+2
nd
order transfer functions
ME3015,
SystemD
ynamics&Contr
ol
Matlab Tutorial and Time
Response Analysis using
Matlab
-
7/30/2019 MATLAB STEP
5/12
ME3015,
Syste
mD
ynamics&Control
What is Matlab?
The name MATLAB is an abbreviation for MATrixLABoratory . MATLAB is an interactive, matrix-based package for scientific and engineeringcalculations.
It can be used for performing all sorts of numericalcomputations
And for dynamic system simulation and controldesign
In this course we mainly use the control systems
toolbox and basic programming commands youlearned in 2016.
ME3015,
SystemD
ynamics&Contr
ol
Matlab Basics: Vectors and Matrices
Vectors and arrays are defined and
manipulated with ease in Matlab
You can perform most matrix and vector
computations in Matlab
Linear dynamic systems may be definedusing vector and matrices too!
Lets review basic array and matrix
assignments and operations
-
7/30/2019 MATLAB STEP
6/12
ME3015,
Syste
mD
ynamics&Control
Examples of Array
Assignments
r=[1 2 3] sets r to a row vector
v=[1;2;3] sets v to a column vector
r=1:10 is equivalent to r=[1 2 10]
r=[1:0.2:2] is equivalent to r=[1 1.2 2]
A=[1 2 3;4 5 6] sets A to the 2x3 matrix
=
654
321A
Note: semicolon (;) separate rows and colon (:) is
used create and incrementally increasing array.
ME3015,
SystemD
ynamics&Contr
ol
Extraction Commands
Vectors:
v(i) is the i-th element of v, e.g., if v=[3;4;5]
then v(2)=4
Matrices:
A(i,j) is the ij-th element of A, e.g., if A=[1 2 3;
4 5 6] then A(2,3)=6
A(i,:) is the i-th row of A, e.g., A(2,:)=[4 5 6]
A(:,j) is the j-th column of A, e.g., A(:,3)=[3;6]
-
7/30/2019 MATLAB STEP
7/12
ME3015,
Syste
mD
ynamics&Control
Some Array Commands
length(v) returns the length of vector v
[m,n]=size(A) returns the number of rows (m)
and columns (n) of matrix A
zeros(m,n) returns mxn matrix of zeros
A=eye(n) returns an nxn identity matrix
A is the transpose of matrix A, e.g.,
=
=63
52
41
654
321AA
ME3015,
SystemD
ynamics&Contr
ol
Matrix Algebra Examples
Addition
A + B A + B =0 5
8 11
Subtraction
A B A B =2 1
2 3
Multiplication
A * B A * B = 9 1717 37
Forward Division
A / B = A * B1
A / B =0 .1364 0. 2273
0 . 0455 0 . 5909
Backward Division
A \ B = A1
* B A \ B =7 1
4 1
Transpose
A A =1 3
2 4
A =1 2
3 4
, B =
1 3
5 7
Operation Example
-
7/30/2019 MATLAB STEP
8/12
ME3015,
Syste
mD
ynamics&Control
Plotting Example
%Script file PlotSin
t=[0:0.1:2*pi]'; %x=[0;0.12*pi]
N=length(x); %length of vector x
y=zeros(N,1); %initialize vector y to zero
for i=1:N
y(i)=sin(t(i));
end
plot(t,y);
ME3015,
SystemD
ynamics&Contr
ol
Linear Dynamic System Definition
A dynamic system can either be defined
based on a
single transfer function or differential
equation, or
A system of 1st order differential
equations (state-model)
-
7/30/2019 MATLAB STEP
9/12
ME3015,
Syste
mD
ynamics&Control
Transfer Function System Creation
Command: TF Creation of transfer functions or
conversion to transfer function.
Creation:
SYS = TF(NUM,DEN) creates a continuous-time
transfer function SYS with numerator(s) NUM and
denominator(s) DEN. The output SYS is a TF object.
Example: Y(s)/U(s)=1344/(s2+160s+1344)
num=[0 0 1344]; den=[1 160 1344];
msd=tf(num,den);
ME3015,
SystemD
ynamics&Contr
ol
Some Forced Response Commands
Plots the unit impulseresponse of sys
impulse(sys) orimpulse(num,den)
Plots the unit step response
of sys
step(sys) or
step(num,den)
Plots the time response of
sys to input U specified at
time instants T.
lsim(sys,U,T) or
lsim(num,den,U,T)
DescriptionCommand
-
7/30/2019 MATLAB STEP
10/12
ME3015,
Syste
mD
ynamics&Control
State-Space System Creation
Any linear dynamic system can be expressed as a
system of first order differential equations called the
state-space model dx/dt=Ax+Bu, y=Cx+Du
Where
u and y are the input and output vectors
X is the state vector
A,B,C,D are matrices of appropriate dimensions
SYS = SS(A,B,C,D) creates a continuous-time state-
space (SS) model SYS with matrices A,B,C,D. The
output SYS is a SS object. You can set D=0 to mean
the zero matrix of appropriate dimensions.
ME3015,
SystemD
ynamics&Contr
ol
Why State-Space Model
Many dynamic systems (e.g., multidegree of
freedom system) are more conveniently
modeled using a system of differential
equations rather than a single equation
State models may be used to simulate the
natural as well as the forced or complete timeresponse
Matlab allows for easy conversion from state
to transfer function models
-
7/30/2019 MATLAB STEP
11/12
ME3015,
Syste
mD
ynamics&Control
More Time Response Commands
Plots the initial condition
response specified by
initial state x0
initial(sys,x0) or
initial(A,B,C,D,x0)
Plots the time response of
sys to input U specified at
time instants T and initial
state x0.
lsim(sys,U,T,x0) or
lsim(A,B,C,D,U,T,x0)
DescriptionCommand
ME3015,
SystemD
ynamics&Contr
ol
Mass Spring-Damper Example
Solve d2y/dt2+2dy/dt+10=u with initial conditions
y(0)=1 and dy(0)/dt=2, and zero input.
Defining x1=y and x2=dy/dt the system can be
expressed as
dx1/dt=x2, dx2/dt=-10x1-2x2+u or
[ ] ux
xy
ux
x
x
x
001
1
0
210
10
2
1
2
1
2
1
+
=
+
=
&
&
Matlab commands: msd=ss(A,B,C,D); initial(msd,[1;2])
-
7/30/2019 MATLAB STEP
12/12
ME3015,
Syste
mD
ynamics&Control
Other Utility Functions
)3()(
)2()2(
)1()1(
DENNUM
psnr
psr
psr
-++
-+
-=
MATLAB Functions Description
p=roots(DEN) roots of the polynomial equation DEN=0
[z,p]=tf2zp(NUM,DEN) z=roots of NUM=zeros of (NUM/DEN)
p=roots of DEN=ploes of (NUM/DEN)
[r,p]=residue(NUM,DEN) Calculates the partial fraction expansion of
(NUM/DEN):
ME3015,
SystemD
ynamics&Contr
ol
Inverse Laplace Transform
syms s
g=(s^2+4*s+1)/(s*(s^2+4*s+5))
g =
(s^2+4*s+1)/s/(s^2+4*s+5)
ilaplace(g)
ans =
1/5+4/5*exp(-2*t)*cos(t)+8/5*exp(-2*t)*sin(t)