Professional Documents
Culture Documents
To MatLAB &
Simulink
Basic MatLAB Commands
MatLAB Syntax:
Do Not Display Results: Comma
after command
⎡1 2⎤
Matrix Creation: [1 2; 3 4] = ⎢3 4⎥
⎣ ⎦
Basic MatLAB Plotting
Plotting x and y: plot(x(),y())
Transfer Function
Tf([ Numerator Coefficients],[ Denominator Coefficients])
i.e. sys = tf([1],[1 3 2]);
1
sys = 2
s + 3s + 2
Basic MatLAB Commands
Conversions
Transfer Function To State Space [A,B,C,D] = tf2ss([Num],[Den]);
⎡ 0 1 ⎤ ⎡0⎤
k
x
[x& ] = ⎢ ⎥ [x] + ⎢ ⎥ F
⎣− 2 / 1 − 4 / 1⎦ ⎣1 / 1⎦
y = [1 0][x ] + 0 F
M F
b
Basic MatLAB Plots – Bode Diagrams
A graphical way
of representing
systems through
a magnitude and
phase plot. Using
the frequency domain
these plots can be
obtained. These
can be used in:
Control Systems
Dynamics
Electronics
A diagram of
the poles and
zeros of a system,
using a real and
imaginary axes.
rlocus(sys) or
rlocus(tf([Num],[Den]))
Basic MatLAB Plots – Nyquist
Diagram
This allows the
prediction of
stability and
Performance
using the systems
open loop form.
nyquist(sys) or
nyquist(tf([Num],[Den]))
Introduction To Simulink
Simulink is a graphical representation of
systems, differential equations, or problems
encountered in engineering fields. Blocks
can be assembled to reproduce almost
anything as long as it can be modeled
mathematically. Simulink has become an
important part of aeronautical, astronautical,
computer, electrical, and mechanical
engineering programs and industries.
Simulink: Computer Integrated
Simulink can be used to control systems
with the correct hardware and software.
Texas Instruments and other electronic
equipment manufacturers creates circuit
boards for integration with a PC running
Simulink. Output can be directly saved to
a computer and analyzed to improve the
model or write the report, more efficiently
than in the past.
Simulink Toolboxes
These are
the most
commonly
used blocks
for Electrical
Engineers.
Simulink: Creation Of A Model
1. A mathematical model has to be finished or a
prior simulation had to been performed.
2. Create the block diagram by opening a new
model sheet and grabbing and dropping the
blocks onto the model sheet.
3. Arrange blocks in the order that the model
shows and connect them by dragging the
arrow coming out of the block to the next block
or clicking on both blocks while holding down
‘control’.
4. Make sure the model is correct before running
the simulation. Then run the simulation.
Simulink: Creation Of A Model
Simulink: Model Parameters
Changing
the
simulation
parameters
will help or
hurt your
model
depending
on what is
changed.
Simulink: Output Of The Model
There are
several
ways to use
or view the
data
received
from the
model.
Simulink: Example 1 & 2
Simulink: Example 3
Simulink: Lab 2 Diagram
Simulink: Moderate to Advanced
Models