Exp 2-Student Manual
Exp 2-Student Manual
Introduction:
SIMULINK is a software package developed by MathWorks Inc. which is one of the most
widely used software in academia and industry for modeling and simulating dynamical
systems. It can be used for modeling linear and nonlinear systems, either in continuous time
frame or sampled time frame or even a hybrid of the two. It provides a very easy drag-drop
type Graphical user interface to build the models in block diagram form. It has many built-in
block-libraries components that you can use to model complex systems. If these built-in
models are not enough for you, SIMULINK allows you to have user defined blocks as well.
You can start SIMULINK by simply clicking the simulink icon in the tools bar or by typing Simulink
in front of the MATLAB command prompt >>. This opens up SIMULINK’s library browser, which
should look similar to the one shown in Fig.1. There may be other tool boxes depending upon the license
you have, The plus sign that you see in the right half of the window indicates that there are more blocks
available under the icon clicking on the (+) sign will expand the library. Now for building up a new
model click on. File and select New Model. A blank model window is opened. Now all you have to do
is to select the block in the SIMULINK library browser and drop it on your model window. Then
connect them together and run the simulation.
Experimental Procedure:
Let us try to simulate a simple model where we take a sinusoidal input, integrate it and observe
the output. The steps are outlined as below.
2. You are able to see various sources that SIMULINK provides. Scroll down and you will see a Sine
Wave sources icon.
3. Click on this sources icon and without releasing the mouse button drag and drop it in your model
window which is currently named as 'untitled'.
4. If you double-click on this source, you will be able to see Block parameters for sine wave which
includes amplitude, frequency, phase, etc. Let not change these parameters right now. So click on
cancel to go back. Similarly click on continuous library icon. You can now see various built-in blocks
such as derivative, integrator, transfer-function, state-space etc. Select integrator block and drag-drop
it in your model window.Now click on sinks and drag-drop scope block into your model. This is one
of the most common blocks used for displaying the values of the
blocks.
7. Now join output of sine-wave source to input of Integrator block. This can ' be done in two ways.
Either you click the left button and drag mouse from output of sine-wave source to input of Integrator
block and leave left button or otherwise click on right button and drag the mouse to form connection
from input of integrator block to output of sine,wave source.
8. Now in the main menu, click on Simulation and click Start. The simulation runs and stops after
the time specified by giving ready prompt at bottom left corner.
9. Now double-click on scope to see the output. Is something wrong? The result is a sine wave of
magnitude 2. Is there something wrong with SIMULINK software?
No, we have in fact forgotten to specify the integration constant!
Integration of sin θ is - cos θ + C. At θ =0, C = - 1. If we do not specify any initial condition for
output of the integrator, simulink assumes it to be 0 and calculates the constant. So it calculates
- cos θ + C = 0 at r = 0 giving C = 1. So the equation for output becomes - cos θ + l. Thus naturally,
it starts from 0 at t = 0 and reaches its peak value of 2 at θ = π, i.e. 3.I4.
10. To rectify this error. double click on Integrator block and in the initial conditions enter - 1 which
should be the output of the block at t = 0. Now run the simulation again and see for yourself that
the result is correct.
11. Now following the steps from 1-10, generate the following functions using Simulink and sketch the
output-
(4∗5)+7
1. A=
4
2. B=3Sinx+4cos(x)
𝐶𝑜𝑠(𝑥)
1−
2
3. C=
𝑠𝑖𝑛𝑥
1
5. X= (2×5)+10
Reference(s):
[1] Kothari, D P, and I J Nagrath. Modern Power System Analysis. 3rd ed. New Delhi: Tata
McGraw-Hill, 2009. Print.
[2] AIUB lab manual.