Beruflich Dokumente
Kultur Dokumente
Simulink
JJ II
Mohamed Taha J I
←- ,→
Communication Engineering Department
Full Screen
Princess Sumaya University
mtaha@psut.edu.jo Search
Close
MATLAB
Workshop
Simulink
1 Simulink
• Matlab offers another important tool for mod-
elling and simulation Title Page
Simulink
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
– Simulink can be started by writing simulink at the
command prompt
Title Page
Simulink
Page 3 of 15
JJ II
J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
– Simulink contains several libraries
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
Using Simulink
– To start new model
Title Page
Simulink
Page 5 of 15
JJ II
– Blocks can be dragged and dropped from the library
browser to the new model J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
Example:
Consider the following system
Title Page
Simulink
Page 6 of 15
– Modeling the system
JJ II
dv(t) J I
f (t) = M + Bv(t)
dt
←- ,→
– Draw the signal flow graph for the system
Full Screen
Search
Close
MATLAB
Workshop
Simulink
In simulink
• 1
and B
are gain blocks JJ II
M M
MATLAB
Workshop
Simulink
Configuring the system parameters
• Double click on the gain blocks, set the gain prop-
1 B
erty to M and M Title Page
Simulink
• Double click on the sum, change the signs to +−
Page 8 of 15
• Double click on the step, change the Step time
property to 0 JJ II
J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
– The system in simulink will look like
Title Page
Simulink
Page 9 of 15
JJ II
J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
Configuring solver parameters
• on the main toolbar of your model, se-
lect simulation → configuration Title Page
parameters Simulink
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
Running simulation
• the variables B and M must be defined, either in
the blocks directly or at the command prompt Title Page
Simulink
• set M = 10 and B = 3.
Page 11 of 15
• from the simulink → sinks select scope. Con-
nect the scope to the output v(t) JJ II
• simulation → start J I
Search
Close
MATLAB
Workshop
Simulink
Export the result into Matlab workspace
– double click on the scope, open the scope parameters
– set the parameters to Title Page
Simulink
format: Array JJ II
J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
– at the matlab command prompt
plot(ScopeData(:,1),ScopeData(:,2))
– the resulting graph
Title Page
Simulink
Page 13 of 15
JJ II
J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink
Displaying multiple signals on the same
scope
– can be done using a MUX Title Page
Simulink
– from the library browser goto signal
routing and select MUX Page 14 of 15
Search
Close
MATLAB
Workshop
Simulink
– let us display the input and output of the previous model
on the same scope
– set number of inputs to 2
Title Page
– connect the input and output to the mux terminals and Simulink
run the simulation
Page 15 of 15
JJ II
J I
←- ,→
Full Screen
Search
Close
MATLAB
Workshop
Simulink