OKLAHOMA STATE UNIVERSITY

Similar documents
Lecture 14 - Using the MATLAB Control System Toolbox and Simulink Friday, February 8, 2013

EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring Lab Information

ECE 203 LAB 1 MATLAB CONTROLS AND SIMULINK

Lecture 4. Programming

Matlab Controller Design. 1. Control system toolbox 2. Functions for model analysis 3. Linear system simulation 4. Biochemical reactor linearization

CONTROL SYSTEMS LABORATORY ECE311 LAB 1: The Magnetic Ball Suspension System: Modelling and Simulation Using Matlab

Appendix 3B MATLAB Functions for Modeling and Time-domain analysis

EEE161 Applied Electromagnetics Laboratory 1

APPLICATIONS FOR ROBOTICS

ECE 3793 Matlab Project 3 Solution

EEL2216 Control Theory CT1: PID Controller Design

Outline. Classical Control. Lecture 1

Laboratory 11 Control Systems Laboratory ECE3557. State Feedback Controller for Position Control of a Flexible Joint

ECE 3793 Matlab Project 3

Control System Engineering

Richiami di Controlli Automatici

9. Introduction and Chapter Objectives

Chapter 4: The State Space and Numerical Simulation

Tutorial 4 (Week 11): Matlab - Digital Control Systems

Chapter 7: Time Domain Analysis

State Feedback Controller for Position Control of a Flexible Link

LABORATORY INSTRUCTION MANUAL CONTROL SYSTEM I LAB EE 593

CHAPTER 6 STATE SPACE: FREQUENCY RESPONSE, TIME DOMAIN

Athena Visual Software, Inc. 1

Homework 1 Solutions

1 Steady State Error (30 pts)

Lab 1: Dynamic Simulation Using Simulink and Matlab

MAT 275 Laboratory 7 Laplace Transform and the Symbolic Math Toolbox

ECE382/ME482 Spring 2005 Homework 1 Solution February 10,

MAE 143B - Homework 7

EXPERIMENTALLY DETERMINING THE TRANSFER FUNCTION OF A SPRING- MASS SYSTEM

Systems Analysis and Control

Lecture 9. Welcome back! Coming week labs: Today: Lab 16 System Identification (2 sessions)

APPENDIX 1 MATLAB AND ANSYS PROGRAMS

Matlab for Review. NDSU Matlab Review pg 1

Department of Electrical and Computer Engineering ECED4601 Digital Control System Lab3 Digital State Space Model

MAE143A Signals & Systems - Homework 5, Winter 2013 due by the end of class Tuesday February 12, 2013.

YTÜ Mechanical Engineering Department

INTRODUCTION TO TRANSFER FUNCTIONS

Introduction to Matlab

Outline. Classical Control. Lecture 2

MAE 143B - Homework 9

ECE 320 Linear Control Systems Winter Lab 1 Time Domain Analysis of a 1DOF Rectilinear System

7.4 STEP BY STEP PROCEDURE TO DRAW THE ROOT LOCUS DIAGRAM

Math Assignment 3 - Linear Algebra

Lecture 5b: Starting Matlab

New Mexico Tech Hyd 510

Control Systems I. Lecture 6: Poles and Zeros. Readings: Emilio Frazzoli. Institute for Dynamic Systems and Control D-MAVT ETH Zürich

LAB 1: MATLAB - Introduction to Programming. Objective:

Learning MATLAB by doing MATLAB

Homework Assignment 3

Differential Equations and Lumped Element Circuits

Solution to Homework Assignment 1

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Mechanical Engineering 2.04A Systems and Controls Spring 2013

2.010 Fall 2000 Solution of Homework Assignment 1

MAE 143B - Homework 8 Solutions

EE C128 / ME C134 Fall 2014 HW 6.2 Solutions. HW 6.2 Solutions

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

1 Overview of Simulink. 2 State-space equations

Fin System, Inc. Company Report. Temperature Profile Calculators. Team 1 J. C. Stewards, Lead A. B. Williams, Documentation M. D.

Frequency Response of Linear Time Invariant Systems

CDS 101/110: Lecture 3.1 Linear Systems

CDS 101/110: Lecture 6.2 Transfer Functions

CYBER EXPLORATION LABORATORY EXPERIMENTS

Control Systems I Lecture 10: System Specifications

USE OF MATLAB TO UNDERSTAND BASIC MATHEMATICS

2 Solving Ordinary Differential Equations Using MATLAB

University of Alberta ENGM 541: Modeling and Simulation of Engineering Systems Laboratory #7. M.G. Lipsett & M. Mashkournia 2011

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

ES205 Analysis and Design of Engineering Systems: Lab 1: An Introductory Tutorial: Getting Started with SIMULINK

Control Systems Design

LECTURE NOTES ON CONTROL

System Parameters and Frequency Response MAE 433 Spring 2012 Lab 2

Systems Analysis and Control

Lab # 4 Time Response Analysis

Graphical User Interface for Design Stabilizing Controllers

Advanced Control Theory

Lesson 11: Mass-Spring, Resonance and ode45

Automatic Control EEE 2002 Tutorial Exercise IV

Lab Experiment 2: Performance of First order and second order systems

Bangladesh University of Engineering and Technology. EEE 402: Control System I Laboratory

MATHEMATICAL MODELING OF CONTROL SYSTEMS

Lesson 15: Oregonator, Chemical Reactions and ode15s

The Laplace Transform

DIGITAL SIGNAL PROCESSING LABORATORY

Signal Processing First Lab 11: PeZ - The z, n, and ˆω Domains

Transfer function and linearization

SECTION 5: ROOT LOCUS ANALYSIS

INFE 5201 SIGNALS AND SYSTEMS

Rotary Motion Servo Plant: SRV02. Rotary Experiment #11: 1-DOF Torsion. 1-DOF Torsion Position Control using QuaRC. Student Manual

EE C128 / ME C134 Final Exam Fall 2014

Observer Incorporated Neoclassical Controller Design: A Discrete Perspective

Systems Analysis and Control

Systems Analysis and Control

Linear System Theory

CHAPTER 5: LAPLACE TRANSFORMS

TRANSIENT MODELING. Sewering

2.010 Fall 2000 Solution of Homework Assignment 8

Numeric Matlab for Laplace Transforms

Transcription:

OKLAHOMA STATE UNIVERSITY ECEN 4413 - Automatic Control Systems Matlab Lecture 1 Introduction and Control Basics Presented by Moayed Daneshyari 1

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. 2

The Interface Workspace and Launch Pad Command History and Current Directory Command Window 3

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 [ ] = L t 0 0.1 0.2 4.9 5 1 2 m = 3 4 = 1 0 m 3 4 4

Basic Operations Scalar expressions b = 10 / ( sqrt(a) + 3 ) c = cos (b * pi) Matrix expressions n = m * [1 0] n b = 10 a + 3 c = cos(b π ) 1 0 1 1 = = 3 4 0 3 5

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) 6

Example Generate and plot a cosine function x = [0:0.01:2*pi]; y = cos(x); plot(x,y) 7

Example Adding titles to graphs and axis title( this is the title ) xlabel( x ) ylabel( y ) 8

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 ) 9

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. 10

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. 11

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 X(s) G(s) Y(s) 12

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 13

Transfer Function representation Given: Gs ( ) = = Y ( s ) 25 2 U ( s ) s + 4s + 25 Matlab function: tf Method (a) Method (b) num = [0 0 25]; den = [1 4 25]; G = tf(num,den) s = tf('s'); G = 25/(s^2 +4*s +25) 14

Zero-Pole-Gain representation Given: H ( s ) Y ( s ) 3( s 1) = = U ( s ) ( s 2 + i )( s 2 i ) Matlab function: zpk zeros = [1]; poles = [2-i 2+i]; gain = 3; H = zpk(zeros,poles,gain) 15

State Space representation &x Ax Bu y = Cx + Du = + Given:, 1 0 1 A = B = 2 1 0 C = D = [ 3 2] [ 0 ] Matlab function: ss A = [1 0 ; -2 1]; B = [1 0] ; C = [3-2]; D = [0]; sys = ss(a,b,c,d) 16

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 17

Stability analysis 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) 18

Time domain analysis Once a model has been inserted in Matlab, the step response can be obtained directly from: step(sys) 1.4 Unit Step Response of G(s) 1.2 overshoot Steady State 1 0.8 0.6 0 0.5 1 1.5 2 2.5 3 Time (sec) 19 Amplitude 0.4 Settling Time 0.2 Peak Time Rise Time

Time domain analysis Matlab also caries other useful functions for 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)! It is also possible to assign a variable to those functions to obtain a vector with the output. For example: y = impulse(sys); 20

Frequency domain analysis Bode plots can be created directly by using: bode(sys) 21

Frequency domain analysis For a pole and zero plot: pzmap(sys) 4 Pole-Zero Map 3 2 1 0-1 -2-3 -4-2 -1.8-1.6-1.4-1.2-1 -0.8-0.6-0.4-0.2 0 Real Axis 22 Imaginary Axis

Extra: partial fraction expansion Given: 2s Gs ( ) = 2 s 2 + 3s + 3s + + 2 2 num=[2 3 2]; den=[1 3 2]; [r,p,k] = residue(num,den) r = -4 1 p = -2-1 k = 2 Answer: r (1) G ( s ) = k ( s ) + + L + s p (1) = 2 s 0 + s 4 ( 2) + s s 1 ( 1) r ( n ) pn ( 23 )