You are on page 1of 12

Bansilal Ramnath Agarwal Charitable Trust’s

VISHWAKARMA INSTITUTE OF TECHNOLOGY, PUNE –411037


(An Autonomous Institute under University of Pune)

Name:- Ayush Yadav Roll no:- 55 PrnNo:- 12011162


Class:- Ty Mech D

Experiment 1 - Simulink Exercises

Problem 1) Design a sine wave generator using Simulink with a constant gain.
Use the slider gain instead of the constant gain.

Procedure:
First create a blank model of Simulink in Matlab software. Add different types of
blocks needed for the solution from library browser such as sine wave, slider gain and
scope block for displaying the result.

Input:

Fig. No.1: Block Diagram of sine wave generator

Description:
Here, we have to design a sine wave generator by using slider gain. The Gain block
multiplies the input by a constant value (gain). The Slider Gain block performs a
scalar gain that we can modify during simulation. Modify the gain using
the slider parameter. For given problem statement, amplitude of sine wave is taken as
4 and other parameters are set as default. Input for Slider Gain is set as 2 and thus, we
got the results.

Output:
Fig. No.2: Output of sine wave generator

Conclusion:
We are able to generate a sine wave with the help of sine wave generator block and
the output is displayed with the help of scope block.

Problem 2) Evaluate an expression 2+5e5 in Simulink and display the result.


Procedure :
First create a blank model of Simulink in Matlab software. Add different types of
blocks needed for the solution from library browser such as constant, Math Function,
Product, Sum and Display for displaying the result.

Input:

Fig. No.3: Block Diagram for given expression

Description:
Here, constant block is used to generate constant value signals. By using Sum and
product blocks it is easy to evaluate the result for expression 2+5e5. The evaluation of
expression is done using BODMAS rule.

Output:
Fig. No.4: Evaluation result of given expression

Conclusion:
The expression 2+5e5 is evaluated and the obtained answer is 744.1. Similarly, we
can estimate different expressions with the help of Simulink.

Problem 3) Convert a temperature from Celsius to Farenheit using Simulink.

Procedure:
First create a blank model of Simulink in Matlab software. Add different types of
blocks needed for the solution from library browser such as Ramp, Gain, Constant,
Add and Scope for displaying the result.

Input:

Fig. No.5: Block Diagram to convert Celsius to Farenheit

Description:
Here, Ramp block generates a signal that starts at a specified time and value and
changes by a specified rate. Formula to convert Celsius to Farenheit is (1°C × 9/5) +
32 = 33.8°F. This expression is used to evaluate the result.

Output:
Fig. No.6: Output of Celsius to Farenheit conversion

Conclusion:
From the obtained graph we can say that the formula used to convert Celsius to
Farenheit (1°C × 9/5) + 32 = 33.8°F holds true and the solution is obtained.

Problem 4) Differentiate/ Integrate Sine wave and display results along the sine
wave.

Procedure:
First create a blank model of Simulink in Matlab software. Add different types of
blocks needed for the solution from library browser such as Sine wave, derivative,
integrator, Mux and Scope for displaying the result.

Input:

Fig. No.7: Block Diagram to derive and integrate sine wave

Description:
A Sine wave block generates sine wave. It is split and connected to Derivative block
and Integrate block. They both are connected to mux which is in turn connected to
Scope which displays output.

Output:
Fig. No.8: Output of derivation and integration of sine wave

Conclusion:
Scope gives three waves (Black, Red, Blue). It is possible to derive and integrate sine
wave with the help of Simulink blocks.

Problem 5)
Generate a Sine wave. Pass the signal with a constant gain of 5. Apply a
saturation of ±3 and show the display before and after saturation.

Procedure:
First create a blank model of Simulink in Matlab software. Add different types of
blocks needed for the solution from library browser such as Sine wave, Gain,
Saturation, Mux and Scope for displaying the result.

Input:

Fig. No.9: Block Diagram of generation of sine wave

Description:
A sine wave block is used which generated sine wave. It is connected to gain block
having gain parameter of 5. It amplifies sine wave to amplitude of 5. It is then
connected to one terminal of mux. The second link from after gain block is connected
to saturation block having saturation value of 3. It is then connected to second
terminal of mux. Mux is connected to Scope which displays the output.

Output:
Fig. No.10: Output of sine wave generation

Conclusion:
Scope gives 2 sine waves. One of them has clipped peak(saturated) at amplitude of 3.

Problem 6) Build a Simulink model that implements Logical operations (AND /


OR / XOR / NAND / NOR / NOT)

Procedure:
i) Goto SOURCES in Simulink and drag the ‘Pulse Generator’ block. Make a
copy of the block. In the first pulse generator block double click and set an amplitude
of 1 and period 2 secs while in the second pulse generator block double click and set
amplitude of 1 and period 4 secs.
ii) Goto MATH OPERATIONS in Simulink to drag the ‘Logical Operator’
block. Double click on the block and select the logical operator (say, AND) to be
tested and the number of input ports(say,2)
iii) Goto SINK for the Scope block. Make 2 copies of the ‘Scope’ block. Join
blocks as shown in figure 6.
iv) Set Stop Time of 10 secs in Simulation Parameter, Save the model and Start
simulation. When simulation is complete, Double click on the ‘Scopes’ for display.

Scope 1:
Scope 2:

For AND Input:

Fig. No.11: Block Diagram of AND Operator

For AND Output:


Fig. No.12: Output of AND Operator

For OR Input:

Fig. No.13: Block Diagram of OR Operator

For OR Output:
Fig. No.14: Output of OR Operator

For NAND Input:

Fig. No.15: Block Diagram of NAND Operator

For NAND Output:

Fig. No.16: Output of NAND Operator

For NOR Input:

Fig. No.15: Block Diagram of NOR Operator

For NOR Output:


Fig. No.16: Output of NOR Operator

For XOR Input:

Fig. No.17: Block Diagram of XOR Operator

For XOR Output:


Fig. No.18: Output of XOR Operator

For NXOR Input:

Fig. No.19: Block Diagram of NXOR Operator

For NXOR Output:

Fig. No.17: Output of NXOR Operator

For NOT Input:

Fig. No.17: Block Diagram of NOT Operator

For NOT Output:


Fig. No.17: Output of NOT Operator

Description:
For all logical operators we have used two pulse inputs. Pulse blocks are connected to
two scopes and logical operator block (AND/OR/XOR/NAND/NOR/NOT). Both
input pulse blocks and output of logical operator block is connected to third Scope
which displays combined output.

Conclusion:
1. We can see that output of AND has amplitude of 1 at 4 sec and 8 sec. Hence
when both input signals are having high amplitude (i.e. 1) then only output of AND
gate is high.

2. We can see that output of OR gate has amplitude of 1 at every 2 sec intervals.
Its 0 when both input signals have 0 amplitude. Hence output of OR gate is high when
any of input signal is high.

3. We can see that output of XOR gate has amplitude of 1 when one input signal
has 1 amplitude and other has 0 amplitude. Its 0 when both input signals have 0 or 1
amplitude. Hence output of XOR gate is high when only one input signal is high.

4. We can see that output of NAND gate has amplitude of 0 when both signals
have amplitude of 1. For all other cases it gives high output. NAND gate output is
opposite if AND gate output.

5. NOT gate only takes one input i.e. pulse 1. When input signal has amplitude
of 1 it gives 0 amplitude and when input signal has 0 amplitude it gives amplitude of
1. Hence it gives opposite as that of input signal.

6. We can see that output of NOR gate has amplitude of 1 when both input
signals have either 0 amplitude or 1 amplitude. Hence NOR gate gives high output
when both input signals have same amplitude and 0 output when both signals have
different amplitudes.

You might also like