EE 407 Homework 1 Introduction to Simulink solution




5/5 - (5 votes)

1 Introduction
The objective of this homework is to get you acquainted with Simulink which is one of the
essential software tools that will be extensively used within this course.
Simulink is a block diagram environment for multidomain simulation and Model-Based
Design. It supports simulation, automatic code generation, and continuous test and verification
of embedded systems. Simulink provides a graphical editor, customizable block libraries, and
solvers for modeling and simulating dynamic systems. It is integrated with MATLAB, enabling
you to incorporate MATLAB algorithms into models and export simulation results to MATLAB
for further analysis, [1].
You are asked to use a MATLAB version that is not older than 2016a since this will provide
some desired properties for flawless integration of other software components with Simulink in
upcoming weeks.
If you are not quite familiar with Simulink, it will be very beneficial for you to
take a look at the following sources before attacking to this homework.
• A 2-minute getting started video,
• Step by step introduction to Simulink (estimated study time: 1.5 hour).
2 Questions
In implementing the steps of the homework, you are expected to submit two separate Simulink
models (with .slx extension) along with a report as a .pdf file. Bundle these files together and
compress (as .zip) with the following name format: EE407 eXXXXXX HW1. Also note that you
will submit your files via ODTUClass.
1. Mass Spring Damper System Simulation You are all familiar with Mass Spring
Damper (MSD) system depicted in Fig. 1, [2]. In a nutshell, the spring force is proportional
to the displacement of the mass, x, and the viscous damping force is proportional to the
velocity of the mass, v = x˙. Note also that x = 0 corresponds to the position of the mass
when the spring is not stretched, and positive x direction, (−→), is indicated on the figure.
Figure 1
(a) Firstly, you are to write down the state-space model of the system when the state
vector is determined to comprise of position and velocity, x =
x x˙
, the input is
applied force, F, and the output is position, y =
1 0 i
(b) Open a new Simulink model. Build a model of the MSD system by utilizing the built-in
State-Space block available in Simulink Library. The input of the block is to represent
applied force, F and the output is to be position of the mass.
(c) For the following subitems you will simulate the model when the applied force is a
unit step function starting at t = 5 sec, i.e., u(t − 5). At each step, only a single
parameter will be varied and corresponding system responses will be observed. Then,
these responses will be investigated comparatively. You are to determine the duration
of each simulation regarding to make sure that all ’interesting’ observations will have
been made at the end of this period. In your report, include a plot exhibiting
two system responses for each step. Important: All plots should have a title,
labeled axes (with units), and reasonable axis limits.
i. Simulate the model for (m = 1kg, b = 0.2Ns/m, k = 1N/m) and (m =
1kg, b = 0.2Ns/m, k = 0.2N/m) parameter sets. Compare two output signals
and command on the relation between spring constant and motion of the mass.
ii. Simulate the model for (m = 1kg, b = 0.2Ns/m, k = 1N/m) and (m = 10kg, b =
0.2Ns/m, k = 1N/m) parameter sets. Compare two output signals and command
on the relation between m and motion of the mass.
iii. Simulate the model for (m = 1kg, b = 0.2Ns/m, k = 1N/m) and (m = 1kg, b =
2Ns/m, k = 1N/m) parameter sets. Compare two output signals and command
on the relation between viscous damping coefficient and motion of the mass.
(d) Set the parameters as (m = 1kg, b = 0.2Ns/m, k = 1N/m). Run the simulation
for an input force whose value is equal to 1N in t = [0, 20) and 0N elsewhere. To
build such an input signal you are allowed to employ only Clock and Switch blocks.
Your model should look similar to the one illustrated in Fig. 2. Insert the plot
demonstrating the output signal into your report. You are asked to submit
this final version of the Simulink model for Question 1.
Figure 2
(e) In this step you are to evaluate time resolution of the output signals observed in d.
Observe time differences between successive data points, δt, in the output signal. Does
δt change during simulation? If Yes, what might be the reason for Simulink to simulate
the model in such a fashion? What might be possible advantages/ disadvantages of
this technique?
(f) Open Model Configuration Parameters of the model. Under Solver tab, choose Fixed
Step option and set sampling time as 0.01 sec. Run the simulation again. Comment
on the effect of change in the solver.
2. Propeller Levitated Arm Simulation
In this section, you are going to simulate a Propeller Levitated Arm (PLA). The system is
illustrated in Fig. 3.
Figure 3
The differential equation describing the dynamic behavior of the system is as given:
mL2 ¨θ = −c
˙θ − mgLsin(θ) + u (1)
where θ is angular position of the arm, m is the total mass of the propeller and DC motor,
L is length of the arm, c is viscous damping coefficient, g is gravitational acceleration and
u is thrust produced by the propeller. (Note that the arm is assumed to be massless.)
(a) Open a new Simulink model. Create a subsystem, [3], whose input is thrust force and
output is angular position. Do NOT linearize the dynamics of the system given in (1).
Submit this model for Question 2.
Hint: A partially constructed model of the PLA where some blocks are
not shown is demonstrated in Fig. 4.
(b) What do X, Y and Z signals in Fig. 4 stand for in the real system?
Figure 4
(c) Is this model valid for all values of the state vector? Or is there a range of θ for the
model to be consistent with real dynamics of the system?
(d) Set m = 1 kg, L = 2 m, g = 9.81 m/s2
, c = 0.5 kgm2/s, then run two separate
simulations one for an input force of 14Nm and the other for 15Nm. Record the
angular position of the arm in degrees and put them into your report. Why
is a slight difference in the thrust resulted in such a drastic change in the response of
the system?
[1] “Simulink Home Page,”, accessed: 2018-
[2] “Lecture notes in ee302,” 2018.
[3] “Simulink – How to Create a Subsystem,”
creating-subsystems.html#f4-7371, accessed: 2018-10-15.