Typically, control engineers begin by developing a mathematical description of the dynamic system that they want to control. The system to be controlled is called a plant. As an example of a plant, this section uses the DC motor. This section develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load. It then shows you how to use the Control System Toolbox™ functions to build linear models based on these equations.
You can use Control System Toolbox functions to create the following model representations:
State-space models (SS) of the form
dx/dt= A x + B u
y = C x + D u
where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors.
Transfer functions (TF), for example,
H(s)=s+2*s^2+s+10
Zero-pole-gain (ZPK) models, for example,
H( z )=3(z+1+j)(z+1−j)/( z + 0.2 )( z + 0.1 )
Frequency response data (FRD) models, which consist of sampled measurements of a system's frequency response. For example, you can store experimentally collected frequency response data in an FRD model.
The design of FRD models is a specialized subject that this topic does not address. See Frequency Response Data (FRD) Models for a discussion of this topic.
A simple model of a DC motor driving an inertial load shows the angular rate of the load, ω(t), as the output and applied voltage, υapp(t), as the input. The ultimate goal of this example is to control the angular rate by varying the applied voltage. This figure shows a simple model of the DC motor.
A Simple Model of a DC Motor Driving an Inertial Load
In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant. The resistance of the circuit is denoted by R and the self-inductance of the armature by L. If you are unfamiliar with the basics of DC motor modeling, consult any basic text on physical modeling. With this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system. In this example, the relationships between electric potential and mechanical force are Faraday's law of induction and Ampère's law for the force on a conductor moving through a magnetic field.
The torque τ seen at the shaft of the motor is proportional to the current i induced by the applied voltage,
τ(t)=Kmi(t)
where Km, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the conductor coil, and so on. The back (induced) electromotive force, υemf, is a voltage proportional to the angular rate ω seen at the shaft,
υemf(t)=Kbω(t)
where Kb, the emf constant, also depends on certain physical properties of the motor.
The mechanical part of the motor equations is derived using Newton's law, which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft. The result is this equation,
J (dw/dt)=∑τi=−Kfω(t)+Kmi(t)
where Kfω is a linear approximation for viscous friction.
Finally, the electrical part of the motor equations can be described by
υapp(t)−υemf(t)=L (di/dt)+ R i(t)
or, solving for the applied voltage and substituting for the back emf,
υapp(t)=L (di/dt)+ R i(t)+Kbω(t)
This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current,
di/dt=−(R/L) i(t)−(Kb /L)ω(t)+(1/L)υapp(t)
and the second for the resulting angular rate,
dω/dt=−(1/J) Kfω(t)+(1/J)Kmi(t)
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, υapp, is the input to the system, and the angular velocity ω is the output.
d/dt[i; ω]= [ -R/L -Kb /L
-Km /J -Kf /j ] [i ; w] + [ i/L 0] *υapp(t)
State-Space Representation of the DC Motor Example
y(t)=[0 1]⋅[i ω]+[0]⋅υapp(t)
After you develop a set of differential equations that describe your plant, you can construct SISO models using simple commands. The following sections discuss
Constructing a state-space model of the DC motor
Converting between model representations
Creating transfer function and zero/pole/gain models
Enter the following nominal values for the various parameters of a DC motor.
R= 2.0 % Ohms L= 0.5 % Henrys Km = .015 % torque constant Kb = .015 % emf constant Kf = 0.2 % Nms J= 0.02 % kg.m^2
Given these values, you can construct the numerical state-space representation using the ss
function.
A = [-R/L -Kb/L; Km/J -Kf/J] B = [1/L; 0]; C = [0 1]; D = [0]; sys_dc = ss(A,B,C,D)
These commands return the following result:
a = x1 x2 x1 -4 -0.03 x2 0.75 -10 b = u1 x1 2 x2 0 c = x1 x2 y1 0 1 d = u1 y1 0
Now that you have a state-space representation of the DC motor, you can convert to other model representations, including transfer function (TF) and zero/pole/gain (ZPK) models.
Transfer Function Representation. You can use tf
to convert from the state-space representation to the transfer function. For example, use this code to convert to the transfer function representation of the DC motor.
sys_tf = tf(sys_dc)
Transfer function: 1.5 ------------------ s^2 + 14 s + 40.02
Zero/Pole/Gain Representation. Similarly, the zpk
function converts from state-space or transfer function representations to the zero/pole/gain format. Use this code to convert from the state-space representation to the zero/pole/gain form for the DC motor.
sys_zpk = zpk (sys_dc) Zero/pole/gain: 1.5 ------------------- (s+4.004) (s+9.996)
The state-space representation is best suited for numerical computations. For highest accuracy, convert to state space prior to combining models and avoid the transfer function and zero/pole/gain representations, except for model specification and inspection.
In the DC motor example, the state-space approach produces a set of matrices that represents the model. If you choose a different approach, you can construct the corresponding models using tf
, zpk
, ss
, or frd
.
sys = tf(num,den) % Transfer function sys = zpk(z,p,k) % Zero/pole/gain sys = ss(a,b,c,d) % State-space sys = frd(response,frequencies) % Frequency response data
For example, you can create the transfer function by specifying the numerator and denominator with this code.
sys_tf = tf(1.5,[1 14 40.02]) Transfer function: 1.5 ------------------ s^2 + 14 s + 40.02
Alternatively, if you want to create the transfer function of the DC motor directly, use these commands.
s = tf('s'); sys_tf = 1.5/(s^2+14*s+40.02)
These commands result in this transfer function.
Transfer function: 1.5 -------------------- s^2 + 14 s + 40.02
To build the zero/pole/gain model, use this command.
sys_zpk = zpk ([], [- 9.996 -4.004], 1.5)
This command returns the following zero/pole/gain representation.
Zero/pole/gain: 1.5 ------------------- (s+9.996) (s+4.004)
The Control System Toolbox software provides full support for discrete-time systems. You can create discrete systems in the same way that you create analog systems; the only difference is that you must specify a sample time period for any model you build. For example,
sys_disc = tf(1, [1 1], .01);
creates a SISO model in the transfer function format.
Transfer function: 1 ----- with +1 Sample time: 0.01
You can add time delays to discrete-time models by specifying an input delay, output delay, or I/O delay when building the model. The time delay must be a nonnegative integer that represents a multiple of the sample time. For example,
sys_delay = tf(1, [1 1], 0.01,'ioDelay',5)
returns a system with an I/O delay of 5 s.
Transfer function: 1 z ^ (- 5) * ----- with +1 Sample time: 0.01
You can add time delays to linear models by specifying an input delay, output delay, or I/O delay when building a model. For example, to add an I/O delay to the DC motor, use this code.
sys_tfdelay = tf(1.5,[1 14 40.02],'ioDelay',0.05)
This command constructs the DC motor transfer function, but adds a 0.05 second delay.
Transfer function: 1.5 exp(-0.05*s) * ------------------ s^2 + 14 s + 40.02
For more information about adding time delays to models, see Time Delays in Linear Systems.
For convenience, the Control System Toolbox software uses custom data structures called LTI objects to store model-related data. For example, the variable sys_dc
created for the DC motor example is called an SS object. There are also TF, ZPK, and FRD objects for transfer function, zero/pole/gain, and frequency data response models respectively. The four LTI objects encapsulate the model data and enable you to manipulate linear systems as single entities rather than as collections of vectors or matrices.
To see what LTI objects contain, use the get
command. This code describes the contents of sys_dc
from the DC motor example.
get(sys_dc) A: [2×2 double] B: [2×1 double] C: [0 1] D: 0 E: [] Scaled: 0 StateName: {2×1 cell} StateUnit: {2×1 cell} InternalDelay: [0×1 double] InputDelay: 0 OutputDelay: 0 Ts: 0 TimeUnit: 'seconds' InputName: {''} InputUnit: {''} InputGroup: [1×1 struct] OutputName: {''} OutputUnit: {''} OutputGroup: [1×1 struct] Notes: [0×1 string] UserData: [] Name: '' SamplingGrid: [1×1 struct]
You can manipulate the data contained in LTI objects using the set
command; see the Control System Toolbox online reference pages for descriptions of set
and get
.
Another convenient way to set or retrieve LTI model properties is to access them directly using dot notation. For example, if you want to access the value of the A
matrix, instead of using get
, you can type
sys_dc.A
at the MATLAB® prompt. This notation returns the A
matrix.
years = -4.0000 -0.0300 0.7500 -10.0000
Similarly, if you want to change the values of the A
matrix, you can do so directly, as this code shows.
A_new = [-4.5 -0.05; 0.8 -12.0]; sys_dc.A = A_new;
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.
Desktop Basics - MATLAB & Simulink
Array Indexing - MATLAB & Simulink
Workspace Variables - MATLAB & Simulink
Text and Characters - MATLAB & Simulink
Calling Functions - MATLAB & Simulink
2-D and 3-D Plots - MATLAB & Simulink
Programming and Scripts - MATLAB & Simulink
Help and Documentation - MATLAB & Simulink
Creating, Concatenating, and Expanding Matrices - MATLAB & Simulink
Removing Rows or Columns from a Matrix
Reshaping and Rearranging Arrays
Add Title and Axis Labels to Chart
Change Color Scheme Using a Colormap
How Surface Plot Data Relates to a Colormap
How Image Data Relates to a Colormap
Time-Domain Response Data and Plots
Time-Domain Responses of Discrete-Time Model
Time-Domain Responses of MIMO Model
Time-Domain Responses of Multiple Models
Introduction: PID Controller Design
Introduction: Root Locus Controller Design
Introduction: Frequency Domain Methods for Controller Design
DC Motor Speed: PID Controller Design
DC Motor Position: PID Controller Design
Cruise Control: PID Controller Design
Suspension: Root Locus Controller Design
Aircraft Pitch: Root Locus Controller Design
Inverted Pendulum: Root Locus Controller Design
Get Started with Deep Network Designer
Create Simple Image Classification Network Using Deep Network Designer
Build Networks with Deep Network Designer
Classify Image Using GoogLeNet
Classify Webcam Images Using Deep Learning
Transfer Learning with Deep Network Designer
Train Deep Learning Network to Classify New Images
Deep Learning Processor Customization and IP Generation
Prototype Deep Learning Networks on FPGA
Deep Learning Processor Architecture
Deep Learning INT8 Quantization
Quantization of Deep Neural Networks
Custom Processor Configuration Workflow
Estimate Performance of Deep Learning Network by Using Custom Processor Configuration
Preprocess Images for Deep Learning
Preprocess Volumes for Deep Learning
Transfer Learning Using AlexNet
Time Series Forecasting Using Deep Learning
Create Simple Sequence Classification Network Using Deep Network Designer
Classify Image Using Pretrained Network
Train Classification Models in Classification Learner App
Train Regression Models in Regression Learner App
Explore the Random Number Generation UI
Logistic regression create generalized linear regression model - MATLAB fitglm 2
Support Vector Machines for Binary Classification
Support Vector Machines for Binary Classification 2
Support Vector Machines for Binary Classification 3
Support Vector Machines for Binary Classification 4
Support Vector Machines for Binary Classification 5
Assess Neural Network Classifier Performance
Discriminant Analysis Classification
Train Generalized Additive Model for Binary Classification
Train Generalized Additive Model for Binary Classification 2
Classification Using Nearest Neighbors
Classification Using Nearest Neighbors 2
Classification Using Nearest Neighbors 3
Classification Using Nearest Neighbors 4
Classification Using Nearest Neighbors 5
Gaussian Process Regression Models
Gaussian Process Regression Models 2
Understanding Support Vector Machine Regression
Extract Voices from Music Signal
Align Signals with Different Start Times
Find a Signal in a Measurement
Extract Features of a Clock Signal
Filtering Data With Signal Processing Toolbox Software
Find Periodicity Using Frequency Analysis
Find and Track Ridges Using Reassigned Spectrogram
Classify ECG Signals Using Long Short-Term Memory Networks
Waveform Segmentation Using Deep Learning
Label Signal Attributes, Regions of Interest, and Points
Introduction to Streaming Signal Processing in MATLAB
Filter Frames of a Noisy Sine Wave Signal in MATLAB
Filter Frames of a Noisy Sine Wave Signal in Simulink
Lowpass Filter Design in MATLAB
Tunable Lowpass Filtering of Noisy Input in Simulink
Signal Processing Acceleration Through Code Generation
Signal Visualization and Measurements in MATLAB
Estimate the Power Spectrum in MATLAB
Design of Decimators and Interpolators
Multirate Filtering in MATLAB and Simulink