SlideShare a Scribd company logo
1
ECEN 4413 - Automatic Control Systems
Matlab Lecture 1
Introduction and Control Basics
Presented by Moayed Daneshyari
OKLAHOMA STATE UNIVERSITY
2
What is Matlab?
• Invented by Cleve Moler in late 1970s to give
students access to LINPACK and EISPACK
without having to learn Fortran.
• Together with Jack Little and Steve Bangert
they founded Mathworks in 1984 and created
Matlab.
• The current version is 7.
• Interpreted-code based system in which the
fundamental element is a matrix.
3
The Interface
Workspace
and
Launch Pad
Command
History
and
Current
Directory
Command
Window
4
 
  
 
1 2
m
3 4
Variable assignment
• Scalar: a = 4
• Vector: v = [3 5 1]
v(2) = 8
t = [0:0.1:5]
• Matrix: m = [1 2 ; 3 4]
m(1,2)=0
 

v 3 5 1
 

v 3 8 1
 

t 0 0.1 0.2 4.9 5
 
  
 
1 0
m
3 4
5
Basic Operations
• Scalar expressions
b = 10 / ( sqrt(a) + 3 )
c = cos (b * pi)
• Matrix expressions
n = m * [1 0]’


10
b
a 3
     
 
     
     
1 0 1 1
n
3 4 0 3


c cos(b )
6
Useful matrix operations
• Determinant: det(m)
• Inverse: inv(m)
• Rank: rank(m)
• i by j matrix of zeros: m = zeros(i,j)
• i by j matrix of ones: m = ones(i,j)
• i by i identity matrix: m = eye(i)
7
Example
• Generate and plot a cosine function
x = [0:0.01:2*pi];
y = cos(x);
plot(x,y)
8
Example
• Adding titles to graphs and axis
title(‘this is the title’)
xlabel(‘x’)
ylabel(‘y’)
9
Adding graphs to reports
• Three options:
1) Print the figure directly
2) Save it to a JPG / BMP / TIFF file and add to the
report (File → Export…)
3) Copy to clipboard and paste to the report
(Edit → Copy Figure) *
* The background is copied too! By default it is gray. To change the
background color use:
set(gcf,’color’,’white’)
10
The .m files
• Programming in Matlab is done by creating “.m” files.
File → New → M-File
• Useful for storing a sequence of commands or creating
new functions.
• Call the program by writing the name of the file where it
is saved (check the “current directory”)
• “%” can be used for commenting.
11
Other useful information
• help <function name> displays the help for the function
ex.: help plot
• helpdesk brings up a GUI for browsing very
comprehensive help documents
• save <filename> saves everything in the workspace (all
variables) to <filename>.mat.
• load <filename> loads the file.
12
Using Matlab to create models
• Why model?
- Represent
- Analyze
• What kind of systems are we interested?
- Single-Input-Single-Output (SISO)
- Linear Time Invariant (LTI)
- Continuous
G(s) Y(s)
X(s)
13
Model representations
Three Basic types of model representations for
continuous LTI systems:
• Transfer Function representation (TF)
• Zero-Pole-Gain representation (ZPK)
• State Space representation (SS)
! More help is available for each model representation by typing:
help ltimodels
14
Transfer Function representation
Given:  
 
2
( ) 25
( )
( ) 4 25
Y s
G s
U s s s
num = [0 0 25];
den = [1 4 25];
G = tf(num,den)
Method (a) Method (b)
s = tf('s');
G = 25/(s^2 +4*s +25)
Matlab function: tf
15
Zero-Pole-Gain representation
Given:

 
   
( ) 3( 1)
( )
( ) ( 2 )( 2 )
Y s s
H s
U s s i s i
zeros = [1];
poles = [2-i 2+i];
gain = 3;
H = zpk(zeros,poles,gain)
Matlab function: zpk
16
State Space representation
Given: ,
 


 

x Ax Bu
y Cx Du
Matlab function: ss
   
   
 
   

   
  
1 0 1
2 1 0
3 2 0
A B
C D
A = [1 0 ; -2 1];
B = [1 0]’;
C = [3 -2];
D = [0];
sys = ss(A,B,C,D)
17
System analysis
• Once a model has been introduced in Matlab, we can
use a series of functions to analyze the system.
• Key analyses at our disposal:
1) Stability analysis
e.g. pole placement
2) Time domain analysis
e.g. response to different inputs
3) Frequency domain analysis
e.g. bode plot
18
Is the system stable?
Recall: All poles of the system must be on the right
hand side of the S plain for continuous LTI systems to
be stable.
Manually: Poles are the roots for the denominator
of transfer functions or eigen values of matrix A
for state space representations
In Matlab: pole(sys)
Stability analysis
19
Once a model has been inserted in Matlab, the step
response can be obtained directly from: step(sys)
Time domain analysis
Unit Step Response of G(s)
Time (sec)
Amplitude
0 0.5 1 1.5 2 2.5 3
0.2
0.4
0.6
0.8
1
1.2
1.4
Peak Time
Rise Time
Steady State
Settling Time
overshoot
20
Time domain analysis
• Impulse response
impulse(sys)
• Response to an arbitrary input
e.g.
t = [0:0.01:10];
u = cos(t);
lsim(sys,u,t)
Matlab also caries other useful functions for time domain
analysis:
! It is also possible to assign a variable to those functions to obtain a
vector with the output. For example: y = impulse(sys);
21
Bode plots can be created directly by using: bode(sys)
Frequency domain analysis
22
For a pole and zero plot: pzmap(sys)
Frequency domain analysis
-2 -1.8 -1.6 -1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0
-4
-3
-2
-1
0
1
2
3
4
Pole-Zero Map
Real Axis
Imaginary
Axis
23
Extra: partial fraction expansion
num=[2 3 2];
den=[1 3 2];
[r,p,k] = residue(num,den)
r =
-4
1
p =
-2
-1
k =
2
Answer:
)
1
(
1
)
2
(
4
2
)
(
)
(
)
1
(
)
1
(
)
(
)
(
0














s
s
s
n
p
s
n
r
p
s
r
s
k
s
G 

2
3
2
3
2
)
( 2
2





s
s
s
s
s
G
Given:

More Related Content

Similar to 4413-lecture-09 Introduction Matlab lecture .ppt

sol43.pdf
sol43.pdfsol43.pdf
sol43.pdf
Halamezyed
 
Introduction to Matlab.ppt
Introduction to Matlab.pptIntroduction to Matlab.ppt
Introduction to Matlab.ppt
Ravibabu Kancharla
 
Dsp file
Dsp fileDsp file
Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
THEMASTERBLASTERSVID
 
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptxMATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
prashantkumarchinama
 
Matlab Tutorial.ppt
Matlab Tutorial.pptMatlab Tutorial.ppt
Matlab Tutorial.ppt
RaviMuthamala1
 
MATLAB & Image Processing
MATLAB & Image ProcessingMATLAB & Image Processing
MATLAB & Image Processing
Techbuddy Consulting Pvt. Ltd.
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
chestialtaff
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
Arshit Rai
 
MATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.pptMATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.ppt
ssuserdee4d8
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
Saidur Rahman
 
Applied numerical methods lec2
Applied numerical methods lec2Applied numerical methods lec2
Applied numerical methods lec2
Yasser Ahmed
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
Arshit Rai
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Tarun Gehlot
 
5_2019_01_12!09_25_57_AM.ppt
5_2019_01_12!09_25_57_AM.ppt5_2019_01_12!09_25_57_AM.ppt
5_2019_01_12!09_25_57_AM.ppt
aboma2hawi
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Dun Automation Academy
 
Lecture 01 variables scripts and operations
Lecture 01   variables scripts and operationsLecture 01   variables scripts and operations
Lecture 01 variables scripts and operations
Smee Kaem Chann
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
Divyanshu Rasauria
 

Similar to 4413-lecture-09 Introduction Matlab lecture .ppt (20)

sol43.pdf
sol43.pdfsol43.pdf
sol43.pdf
 
Introduction to Matlab.ppt
Introduction to Matlab.pptIntroduction to Matlab.ppt
Introduction to Matlab.ppt
 
Dsp file
Dsp fileDsp file
Dsp file
 
Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
 
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptxMATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
 
Matlab Tutorial.ppt
Matlab Tutorial.pptMatlab Tutorial.ppt
Matlab Tutorial.ppt
 
MATLAB & Image Processing
MATLAB & Image ProcessingMATLAB & Image Processing
MATLAB & Image Processing
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
MATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.pptMATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.ppt
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
 
Applied numerical methods lec2
Applied numerical methods lec2Applied numerical methods lec2
Applied numerical methods lec2
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
5_2019_01_12!09_25_57_AM.ppt
5_2019_01_12!09_25_57_AM.ppt5_2019_01_12!09_25_57_AM.ppt
5_2019_01_12!09_25_57_AM.ppt
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Lecture 01 variables scripts and operations
Lecture 01   variables scripts and operationsLecture 01   variables scripts and operations
Lecture 01 variables scripts and operations
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
 

Recently uploaded

原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 

Recently uploaded (20)

原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 

4413-lecture-09 Introduction Matlab lecture .ppt

  • 1. 1 ECEN 4413 - Automatic Control Systems Matlab Lecture 1 Introduction and Control Basics Presented by Moayed Daneshyari OKLAHOMA STATE UNIVERSITY
  • 2. 2 What is Matlab? • Invented by Cleve Moler in late 1970s to give students access to LINPACK and EISPACK without having to learn Fortran. • Together with Jack Little and Steve Bangert they founded Mathworks in 1984 and created Matlab. • The current version is 7. • Interpreted-code based system in which the fundamental element is a matrix.
  • 4. 4        1 2 m 3 4 Variable assignment • Scalar: a = 4 • Vector: v = [3 5 1] v(2) = 8 t = [0:0.1:5] • Matrix: m = [1 2 ; 3 4] m(1,2)=0    v 3 5 1    v 3 8 1    t 0 0.1 0.2 4.9 5        1 0 m 3 4
  • 5. 5 Basic Operations • Scalar expressions b = 10 / ( sqrt(a) + 3 ) c = cos (b * pi) • Matrix expressions n = m * [1 0]’   10 b a 3                     1 0 1 1 n 3 4 0 3   c cos(b )
  • 6. 6 Useful matrix operations • Determinant: det(m) • Inverse: inv(m) • Rank: rank(m) • i by j matrix of zeros: m = zeros(i,j) • i by j matrix of ones: m = ones(i,j) • i by i identity matrix: m = eye(i)
  • 7. 7 Example • Generate and plot a cosine function x = [0:0.01:2*pi]; y = cos(x); plot(x,y)
  • 8. 8 Example • Adding titles to graphs and axis title(‘this is the title’) xlabel(‘x’) ylabel(‘y’)
  • 9. 9 Adding graphs to reports • Three options: 1) Print the figure directly 2) Save it to a JPG / BMP / TIFF file and add to the report (File → Export…) 3) Copy to clipboard and paste to the report (Edit → Copy Figure) * * The background is copied too! By default it is gray. To change the background color use: set(gcf,’color’,’white’)
  • 10. 10 The .m files • Programming in Matlab is done by creating “.m” files. File → New → M-File • Useful for storing a sequence of commands or creating new functions. • Call the program by writing the name of the file where it is saved (check the “current directory”) • “%” can be used for commenting.
  • 11. 11 Other useful information • help <function name> displays the help for the function ex.: help plot • helpdesk brings up a GUI for browsing very comprehensive help documents • save <filename> saves everything in the workspace (all variables) to <filename>.mat. • load <filename> loads the file.
  • 12. 12 Using Matlab to create models • Why model? - Represent - Analyze • What kind of systems are we interested? - Single-Input-Single-Output (SISO) - Linear Time Invariant (LTI) - Continuous G(s) Y(s) X(s)
  • 13. 13 Model representations Three Basic types of model representations for continuous LTI systems: • Transfer Function representation (TF) • Zero-Pole-Gain representation (ZPK) • State Space representation (SS) ! More help is available for each model representation by typing: help ltimodels
  • 14. 14 Transfer Function representation Given:     2 ( ) 25 ( ) ( ) 4 25 Y s G s U s s s num = [0 0 25]; den = [1 4 25]; G = tf(num,den) Method (a) Method (b) s = tf('s'); G = 25/(s^2 +4*s +25) Matlab function: tf
  • 15. 15 Zero-Pole-Gain representation Given:        ( ) 3( 1) ( ) ( ) ( 2 )( 2 ) Y s s H s U s s i s i zeros = [1]; poles = [2-i 2+i]; gain = 3; H = zpk(zeros,poles,gain) Matlab function: zpk
  • 16. 16 State Space representation Given: ,        x Ax Bu y Cx Du Matlab function: ss                       1 0 1 2 1 0 3 2 0 A B C D A = [1 0 ; -2 1]; B = [1 0]’; C = [3 -2]; D = [0]; sys = ss(A,B,C,D)
  • 17. 17 System analysis • Once a model has been introduced in Matlab, we can use a series of functions to analyze the system. • Key analyses at our disposal: 1) Stability analysis e.g. pole placement 2) Time domain analysis e.g. response to different inputs 3) Frequency domain analysis e.g. bode plot
  • 18. 18 Is the system stable? Recall: All poles of the system must be on the right hand side of the S plain for continuous LTI systems to be stable. Manually: Poles are the roots for the denominator of transfer functions or eigen values of matrix A for state space representations In Matlab: pole(sys) Stability analysis
  • 19. 19 Once a model has been inserted in Matlab, the step response can be obtained directly from: step(sys) Time domain analysis Unit Step Response of G(s) Time (sec) Amplitude 0 0.5 1 1.5 2 2.5 3 0.2 0.4 0.6 0.8 1 1.2 1.4 Peak Time Rise Time Steady State Settling Time overshoot
  • 20. 20 Time domain analysis • Impulse response impulse(sys) • Response to an arbitrary input e.g. t = [0:0.01:10]; u = cos(t); lsim(sys,u,t) Matlab also caries other useful functions for time domain analysis: ! It is also possible to assign a variable to those functions to obtain a vector with the output. For example: y = impulse(sys);
  • 21. 21 Bode plots can be created directly by using: bode(sys) Frequency domain analysis
  • 22. 22 For a pole and zero plot: pzmap(sys) Frequency domain analysis -2 -1.8 -1.6 -1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0 -4 -3 -2 -1 0 1 2 3 4 Pole-Zero Map Real Axis Imaginary Axis
  • 23. 23 Extra: partial fraction expansion num=[2 3 2]; den=[1 3 2]; [r,p,k] = residue(num,den) r = -4 1 p = -2 -1 k = 2 Answer: ) 1 ( 1 ) 2 ( 4 2 ) ( ) ( ) 1 ( ) 1 ( ) ( ) ( 0               s s s n p s n r p s r s k s G   2 3 2 3 2 ) ( 2 2      s s s s s G Given: