Lab # 3
Modeling in Simulink Using Some Basic Examples
Objective:
1. Introduction to Simulink
2. Learn the basics of modeling of different systems in Simulink.
1. Introduction to Simulink
SIMULINK is a program for simulating dynamic systems. As an extension to MATLAB,
SIMULINK adds many features specific to dynamic systems while retaining all
MATLAB’s general-purpose functionality. SIMULINK has two phases of use: model
definition and model analysis. A typical session starts by either defining a model or retrieving
a previously defined model, and then proceeds to analysis of that model. These two steps are
often performed iteratively until the model achieves the desired behavior. To facilitate model
definition, SIMULINK adds a new class of windows called block diagram windows. In these
windows, models are created and edited principally by mouse driven commands. Part of
mastering SIMULINK is to become familiar with the manipulation of model components
within these windows. After you define a model, you can analyze it either by choosing
options from the SIMULINK menus or by entering commands in MATLAB’s command
window.
Modeling different systems in Simulink involves representing real-world systems or processes
using mathematical equations or block diagram. MATLAB is a powerful software tool for
numerical computation and modeling, making it useful for various applications, including
control systems, signal processing, image processing, and more. Here are the basics of modeling
different systems in Simulink:
Basic of Simulink:
At the MATLAB prompt type >>Simulink. This command displays a new window
containing icons for the subsystem blocks that make up the standard library. These
subsystems can be opened (by double-clicking) to produce the windows containing the
prototype blocks to be copied into your models. Click on File and New, and then move the
window to a comfortable position.
Figure .1-- shows the basics of Simulink blocks.
Open Sources, Sinks, Continuous, and Connections by double-clicking on the icon with the
left mouse button. Move the windows to a comfortable position. Blocks can be copied from
one window to another by dragging them from the original location to the new location by
holding down the left mouse button. Assemble the following diagram in your working
window. [e.g. Step Input -> Sources; Sum ->Math operations, Transfer Fcn -> Continuous;
Scope -> Sinks]
Figure 2—Different Simulink Blocks
Location of Different Important Blocks:
• Simulink > Continuous > Integrator.
• Simulink > Continuous > Transfer Function.
• Simulink > Continuous > Differentiator.
• Simulink > Math Operations > Absolute.
• Simulink > Math Operations > Gain.
• Simulink > Math Operations > Slider Gain.
• Simulink > Math Operations > Sum.
• Simulink > Signal Routing > Demultiplexer.
• Simulink > Signal Routing > Multiplexer.
• Simulink > Sinks > Display.
• Simulink > Sinks > Scope.
• Simulink > Sources > Clock.
• Simulink > Sources > Pulse Generator.
• Simulink > Sources > Ramp.
• Simulink > Sources > Signal Generator.
• Simulink > Sources > Signal Builder.
• Simulink > Sources > Sine Wave.
• Simulink > Sources > Step Signal.
Lab Task 1:
Q: Investigate the open loop step response of the integrator.
Figure 3—Implementation of Open loop Integrator in Simulink
Step 1: Open Simulink by typing Simulink on MATLAB command window
Step 2: A new window will appear, select the option to create new model.
Step 3: Select the integrator, gain, step and scope blocks.
• Simulink > Continuous > Integrator.
• Simulink > Math Operations > Gain.
• Simulink > Sources > Step Signal.
• Simulink > Sinks > Scope.
Step 4: Now connect these blocks as shown in Figure 3.
Step 5: Press play button.
Step 6: Now click on scope block to visualize the graph. You can get the response as shown
in the figure below.
Figure 4—Output of Step Response of Integrator on Scope
Step 7: Now plot your graph below and compare it with Figure 4
Figure 5—Step Response of the open loop Integrator
Compare Figure 4 and Figure 5.
Lab Task 2:
Q: Investigate the closed loop step response of the integrator.
• Repeat the same steps as described above for the following figure.
Figure 6–Close loop Integrator with Negative feedback in Simulink
You can get the step response as shown in the Figure 7.
Figure 7 –Output of Close loop Integrator on Scope
Now plot your graph below.
Figure 8 — Step Response of the closed loop Integrator
Q: Compare Figure 7 and Figure 8.
Lab Task 3:
Modeling of the RC Circuit in Frequency domain
Figure 2: RC Series Circuit
Where,
Vin is the input voltage applied
Vout is the output voltage.
R=1ohm C=1 Farad
Step 1: Find the transfer function Vout /Vin.
Step 2: Draw Simulink Blocks for the RC Series Circuit,
Step 3: Find unit step response of the transfer function. The graph will be display as shown
below
Figure.3, shows step response for the RC Series Circuit.
Lab Task 4:
Modeling of a Mechanical System in Simulink
Cruise Control Model:
Following is the equation of motion for an automobile.
v'+(b/m)v=u/m
Using this differential equation, we can find the transfer function of this cruise control.
Now implement the transfer function in MATLAB and analyze its output. Use the values of
m = 1580 kg , b = 26 N*sec/m period of time. Its output will be quite like a car whose
driver accelerates it for instance and then leaves the car to decelerate at its own speed.
Figure.4, shows Cruise Control Model
Step 1. Find the relation between the input force (u) and the output velocity (v) using Laplace
Transformation
Step 2. Simulate the system in Simulink for the Unit Step Input, and draw their block diagram
Step 3: Take step of the transfer function. The graph will be display as shown below
Figure.5, shows step response for the Cruise Control Model
Lab Exercise and Summary
Summary should cover Introduction, Procedure, Data Analysis and Evaluation.
LABORATORY SKILLS ASSESSMENT (Psychomotor)
Total Marks: 100
Criteria Level 1 Level 2 Level 3 Level 4 Score
(Max Marks) 0% ≤ S < 50% 50% ≤ S< 70% 70% ≤ S< 90% 90%≤ S ≤100% (S)
Selects inappropriate Selects and applies Selects and applies Selects and applies
Procedural skills and/or partially appropriate the considerably the completely
Awareness strategies to write skills and/or appropriate strategies appropriate strategies
(20) and compile the strategies required by and/or skills specific and/or skills specific
programs. the programs. to the programs. to the programs.
Makes major critical Makes numerous Makes minor non- Applies the
errors in applying critical errors in critical errors in procedural
Practical
procedural applying procedural applying procedural knowledge in
Implementation
knowledge related to knowledge related to knowledge related to optimized ways
(20)
Mathematical Mathematical Mathematical related to Mathematical
Modeling. Modeling. Modeling. Modeling.
Program logic has Program logic has Program logic is Program logic is
many errors with some errors with mostly correct, but correct, with no
majority of several contradictory may contain known errors, and no
Program Logic
contradictory conditions. occasional errors or redundant or
(20)
conditions. redundant/ contradictory
contradictory conditions.
conditions.
Program does not Program partially Program adequately Program completely
follow proper syntax follows the proper follows the proper follows proper syntax
Syntax of Simulink syntax of Simulink syntax of Simulink of Simulink
Correctness and modeling and does modeling and modeling and modeling and
Results not produce desired produces appropriate produces appropriate produces appropriate
(20) results for most results for few inputs. results for most results for all inputs
inputs. . inputs. tested.
Uses software tool, Uses software tool, Uses software tool, Uses software tool,
Use of Software
with limited with some with considerable with a high degree of
Tool
competence. competence. competence. competence.
(10)
Requires Requires some Follows safety Routinely follows
Safety Constant reminders reminders to follow procedures with only safety procedures.
(10) to follow safety safety procedures. minimal reminders.
procedures.
Marks Obtained
Instructor’s Signature: ___________________ Date: ___________________
LABORATORY SKILLS ASSESSMENT (Affective)
Total Marks: 40
Criteria Level 1 Level 2 Level 3 Level 4
Score
(Max. Marks) 0% ≤ S < 50% 50% ≤ S < 70% 70% ≤ S < 90% 90% ≤ S ≤ 100%
Introduction Very little Introduction is brief Introduction is nearly Introduction complete
(5) background with some minor complete, missing and well-written;
information mistakes. some minor points. provides all necessary
provided or background principles
information is for the experiment.
incorrect.
Procedure Many stages of the Many stages of the The procedure could The procedure is well
(5) procedure are not procedure are be more efficiently designed and all stages
entered on the lab entered on the lab designed but most of the procedure are
report. report. stages of the entered on the lab
procedure are entered report.
on the lab report.
Data Record Data is brief and Data provides some Data is almost Data is complete and
(10) missing significant significant complete but has some relevant. Tables with
pieces of information and has minor mistakes. units are provided.
information. few critical mistakes. Graphs are labeled.
All questions are
answered correctly.
Data Analysis Data is presented Data is presented in Data is presented in Data is presented in
(10) in very unclear ways that are not ways that can be ways that best facilitate
manner. clear enough. understood and understanding and
interpreted. interpretation.
Report Quality Report contains Report is somewhat Report is well Report is well
(10) many errors. organized with some organized and organized and cohesive
spelling or cohesive but contains and contains no
grammatical errors. some grammatical grammatical errors.
errors. Presentation seems
polished.
Marks Obtained
LABORATORY SKILLS ASSESSMENT (Cognitive)
Total Marks: 10
(If any)
Marks Obtained
Instructor’s Signature: ___________________ Date: ___________________