Modeling of Physical Systems Using Simulink.: Control System Lab 3
Modeling of Physical Systems Using Simulink.: Control System Lab 3
LAB 3
Modeling of Physical Systems using
SIMULINK.
List of Equipment/Software:
Following equipment/software is required:
• MATLAB/SIMULINK
Category Soft-Experiment
Overview:
This lab introduces powerful graphical user interface (GUI), Simulink of Matlab. This software is
used for solving the modeling equations and obtaining the response of a system to different inputs.
To provide an interface between a system’s modeling equations and the digital computer, block
diagrams drawn from the system’s differential equations are used. The operations that we generally
use in block diagrams are summation, gain, and integration. Other blocks, including nonlinear
elements such as multiplication, square root, exponential, logarithmic, and other functions, are
available. Provisions are also included for supplying input functions, using a signal generator
block, constants etc and for displaying results, using a scope block.
SIMULINK:
Simulink provides access to an extensive set of blocks that accomplish a wide range of functions
useful for the simulation and analysis of dynamic systems. The blocks are grouped into libraries,
by general classes of functions.
General Instructions for Writing a SIMULINK Program:
To create a simulation in Simulink, follow the steps:
• Start MATLAB.
• Start Simulink.
• Open the libraries that contain the blocks you will need. These usually will include the
Sources, Sinks, Math and Continuous libraries, and possibly others.
• Open a new Simulink window.
• Drag the needed blocks from their library folders to that window. The Math library, for
example, contains the Gain and Sum blocks.
• Arrange these blocks in an orderly way corresponding to the equations to be solved.
• Interconnect the blocks by dragging the cursor from the output of one block to the input of
another block. Interconnecting branches can be made by right-clicking on an existing
branch.
• Double-click on any block having parameters that must be established, and set these
parameters. For example, the gain of all Gain blocks must be set. The number and signs of
the inputs to a Sum block must be established. The parameters of any source blocks should
also be set in this way.
• It is necessary to specify a stop time for the solution. This is done by clicking on the
Simulation > Parameters entry on the Simulink toolbar.
At the Simulation > Parameters entry, several parameters can be selected in this dialog box, but
the default values of all of them should be adequate for almost all of the exercises. If the response
before time zero is needed, it can be obtained by setting the Start time to a negative value. It may
be necessary in some problems to reduce the maximum integration step size used by the numerical
algorithm. If the plots of the results of a simulation appear “choppy” or composed of straight-line
segments when they should be smooth, reducing the max step size permitted can solve this
problem.
Mass Spring System Model:
Consider the Mass-Spring system used in the previous exercise as shown in the figure. Where
Fs(x) is the spring force, Ff(x) is the friction coefficient, x(t) is the displacement and Fa(t) is the
applied force:
The differential equation for the above Mass-Spring system can then be written as follows:
Output:
Making Subplots in MATLAB:
Creating M-file
to make subplot.
Output:
Output:
Exercise 3: System response from the stored energy with zero input
Find the response of the above system when there is no input for t ≥0, but when the initial value
of the displacement x(0) is zero and the initial velocity v(0) is 1 m/s.
Output:
Or
Find the velocity response of the above system by constructing a Simulink block diagram and
calling the block diagram from Matlab m-file. Use M=750, B=30 and a constant force Fa = 300.
Plot the response of the system such that it runs for 125 seconds.
Creating M- Creating
file for M-file to
parameter make plot.
values.
Output:
Conclusion\Learning:
In this lab, we came to know how
• MATLAB\SIMULINK helps in solving the model of physical system like model of a
differential equation (second order) in MATLAB\SIMULINK.
• ‘sim’ command (for the purpose of complex plot in which several runs are needed with
different parameters) will run the SIMULINK model file from MATLAB command
prompt.
• The velocity response of the mass spring system can be plotted in MATLAB\SIMULINK.