STATE SPACE MODELS MATLAB Tutorial.

Slides:



Advertisements
Similar presentations
Calculating Slope m = y2 – y1 x2 – x1.
Advertisements

4.1 Introduction to Matrices
Numerical Solution of Linear Equations
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Lect.3 Modeling in The Time Domain Basil Hamed
SOLUTION OF STATE EQUATION
Objectives  Represent systems of equations with matrices  Find dimensions of matrices  Identify square matrices  Identify an identity matrix  Form.
Transfer Functions Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: The following terminology.
Matlab Matlab is a powerful mathematical tool and this tutorial is intended to be an introduction to some of the functions that you might find useful.
Here is a preview of one type of problem we are going to solve using matrices. Solve this system of equations:
Transfer Functions Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: The following terminology.
Modeling in the Time Domain - State-Space
Digital Control Systems
10.1 Gaussian Elimination Method
Functions and Equations of Two Variables Lesson 6.1.
Linear Simultaneous Equations
Matrix Mathematics in MATLAB and Excel
Lecture 24 Introduction to state variable modeling Overall idea Example Simulating system response using MATLAB Related educational modules: –Section 2.6.1,
5.1 Solving Systems of Linear Equations by Graphing
Reduced Row Echelon Form Matrices and the Calculator.
Autumn 2008 EEE8013 Revision lecture 1 Ordinary Differential Equations.
4.5 Solving Systems using Matrix Equations and Inverses.
8.1 Solving Systems of Linear Equations by Graphing
Lesson 11-1 Matrix Basics and Augmented Matrices Objective: To learn to solve systems of linear equation using matrices.
Solving Systems of 3 or More Variables Why a Matrix? In previous math classes you solved systems of two linear equations using the following method:
Inverse Matrices and Systems
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
1 Ch. 4 Linear Models & Matrix Algebra Matrix algebra can be used: a. To express the system of equations in a compact manner. b. To find out whether solution.
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
Scientific Computing General Least Squares. Polynomial Least Squares Polynomial Least Squares: We assume that the class of functions is the class of all.
Sullivan Algebra and Trigonometry: Section 12.3 Objectives of this Section Write the Augmented Matrix of a System of Linear Equations Write the System.
10.2 Systems of Linear Equations: Matrices Objectives Objectives 1.Write the Augmented Matrix 2.Write the System from the Augmented matrix 3.Perform Row.
1 Section 5.3 Linear Systems of Equations. 2 THREE EQUATIONS WITH THREE VARIABLES Consider the linear system of three equations below with three unknowns.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Differential Equations Linear Equations with Variable Coefficients.
Discretization of Continuous-Time State Space Models
ERT 210/4 Process Control & Dynamics DYNAMIC BEHAVIOR OF PROCESSES :
TRANSFER FUNCTION Prepared by Mrs. AZDUWIN KHASRI.
3.8B Solving Systems using Matrix Equations and Inverses.
State Space Models The state space model represents a physical system as n first order differential equations. This form is better suited for computer.
Algebra Review. Systems of Equations Review: Substitution Linear Combination 2 Methods to Solve:
TODAY IN ALGEBRA 2.0…  Review: Solving Linear Systems by Graphing  Learning Goal 1: 3.2 Solving Linear Systems by Substitution with one equation solved.
Matrices and systems of Equations. Definition of a Matrix * Rectangular array of real numbers m rows by n columns * Named using capital letters * First.
Introduction to Differential Equations
Using Matrices to Solve a 3-Variable System
College Algebra Chapter 6 Matrices and Determinants and Applications
Transfer Functions Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: The following terminology.
Section 14.2 Computing Partial Derivatives Algebraically
Modeling of geochemical processes Linear system of differential equations J. Faimon.
MESB374 System Modeling and Analysis
Modeling and Simulation Dr. Mohammad Kilani
© Dr. Elmer P. Dadios - DLSU Fellow & Professor
State Space Representation
Solve Linear Systems by Graphing
We will be looking for a solution to the system of linear differential equations with constant coefficients.
FE Exam Tutorial
Systems of Equations Lesson 41: Solve by using a matrix
Computer Graphics Lecture 37
Solving Systems Using Matrices
State Space Analysis and Controller Design
Solving Linear Systems Algebraically
Use Inverse Matrices to Solve 2 Variable Linear Systems
Matrix Solutions to Linear Systems
State Space Analysis UNIT-V.
Communication and Coding Theory Lab(CS491)
6 minutes Warm-Up Find each product..
ALGEBRA TWO Section Writing Equations of Lines
Chapter 3 Modeling in the Time Domain
SYSTEM OF DIFFERENTIAL EQUATIONS
Multiply by 5/40 and sum with 2nd row
Presentation transcript:

STATE SPACE MODELS MATLAB Tutorial

Why State Space Models The state space model represents a physical system as n first order differential equations. This form is better suited for computer simulation than an nth order input-output differential equation.  

Basics Vector matrix format generally is given by: where y is the output equation, and x is the state vector

PARTS OF A STATE SPACE REPRESENTATION State Variables: a subset of system variables which if known at an initial time t0 along with subsequent inputs are determined for all time t>t0+ State Equations: n linearly independent first order differential equations relating the first derivatives of the state variables to functions of the state variables and the inputs. Output equations: algebraic equations relating the state variables to the system outputs.

v' = (-b/m) v + (-k/m) x + f(t)/m EXAMPLE The equation gathered from the free body diagram is: mx" + bx' + kx - f(t) = 0 Substituting the definitions of the states into the equation results in: mv' + bv + kx - f(t) = 0 Solving for v' gives the state equation: v' = (-b/m) v + (-k/m) x + f(t)/m The desired output is for the position, x, so: y = x

v' = (-k/m) x + (-b/m) v + f(t)/m Cont… Now the derivatives of the state variables are in terms of the state variables, the inputs, and constants. x' = v v' = (-k/m) x + (-b/m) v + f(t)/m y = x

PUTTING INTO VECTOR-MATRIX FORM Our state vector consists of two variables, x and v so our vector-matrix will be in the form:

Explanation The first row of A and the first row of B are the coefficients of the first state equation for x'.  Likewise the second row of A and the second row of B are the coefficients of the second state equation for v'.  C and D are the coefficients of the output equation for y.

EXACT REPRESENTATION

HOW TO INPUT THE STATE SPACE MODEL INTO MATLAB In order to enter a state space model into MATLAB, enter the coefficient matrices A, B, C, and D into MATLAB.  The syntax for defining a state space model in MATLAB is: statespace = ss(A, B, C, D) where A, B, C, and D are from the standard vector-matrix form of a state space model.

Example For the sake of example, lets take m = 2, b = 5, and k = 3. >> A = [ 0  1 ; -k/m  -b/m ]; >> B = [ 0 ; 1/m ]; >> C = [ 1  0 ]; >> D = 0; >> statespace_ss = ss(A, B, C, D)

Output This assigns the state space model under the name statespace_ss and output the following: a =        x1  x2    x1   0   1    x2 -1.5 -2.5

Cont… b =        u1    x1   0    x2  0.5 c =        x1  x2    y1   1   0    

Cont… d =        u1    y1   0   Continuous-time model.

EXTRACTING A, B, C, D MATRICES FROM A STATE SPACE MODEL In order to extract the A, B, C, and D matrices from a previously defined state space model, use MATLAB's ssdata command. [A, B, C, D] = ssdata(statespace) where statespace is the name of the state space system.

Example >> [A, B, C, D] = ssdata(statespace_ss) The MATLAB output will be: A =      -2.5000   -0.3750     4.0000         0

Cont… B = 0.2500 0 C = 0 0.5000 D = 0

STEP RESPONSE USING THE STATE SPACE MODEL Once the state space model is entered into MATLAB it is easy to calculate the response to a step input. To calculate the response to a unit step input, use: step(statespace) where statespace is the name of the state space system. For steps with magnitude other than one, calculate the step response using: step(u * statespace) where u is the magnitude of the step and  statespace is the name of the state space system.