Control Systems Lab LAB # 3
Modeling using state space
State space
There are several different ways to describe a system of linear differential equations. The state-space representation is given by the equations:
where x is an n by 1 vector representing the state (commonly position and velocity variables in mechanical systems), u is a scalar representing the input (commonly a force or torque in mechanical systems), and y is a scalar representing the output. The matrices A (n by n), B (n by 1), and C (1 by n) determine the relationships between the state and input and output variables. Note that there are n first-order differential equations. State space representation can also be used for systems with multiple inputs and outputs (MIMO), but we will only use single-input, single-output (SISO) systems in these tutorials.
State-Space Equations for the DC Motor
Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamic system. The current i and the angular rate ω are the two states of the system. The applied voltage,, is the input to the system, and the angular velocity ω is the output.
The previous state space model represent the output as angular speed and if you want the angle (position) as output we make some understood changes.
More Details about state space:
The state space model is one of the representation ways that define a system and as well as the transfer function defines a system by its numerator and denominator the state space defines the system by its four matrices A,B,C,D and take the form:
At first, the variable x is called the state variable , u is called the input of the system.
The state space can be derived from the differential equations directly. If we note that the two equations 1.6 & 1.7 represent a system (DC Motor) and the state variables are i & w and the input is Vapp . Matrix A is the coefficient of the state variables (i, w) , Matrix B is the coefficient of the input Vapp. The output y is the output of the system and here we can choose between i or w to be the output or both and we chose the speed of the motor w to be our output and represent it as y=w by matrix C and D.
- conv : This command is used to convolve two polynomials. It is particularly useful for determining the expanded coefficients for factored polynomials. For example, this command can be used to enter the transfer function by typing “H=tf([1 2],conv([1 1],[1 -3]))”.
- series or * : This command is used to combine two transfer functions that are in series. For example, if H(s) and G(s) are in series, they could be combined with the command “T=G*H” or “T=series(G,H)”.
- parallel : This command is used to combine two transfer functions that are in parallel.For example, if G(s) is in the forward path and H(s) is in the feedback path, they could be combined with the command “T=parallel(G,H)”.
- feedback : This command is used to combine two transfer functions that are in feedback. For example, if G(s) is in the forward path and H(s) is in the feedback path, they could be combined with the command “T=feedback(G,H)”.
- ss :This command used to represent a system by state space model and it takes the four parameter matrices A,B,C,D. For example :
sys = ss(A,B,C,D); So it convert the matrices and define them as a system.
- tf2ss : converts the parameters of a transfer function representation of a given system to those of an equivalent state-space representation.
[A,B,C,D] = tf2ss (num,den) returns the A, B, C, and D matrices of a state space representation for the single-input transfer function
- ss2tf : converts a state-space representation of a given system to an equivalent transfer function representation.
[num,den] = ss2tf(A,B,C,D) returns the transfer function.
First And Second Order System
The T.F for First order system is
For example to find the response of the first order system write the following Matlab code :
Second order systems
Impulse response
Step response
Introduction to Simulink
Exercise
Find the step response for the two parallel transfer functions G1&G2
1