0% found this document useful (0 votes)
69 views165 pages

SLNS Lab Manual Ver1.0 - Compressed

Uploaded by

albinsalu04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views165 pages

SLNS Lab Manual Ver1.0 - Compressed

Uploaded by

albinsalu04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 165

LAB

MANUAL
AS PER 2021 CURRICULUM

SIMULATION
SOFTWARE LAB USING
NUMERICAL
SOFTWARE
Diploma in Electronics Engg.
Diploma in Electronics & Comm. Engg.
Diploma in Biomedical Engg.

SEMESTER 6
Prepared by:
Sreeraj K. P.
Lecturer in Electronics Engg.
Dept. of Technical Education
6047 – Simulation Lab with Numerical Software Semester 6

Diploma in Electronics Engineering


Diploma in Electronics & Communication Engineering
Diploma in Biomedical Engineering

ALIGNED WITH 2021 SYLLABUS REVISION


Semester 6

6047– Simulation Lab with


Numerical Software

Prepared by:
Sreeraj K. P.,
Lecturer in Electronics Engineering
Dept. of Technical Education

SREERAJ K. P., LR. IN EC i


6047 – Simulation Lab with Numerical Software Semester 6

PROGRAM OUTCOMES

POs Statements
Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
PO1 science and engineering fundamentals and engineering
specialization to solve the engineering problems.
Problem analysis: Identify and analyse well-defined engineering problems
PO2
using codified standard methods.
Design/ development of solutions: Design solutions for well-defined
PO3 technical problems and assist with the design of systems components or processes to
meet specified needs.
Engineering Tools, Experimentation and Testing: Apply modern
PO4 engineering tools and appropriate technique to conduct standard tests and
measurements.
Engineering practices for society, sustainability and environment: Apply
PO5 appropriate technology in context of society, sustainability, environment and
ethical practices.
Project Management: Use engineering management principles individually, as a
PO6 team member or a leader to manage projects and effectively communicate about
well-defined engineering activities.
Life-long learning: Ability to analyse individual needs and engage in updating in
PO7
the context of technological changes.

SREERAJ K. P., LR. IN EC ii


6047 – Simulation Lab with Numerical Software Semester 6

COURSE OUTCOME MATRIX

Course outcomes:
CO1: Develop programs to perform basic matrix operations, solve equations and plot basic
signals.
CO2: Develop simulations to demonstrate basic electronic circuits and study their
characteristics.
CO3: Develop simulation models to illustrate analog and pulse modulation schemes.
CO4: Develop simulation models to implement various combinational logic circuits.
Sl.
Module outcome CO1 CO2 CO3 CO4
No.
Perform basic matrix operations – addition, subtraction,
1 multiplication, division and inverse. (Verify ֍
mathematically)
Solution of linear constant coefficient differential
2 ֍
equation. (Verify mathematically)
Determine eigen values and eigen vectors of a square
3 ֍
matrix. (Verify mathematically)
Determine roots of a polynomial. (Verify
4 ֍
mathematically)
Generation of various signals and sequences (Periodic
5 and Aperiodic), such as Step, Square, Saw tooth, ֍
Triangular, Sinusoidal, Ramp signal
6 Plot different types of plots 3D, surface plot, polar plot ֍
7 Plot input output characteristics of diode. ֍
8 Plot input output characteristics of npn transistor. ֍
9 Plot input output characteristics of MOSFET. ֍
Simulate single Phase Full Wave Diode Bridge Rectifier
10 ֍
with LC Filter
Solve node, mesh and loop equations of simple
11 ֍
electrical/network circuits
12 Simulate an R-L-C circuit to determine time response ֍

SREERAJ K. P., LR. IN EC iii


6047 – Simulation Lab with Numerical Software Semester 6

Plot amplitude modulated wave by giving carrier,


13 ֍
modulating signal and depth of modulation
Plot frequency modulated wave by giving carrier,
14 ֍
modulating signal and depth of modulation
15 Simulate PAM, PPM and PWM modulation schemes. ֍
16 Simulate Pulse Coded Modulation model ֍
Simulate AND, OR, NAND,NOR, XOR ,NOT Gates
17 ֍
using blocks
18 Develop a model of Full adder and full subtractor ֍
19 Develop a model of 3-bit multiplexer and demultiplexer ֍
Develop a model of D, T and JK Flipflop using NAND
20 ֍
gates

SREERAJ K. P., LR. IN EC iv


6047 – Simulation Lab with Numerical Software Semester 6

GENERAL INSTRUCTIONS
1. Rough record and Fair record are needed to record the experiments conducted in the
laboratory.
2. Rough records are needed to be certified immediately on completion of the
experiment.
3. Fair records are due at the beginning of the next lab period.
4. Fair records must be submitted as neat, legible, and complete.

INSTRUCTIONS FOR WRITING THE FAIR RECORD


In the fair record, the index page should be filled properly by writing the corresponding
experiment number, experiment name, date on which it was done and the page number. On
the right-side page of the record, the following has to be written:
1. Title: The title of the experiment should be written on the page in capital letters.
2. In the left top margin, experiment number and date should be written.
3. Practical significance/Aim: The purpose of the experiment should be written clearly.
4. Relevant course outcome: The outcome to be attained at the end of the experiment
has to be mentioned clearly.
5. Theory: Simple working of the circuit/experimental set up/algorithm should be
written.
6. Resources required: A list of the Apparatus/Tools/ Equipment/Components used for
doing the experiment should be entered.
7. Precautions to be followed: The detailed description of the precautions to be
followed while performing the experiments should be clearly mentioned.
8. Procedure: Steps for doing the experiment and recording the readings should be
briefly described.
9. Results: The results of the experiment must be summarized in writing and should be
fulfilling the aim.
10. Interpretation of the result: The interpretations obtained after performing the
experiments and viewing/calculating the observations should be listed.
11. Conclusion: The statement on the completion of the experiment should be mentioned.

On the left-side page of the record following has to be recorded:


1. Circuit: Neatly drawn circuit diagrams/experimental set up.
2. Program: The code for the implementation of the circuit and the test bench for testing
the working of the circuit has to be written.
3. Observations: Data should be clearly recorded using Tabular Columns.
4. Waveforms: Waveforms can be used to present the input and output in graphical
form.

SREERAJ K. P., LR. IN EC v


6047 – Simulation Lab with Numerical Software Semester 6

GENERAL GUIDELINES TO TEACHERS


The experiments are developed such that the major practical learning outcomes are achieved.
Each experiment is designed to achieve the course outcomes mentioned in the curriculum.
1. Teacher should provide the guideline with demonstration of experiment to the
students with all features.
2. Teacher shall explain prior concepts to the students before the starting of each
practical session.
3. Involve students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students.
5. Teacher should ensure that the respective skills and competencies are developed in the
students after the completion of the practical exercise.
6. Teacher should give opportunity to students for hands on experience after the
demonstration.
7. Teacher may provide additional knowledge and skills to the students even though not
covered in the manual but are expected from the students by the industry.
8. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions.
9. Teacher may suggest additional related literature of technical papers/reference books.
10. Finally give practical assignments and assess the performance of the students based
on task assigned to check whether it is as per the instructions.
11. Teacher is expected to refer complete curriculum document and follow guidelines for
implementation.
12. For difficult practical, if required, teacher could provide demonstration of the
practical emphasizing of skills which the student should achieve.
13. Assess the skill achievement of the students and COs after each unit.
14. The assessment should be performed on regular basis.
15. It is desirable to paste the photo of actual experimental setup or draw block diagram
of experimental setup.

SREERAJ K. P., LR. IN EC vi


6047 – Simulation Lab with Numerical Software Semester 6

GENERAL GUIDELINES TO STUDENTS


1. Listen carefully to all the information regarding curriculum, its course outcomes
and major learning outcomes, equipment and instruments in the laboratory and
the method of assessment.
2. Read the writeup of each experiment to be performed, a day advance.
3. For incidental writing on the day of each practical session every student should
maintain a dated log book for the whole semester, apart from this laboratory
manual which s/he has to submit for assessment to the teacher.
4. Be punctual for your laboratory sessions.
5. It is mandatory to come to lab in a formal dress and wear your ID cards.
6. Mobile phones should be switched off in the lab. Keep bags in the bag rack.
7. Sign in the log register as soon as you enter the lab and strictly observe your lab
timings.
8. Strictly follow the written and verbal instructions given by the teacher / Lab
Instructor. If you do not understand the instructions, the handouts and the
procedures, ask the instructor or teacher.
9. Never work alone! You should be accompanied by your laboratory partner and
/ or the instructors / teaching assistants all the time.
10. Organize the work in group and record all the observations.
11. Understand the practical implications of the experiments.
12. Student shall refer technical magazines, IS codes and data books.
13. Students should develop maintenance and troubleshooting skills.
14. Keep the labs clean at all times; no food and drinks allowed inside the lab.
15. Intentional misconduct will lead to expulsion from the lab.
16. Observation book and lab record should be carried to each lab. Readings of current lab
experiment are to be entered in observation book and previous lab experiment should be
written in lab record book. Both the books should be corrected by the faculty in each lab.

SREERAJ K. P., LR. IN EC vii


6047 – Simulation Lab with Numerical Software Semester 6

SAFETY INSTRUCTIONS
1. Do not wear loose-fitting clothing or jewelry in the lab. Rings and necklaces
areexcellent conductors of electricity.
2. Sandals or open-toed shoes are NOT allowed.
3. Do not handle any equipment without reading the safety instructions. Read
the handout and procedures in the lab manual before starting the experiments.
4. Setup the circuit and perform a careful circuit check before applying power.
Do not make circuit changes or perform any wiring when power is on.
5. Avoid contact with energized electrical circuits.
6. Do not insert connectors forcefully into the sockets.
7. NEVER try to experiment with the power from the wall plug.
8. Immediately report dangerous or exceptional conditions to the Lab instructor /
teacher: Equipment that is not working as expected, wires or connectors are
broken, the equipment that smells or “smokes”. If you are not sure what the
problem is or what's going on, switch off the Emergency shutdown.
9. Never use damaged instruments, wires or connectors. Hand over these parts to
the Lab instructor/Teacher.
10. Be sure of location of fire extinguishers and first aid kits in the laboratory.
11. Handling of Semiconductor Components: Sensitive electronic circuits and
electronic components have to be handled with great care. The inappropriate
handling of electronic component can damage or destroy the devices. The
devices can be destroyed by driving to high currents through the device, by
overheating the device, by mixing up the polarity, or by electrostatic discharge
(ESD). Therefore, always handle the electronic devices as indicated by the
handout, the specifications in the data sheet or other documentation.

SREERAJ K. P., LR. IN EC viii


6047 – Simulation Lab with Numerical Software Semester 6

CONTENT PAGE

Sl. Page Planned Executed


Title of the practical Remarks
No. No. date date
0 Introduction to MATLAB 1
1 Basic matrix operations 9

2 Solution of Linear Constant Coefficient 21


Differential Equation
3 Eigen values and eigen vectors 26
4 Roots of a polynomial 34
5 Generation of signals 41
6 3D plots 52
7 Diode characteristics 59
8 BJT characteristics 66
9 MOSFET characteristics 74
10 Full wave bridge rectifier 81
11 Solution of electrical networks 89
12 Time response of RLC circuit 99
13 Amplitude modulator 105
14 Frequency modulator 111
15 Pulse modulation schemes 117
16 Pulse Code Modulation 124
17 Logic Gates 133
18 Full adder and full subtractor 138
19 4:1 multiplexer and 1:4 demultiplexer 144
20 Flipflops 150

SREERAJ K. P., LR. IN EC ix


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 0 Date:


INTRODUCTION TO MATLAB

PRACTICAL SIGNIFICANCE
MATLAB is incredibly practical for engineers, scientists, and researchers due to its
robust toolset for numerical computation, data analysis, and visualization. It offers a user-
friendly interface to design algorithms, simulate systems, and model complex phenomena,
making it an indispensable tool for solving real-world problems in diverse fields such as
signal processing, image analysis, control systems, and beyond. Its extensive libraries and
functions streamline tasks, enabling efficient prototyping and accelerating innovation in
various industries.
RELEVANT PROGRAM OUTCOMES(POS)
PO1: Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4: Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7: Life-long learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 Install the MATLAB.


 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)

 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME

 Install MATLAB and explain its various functions.

THEORY
The name MATLAB stands for Matrix Laboratory. The basic building block of
MATLAB is the matrix. It is not confined to the solution of Matrix related problems. With its
inbuilt functions, it is an excellent tool for linear algebraic computations, data analysis, signal

SREERAJ K. P., LR. IN EC 1


6047 – Simulation Lab with Numerical Software Semester 6

processing, optimization, numerical solutions of ordinary differential equations (ODE),


quadrature, 2D & 3D, graphics and many other types of scientific computation. Therefore, we
can say:
MATLAB is a software package in high performance language for technical
computing. It integrates computation, visualization and programming in an easy to use
environment where problems and solutions are expressed in familiar mathematical notation.
Typical uses include:

• Math and computation


• Algorithm and development
• Data acquisition modeling
• Simulation and prototyping
• Data analysis, exploration, and visualization
• Scientific and engineering graphics
• Application development, including graphical user interface building.
MATLAB windows
There are three basic window which are as follows:
1. MATLAB Desktop
When the MATLAB is launched for the first time, the MATLAB desktop appears with
the default layout as shown in Fig 0.1, where you can change the configuration to suit your
needs, by deselecting the selected options and selecting other tools, using the desktop pull
down menu on toolbar. All the selected items, under the desktop submenu appear in the
MATLAB desktop. This is the window which appears by default when MATLAB is
launched. It consists of:

• Command Window: This is the main window, where commands are written. It is
characterized by MATLAB command prompt (>>). The results also appear on this
window (except figures, which appear on figure window) which command is written.
Commands cannot be edited in this window.
• Current Directory: This appears on the bottom left side of MATLAB desktop. It is
where all files are listed. With a mouse right click, you can run M-files, rename,
delete them etc. after selecting a file from here.
• Workspace: This sub-window shows all the variables generated so far and also shows
their type and size.
• Command History: All commands typed on the MATLAB prompt are recorded here.
Also, commands can be selected from here and create as M-file. Thus, it remains
records of MATLAB functions run.

SREERAJ K. P., LR. IN EC 2


6047 – Simulation Lab with Numerical Software Semester 6

Fig 0.1: MATLAB desktop window

2. Figure Window:
The output of all the commands written on the command window or executed by
writing in M-file, whose output is a graph, appears on the window. The user can create as
many figure windows as the system memory allows. A figure window is showing sine curve
is shown in Fig 0.2.

Fig 0.2: MATLAB figure window

SREERAJ K. P., LR. IN EC 3


6047 – Simulation Lab with Numerical Software Semester 6

3. Editor Window
This is where we can write, create, edit and save programs in a file. The file is known
as M-file. To select editor window, go to file and then select M-file. The programs written on
the file are first saved and then run to get the results. To save and run the program, go to
debug and select ‘save and run’. The result appears on the command window. The figure
appears on the figure window. An editor window is shown as in Fig 0.3:

Fig 0.3: MATLAB Editor window

INPUT-OUTPUT
MATLAB takes input from the screen and rushes output to the screen i.e. it supports
interactive computation. It can read input files and write output files.
1. Data Type: There is no need to declare a data to be real or complex. When a real
number is entered as a variable, MATLAB automatically sets the variable to be real.
Fundamental data type is the array.
2. Dimension: Dimension state is not required in the MATLAB. It is automatic.
3. Case Sensitivity: It differentiates between lower and upper cases. It is case sensitive.
4. Output Display: The output of every command appears on the screen unless
MATLAB is directed otherwise. A semi-colon(;) suppress the output when used at the
end of a command except for the graphics.

GETTING STARTED
Starting MATLAB
On windows platform, start MATLAB by double clicking the MATLAB shortcut icon
on your Windows desktop.

SREERAJ K. P., LR. IN EC 4


6047 – Simulation Lab with Numerical Software Semester 6

Writing Command
When you start MATLAB, the MATLAB desktop appears containing tools for
managing files, variables, and applications associated with MATLAB. You can start writing
your command at the prompt appears on command Window. You can also write command in
M-file.
Printing Graphics
The simplest way to get print out of the graph is to type print command window after
the graph appears in the figure window. Alternatively activate the figure window and then
select print from the file menu.
Quitting MATLAB
To end your MATLAB session, select file >Exit MATLAB in the desktop or type quit
in the command window. You can run a script file named finish.m each time MATLAB quits
that, for example, executes function to save the workplace, or display a quit confirmation
dialog box.
ACCESSORIES
Toolboxes
MATLAB features a family of add-on-application specific solutions called toolboxes. Very
important to most users of MATLAB, toolboxes allow you to learn and apply specialized
technology. Toolboxes are comprehensive collections of MATLAB environment to solve
particular classes of problems. Areas in which toolboxes are available include signal
processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many
others. There are 78 toolboxes available. Thus, we can say MATLAB basically works as a
platform and for solving a particular problem, concerned toolbox is required. Few of the
toolboxes are as follows:

• Communication toolbox
• Control system toolbox
• Curve fitting toolbox
• Data acquisition toolbox
• Filter design toolbox
• Fuzzy logic toolbox
• Instrument control toolbox
• Optimization toolbox
• Statistics toolbox
• Symbolic maths toolbox, etc.

SREERAJ K. P., LR. IN EC 5


6047 – Simulation Lab with Numerical Software Semester 6

Simulink
Simulink is a software package that enables you to model, simulate, and analyze
systems whose outputs change over time. Such system are often referred to as dynamic
systems. Simulink can be used to explore the behaviour of a wide range of real- world
dynamic systems, including electrical circuits, shock absorbers, braking systems, and many
other electrical, mechanical, and thermodynamic system. This section explains how Simulink
works.
Simulating a dynamic system is a two-step process with Simulink. First, a user creates
a block diagram, using a block diagram Simulink model editor that graphically depicts time
dependent mathematical relationship among the system’s inputs, states, and outputs. The user
then commands Simulink to simulate the system represented by the model from a specified
start time to a specified stop time.
COMMON COMMANDS
Some commonly used basic MATLAB commands are : To learn more about each command
type help <command> in the command window.
ver - MATLAB, SIMULINK, and toolbox version information.
help - M-file help, displayed at the command line.
helpwin - M-file help, displayed in the help browser.
demo - Run demonstrations.
who - List current variables.
workspace - Display Workspace Browser, a GUI for managing workspace.
clear - Clear variables and functions from memory.
quit - Quit MATLAB session.
type - List M-file.
edit - Edit M-file.
echo - Echo commands in M-files.
format - Set output format.
error - Display error message and abort function.
warning - Display warning message.
fprintf - Display formatted message.
sprintf - Write formatted data to a string.
input - Prompt for user input.

SREERAJ K. P., LR. IN EC 6


6047 – Simulation Lab with Numerical Software Semester 6

pause - Wait for user response.


Control flow
if - Conditionally execute statements.
else - IF statement condition.
elseif - IF statement condition.
end -Terminate scope of FOR, WHILE, SWITCH, TRY and IF statements.
for - Repeat statements a specific number of times.
while - Repeat statements an indefinite number of times.
break - Terminate execution of WHILE or FOR loop.
continue - Pass control to the next iteration of FOR or WHILE loop.
switch - Switch among several cases based on expression.
case - SWITCH statement case.
otherwise - Default SWITCH statement case.
try - Begin TRY block.
catch - Begin CATCH block.
return - Return to invoking function.

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Preferably OS: Windows 7 1 no.
2 MATLAB R2022a 1 no.

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PRACTICAL RELATED QUESTIONS
1. Differentiate between a script and a function in MATLAB.
2. Explain the concept of vectors and matrices in MATLAB.
3. How does MATLAB handle errors, and what are some common debugging
techniques?

SREERAJ K. P., LR. IN EC 7


6047 – Simulation Lab with Numerical Software Semester 6

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://in.mathworks.com/videos/introduction-to-
matlab-81592.html
 https://www.geeksforgeeks.org/introduction-to-matlab/
 https://www.mccormick.northwestern.edu/documents/st
1 Web references udents/undergraduate/introduction-to-matlab.pdf
 https://www.javatpoint.com/matlab-introduction
 https://youtu.be/zF5lKWY87z8
 https://www.bu.edu/tech/files/2017/01/intro_matlab_20
17Spring.pdf

CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 8


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 1 Date:


BASIC MATRIX OPERATIONS

PRACTICAL SIGNIFICANCE
Performing basic matrix operations in MATLAB holds practical significance in
various scientific and engineering applications. These operations are essential for solving
systems of linear equations, which commonly arise in fields such as physics, electrical
engineering, and civil engineering. Additionally, matrix operations play a crucial role in data
manipulation, making them indispensable for tasks like image processing, signal analysis,
and statistical calculations. MATLAB's efficiency in handling these operations facilitates
faster and more accurate numerical computations, contributing significantly to the
advancement of research and problem-solving in diverse domains.
RELEVANT PROGRAM OUTCOMES(POs)
PO1: Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4: Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)

 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME

 Perform basic matrix operations – addition, subtraction, multiplication, division and


inverse and verify those mathematically.

THEORY
MATLAB, which stands for MATrix LABoratory, is a state-of-the-art mathematical
software package, which is used extensively in both academia and industry. It is an
interactive program for numerical computation and data visualization, which along with its
programming capabilities provides a very useful tool for almost all areas of science and
engineering. Unlike other mathematical packages, such as MAPLE or MATHEMATICA,

SREERAJ K. P., LR. IN EC 9


6047 – Simulation Lab with Numerical Software Semester 6

MATLAB cannot perform symbolic manipulations without the use of additional Toolboxes.
It remains however, one of the leading software packages for numerical computation. As you
might guess from its name, MATLAB deals mainly with matrices. A scalar is a 1-by-1 matrix
and a row vector of length say 5, is a 1-by-5 matrix. One of the many advantages of
MATLAB is the natural notation used. It looks a lot like the notation that you encounter in a
linear algebra. This makes the use of the program especially easy and it is what makes
MATLAB a natural choice for numerical computations. The purpose of this experiment is to
familiarize MATLAB, by introducing the basic features and commands of the program.
Built in Functions:
Scalar Functions:
Certain MATLAB functions are essentially used on scalars, but operate element-wise
when applied to a matrix (or vector). They are summarized below.
1. sin - trigonometric sine
2. cos - trigonometric cosine
3. tan - trigonometric tangent
4. asin - trigonometric inverse sine (arcsine)
5. acos - trigonometric inverse cosine (arccosine)
6. atan - trigonometric inverse tangent (arctangent)
7. exp - exponential
8. log - natural logarithm
9. abs - absolute value
10. sqrt - square root
11. rem - remainder
12. round - round towards nearest integer
13. floor - round towards negative infinity
14. ceil - round towards positive infinity
Vector Functions:
Other MATLAB functions operate essentially on vectors returning a scalar value.
Some of these functions are given below.
1. max : get the row in which the maximum element lies
2. min : smallest component
3. length : length of a vector
4. sort : sort in ascending order
5. sum : sum of elements
6. prod : product of elements
7. median : median value
8. mean : mean value std standard deviation

SREERAJ K. P., LR. IN EC 10


6047 – Simulation Lab with Numerical Software Semester 6

Matrix Functions:
Much of MATLAB‟ s power comes from its matrix functions. These can be further
separated into two sub-categories.
The first one consists of convenient matrix building functions, some of which are given
below.
1. eye - identity matrix
2. zeros - matrix of zeros
3. ones - matrix of ones
4. diag - extract diagonal of a matrix or create diagonal matrices
5. triu - upper triangular part of a matrix
6. tril - lower triangular part of a matrix
7. rand - randomly generated matrix
Commands in the second sub-category of matrix functions are
1. size - size of a matrix
2. det - determinant of a square matrix
3. inv - inverse of a matrix
4. rank - rank of a matrix
5. rref - reduced row echelon form
6. eig - eigenvalues and eigenvectors
7. poly - characteristic polynomial
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window

SREERAJ K. P., LR. IN EC 11


6047 – Simulation Lab with Numerical Software Semester 6

PROBLEM STATEMENT – PERFORM IN LAB


Perform the following basic matrix operations:
a. Sum: A + B
b. Subtraction: A – B

c. Matrix Multiplication: A ∗ B

d. Element wise Multiplication: A.∗ B

e. Square: A ∗ A
f. Inverse of A & B: inv(A), inv(B)
g. Division: A*inv(B) or A\ B
of the following given matrices:
3 2 1 1 3 0
1. 𝐴 = [ 0 3 4 ] ; 𝐵 = [ 2 6 4]
−1 1 −1 −1 0 2
1 4 3 2 6 2 4 0
2. 𝑃 = [−1 2 0 3] ; 𝑄 = [ 1 2 2 −1]
2 3 1 5 −2 3 5 4
4 2 1 3 1 3 2 −1
1 2 −1 2
3. 𝑅 = [ ];𝑆 = [ ]
3 4 2 3
𝜋 0 1 1
4. 𝑈 = [ ];𝑉 = [ ]
2𝜋 −𝜋 −1 2
8 3 4 2 2 1
5. 𝐴 = [1 5 9] ; 𝐵 = [1 3 −2]
6 1 2 0 2 4

PROGRAM

1.
clc;
clear all;
close all;
A=[3, 2, 1; 0, 3, 4; -1, 1, -1];
B=[1, 3, 0; 2, 6, 4; -1, 0, 2];
add1=A+B
sub1=A-B
mull11=A*B
mull12=A.*B
sq11=A*A
sq12=B*B
invA=inv(A)
invB=inv(B)

SREERAJ K. P., LR. IN EC 12


6047 – Simulation Lab with Numerical Software Semester 6

div11=A*invB
div12=B*invA

2.
clc;
clear all;
close all;
P=[1, 4, 3, 2; -1, 2, 0, 3; 2, 3, 1, 5; 4, 2, 1, 3];
Q=[6, 2, 4, 0; 1, 2, 2, -1; -2, 3, 5, 4; 1, 3, 2, -1];
add2=P+Q
sub2=PQ
mull21=P*Q
mull22=P.*Q
sq21=P*P
sq22=Q*Q
invP=inv(P)
invQ=inv(Q)
div21=P*invQ
div22=Q*invP

3.
clc;
clear all;
close all;
R=[1, 2; 3, 4];
S=[-1, 2 ; 2, 3];
add3=R+S
sub3=R-S
mull31=R*S
mull32=R.*S
sq31=R*R
sq32=S*S
invR=inv(R)
invS=inv(S)
div31=R*invS
div32=S*invR

4.
clc;
clear all;
close all;
U=[pi, 0; 2*pi, -pi];
V=[1, 1 ; -1, 2];
add4=U+V

SREERAJ K. P., LR. IN EC 13


6047 – Simulation Lab with Numerical Software Semester 6

sub4=U-V
mull41=U*V
mull42=U.*V
sq41=U*U
sq42=V*V
invU=inv(U)
invV=inv(V)
div4=U*invV
div4=V*invU

5.
clc;
clear all;
close all;
C=[8, 3, 4; 1, 5, 9; 6, 1, 2];
D=[2, 2, 1; 1, 3, -2; 0, 2, 4];
add5=C+D
sub5=C-D
mull51=C*D
mull52=C.*D
sq51=C*C
sq52=D*D
invC=inv(C)
invD=inv(D)
div51=C*invC
div52=D*invD

OUTPUT

1.
4 5 1
A + B, add1 = [ 2 9 8]
−2 1 1
2 −1 1
A - B, sub1 = [−2 3 0]
0 1 −3
6 21 10
A * B, mul11 = [2 18 20]
2 3 2
3 6 0
A .* B, mul12 = [0 18 16 ]
1 0 −2

SREERAJ K. P., LR. IN EC 14


6047 – Simulation Lab with Numerical Software Semester 6

8 13 10
A * A, sq11 = [−4 13 8 ]
−2 0 4
7 21 12
B * B, sq12 = [ 10 42 32]
−3 −3 4
0.2692 −0.1154 −0.1923
Inverse of A, invA = [ 0.1538 0.0769 0.4615 ]
−0.1154 −0.1923 −0.3462
−1.00 0.50 −1.00
Inverse of B, invB = [0.6667 −0.1667 0.3333]
−0.50 0.25 0
−2.1667 1.4167 −2.3333
A/B, div11 = [ 0 0.5000 1.0000 ]
2.1667 −0.9167 1.3333

0.7308 0.1154 1.1923


A\B, div12 = [ 1.0000 1.0000 1.0000 ]
−0.5000 0.5000 −0.5000

2.
7 6 7 2
P + Q, add2 = [0 4 2 2]
0 6 6 9
5 5 3 2

−5 2 −1 2
P - Q, sub2 = [ −2 0 −2 4]
4 0 −4 1
3 −1 −1 4

6 25 31 6
P * Q, mul21 = [−1 11 6 −5 ]
18 28 29 −4
27 24 31 −1

6 8 12 0
P .* Q, mul22 = [−1 4 0 −3]
−4 9 5 20
4 6 2 −3

11 25 8 35
P * P, sq21 = [ 9 6 0 13 ]
21 27 12 33
16 29 16 28

SREERAJ K. P., LR. IN EC 15


6047 – Simulation Lab with Numerical Software Semester 6

30 28 48 14
Q * Q, sq22 = [ 3 9 16 7 ]
−15 29 31 13
4 11 18 6

−0.0417 0.12250 −0.3333 0.4583


Inverse of P, invP = [ 0.1667 1.5000 −1.6667 1.6667]
0.2083 −1.6250 1.6667 −1.2917
−0.1250 −0.6250 1.0000 −0.6250

0.1857 −0.4857 −0.0571 0.2571


Inverse of Q, invQ = [ 0.0000 −1.0000 0.0000 1.0000 ]
−0.0286 1.2286 0.0857 −0.8857
0.1286 −1.0286 0.1143 0.4857

0.3571 −2.8571 0.4286 2.5714


P/Q, div21 = [0.2000 −4.6000 0.4000 3.2000]
0.9857 −7.8857 0.5429 5.0571
1.1000 −5.8000 0.2000 3.6000

0.9167 −2.7500 1.3333 −0.0833


P\Q, div22 = [0.8333 0.5000 −1.3333 0.8333]
1.1250 −6.3750 8.0000 −6.3750
1.0000 2.0000 −3.0000 2.0000

3.
0 4
R + S, add3 = [ ]
5 7
2 0
R - S, sub3 = [ ]
1 1
3 8
R * S, mul31 = [ ]
5 18
−1 4
R .* S, mul32 = [ ]
6 12
7 10
R * R, sq31 = [ ]
15 22

5 4
S * S, sq32 = [ ]
4 13
−2.0000 1.0000
Inverse of R, invR = [ ]
1.5000 −0.5000
−0.4286 0.2857
Inverse of S, invS = [ ]
0.2857 0.1429

SREERAJ K. P., LR. IN EC 16


6047 – Simulation Lab with Numerical Software Semester 6

0.1429 0.5714
R/S, div31 = [ ]
−0.1429 1.4286
5.0000 −2.0000
R\S, div32 = [ ]
0.5000 0.5000

4.
4.1416 1.0000
U + V, add4 = [ ]
5.2832 −1.1416
2.1416 −1.0000
U - V, sub4 = [ ]
7.2832 −5.1416
3.1416 3.1416
U * V, mul41 = [ ]
9.4248 0
3.1416 0
U .* V, mul42 = [ ]
−6.2832 −6.2832
9.8696 0
U * U, sq41 = [ ]
0 9.8696
0 3
V * V, sq42 = [ ]
−3 3
0.3183 0
Inverse of U, invU = [ ]
0.6366 −0.3183
06667 −0.3333
Inverse of V, invV = [ ]
0.3333 0.3333
2.0944 −1.0472
U/V, div41 = [ ]
3.1416 −3.1416

0.9549 −0.3183
U\V, div42 = [ ]
0.9549 −0.6366

5.
10 5 5
C + D, add5 = [ 2 8 7]
6 3 6
6 1 3
C - D, sub5 = [0 2 11 ]
6 −1 −2
19 33 18
C * D, mul51 = [ 7 35 27]
13 19 12

SREERAJ K. P., LR. IN EC 17


6047 – Simulation Lab with Numerical Software Semester 6

16 6 4
C .* D, mul52 = [ 1 15 −18]
0 2 8
91 43 67
C * C, sq51 = [67 37 67]
61 25 37
6 12 2
D * D, sq52 = [5 7 −13]
2 14 12
0.0208 −0.0417 0.1458
Inverse of C, invC = [ 1.0833 −0.1667 −1.4167]
−0.6042 0.2083 0.7708

0.6154 −0.2308 −0.2692


Inverse of D, invD = [−0.1538 0.3077 0.1923 ]
0.0769 −012385 0.1538
1.0000 0.0000 0
C/D, div51 = [−0.0000 1.0000 0 ]
−0.0000 0.0000 1.0000
1.0000 0.0000 −0.0000
C\D, div52 = [ 0 1.0000 0 ]
0 0 1.0000

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 18


6047 – Simulation Lab with Numerical Software Semester 6

PROBLEM STATEMENT – TO BE SOLVED BY STUDENT


1. Enter the matrix M = [1,-2,8,0] and N = [1 5 6 8; 2 5 6 9]
Perform addition on M and N and see how matlab reacts.
2. Find the transpose of null matrix using matlab
3. Write a MATLAB program to perform the division operation on the following matrix
A = [24,-30, 64,-81], b= [6,5,8,9] and verify the result.
4. Write a matlab program to perfom addition operation using 2x3 matrix. Assume any
numbers
5. Enter the matrix
A = [1 6 9 8 5; 9 3 5 8 4; 5 6 3 5 7], B = [6 5 9 3 5; 6 5 4 8 5; 6 3 5 7 9],
C = [2 5 9 3 4; 5 6 3 7 8; 9 8 6 5 4]
Find [(A+B)+C]T
6. Enter the matrix
A = [1 6 9 8 5; 9 3 5 8 4; 5 6 3 5 7], B = [6 5 9 3 5; 6 5 4 8 5; 6 3 5 7 9],
C = [2 5 9 3 4; 5 6 3 7 8; 9 8 6 5 4]
Find [(A-B)+C]-1
7. Write a matlab program to perfom addition operation using 3x2 matrix. Assume any
numbers.
8. Write a MATLAB program to perform the division operation on the following matrix
A = [25,-35,121,-21], b= [5,5,11,3] and perform the transpose function on the answer
9. Find the addition of null matrix and unity matrix of order 3x3.
10. Enter the Matrix the following Matrices and multiply M and N using M*N. Observe
the output in the command window.
−1 2 4 1 2
𝑀 = [ 2 −1 −1] ; 𝑁 = [3 −1]
4 2 0 1 1

PRACTICAL RELATED QUESTIONS


1. What is clear all and close all will do?
2. What is disp() and input()?
3. How can MATLAB be used to find the inverse of a matrix? Discuss the conditions
necessary for a matrix to be invertible and demonstrate the process using MATLAB
functions.
4. Discuss the various matrix operations available in MATLAB (transpose, determinant,
trace, etc.). Choose one such operation and illustrate its usage with a practical
example.
5. Describe the function and method used in MATLAB to find the inverse of a matrix.
Demonstrate the process using a square matrix and check the validity of the inversion.

SREERAJ K. P., LR. IN EC 19


6047 – Simulation Lab with Numerical Software Semester 6

REFERENCES

Sl. Text
Autho
No Book/ Publication
r
. Website
 https://in.mathworks.com/help/matlab/math/basic-matrix-
operations.html
 https://in.mathworks.com/help/matlabmobile/ug/matrix-
Web operations.html
1 referenc  https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-
es operations.html
 https://www.javatpoint.com/matlab-operations-on-matrices
 https://uomustansiriyah.edu.iq/media/lectures/9/9_2018_12_28!11_46
_29_PM.pdf

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 20


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 2 Date:


Solution of Linear Constant Coefficient Differential Equation

PRACTICAL SIGNIFICANCE
Solving differential equations through MATLAB Simulink allows for the simulation
and analysis of dynamic systems in various fields such as engineering, physics, and biology.
It enables the modelling of complex behaviours and interactions within these systems, aiding
in predicting their future states and behaviours. The visual representation provided by
Simulink helps in understanding the dynamics of the system and optimizing its design or
performance. Furthermore, the ability to easily tweak parameters and observe real-time
responses facilitates rapid prototyping and iterative refinement of systems.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Solution of linear constant coefficient differential equation and verify its mathematically.
THEORY
Though MATLAB is primarily a numerics package, it can certainly solve
straightforward differential equations symbolically. Suppose, for example, that we want to
solve the first order differential equation.
𝑑𝑦
= 𝑥𝑦
𝑑𝑥

SREERAJ K. P., LR. IN EC 21


6047 – Simulation Lab with Numerical Software Semester 6

We can use MATLAB’s built-in dsolve(). The input and output for solving this
problem in MATLAB is given below.

≫y = dsolve(’Dy = y*x’,’x’)

Output:

y = C1*exp(1/2*x^2)

Notice in particular that MATLAB uses capital D to indicate the derivative and
requires that the entire equation appear in single quotes. MATLAB takes t to be the
independent variable by default, so here x must be explicitly specified as the independent
variable. Alternatively, if you are going to use the same equation a number of times, you
might choose to define it as a variable, say, eqn1.

≫eqn1 = ’Dy = y*x’

eqn1 = Dy = y*x

≫y = dsolve(eqn1,’x’)

y = C1*exp(1/2*x^2)
To solve an initial value problem, with y(1) = 1, use

≫y = dsolve(eqn1,’y(1)=1’,’x’)

y = 1/exp(1/2)*exp(1/2*x^2)
or

≫inits = ’y(1)=1’;

≫y = dsolve(eqn1,inits,’x’)

y = 1/exp(1/2)*exp(1/2*x^2)
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window

SREERAJ K. P., LR. IN EC 22


6047 – Simulation Lab with Numerical Software Semester 6

PROBLEM STATEMENT – PERFORM IN LAB


Find the solution of the following differential equations:
𝑑𝑦
1. = 𝑎𝑦
𝑑𝑡
𝑑𝑦
2. 𝑑𝑡
= −1𝑦, 𝑦(0) = 1
2
𝑑 𝑦
3. = 𝑎2 𝑦, 𝑦(0) = 1, 𝑦′(𝜋/4) =0
𝑑𝑡 2
𝑑𝑦 (𝑥𝑦−𝑦 2 )
4. =
𝑑𝑡 𝑥2
𝑑𝑦 𝑦 𝑦
5. = tan (𝑥 ) + 𝑥
𝑑𝑥

PROGRAM

1.
clc;
clear all;
close all;
syms x y;
y11=dsolve(’Dy=a*y’);
y12=dsolve(’Dy=a*y’,’x’);

2.
clc;
clear all;
close all;
syms x y;
y21=dsolve(’Dy=-a*y’,’y(0)=1’);
y22=dsolve(’Dy=-a*y’,’y(0)=1’,’x’);

3.
clc;
clear all;
close all;
syms x y;
y31=dsolve(’D2y=-a^2*y’,’y(0)=1’,’Dy(pi/4)=0’);
y32=dsolve(’D2y=-a^2*y’,’y(0)=1’,’Dy(pi/4)=0’,’x’);

4.
clc;
clear all;
close all;
syms x y;
y41=dsolve(’Dy=(x*y-y^2)/x^2’);
y42=dsolve(’Dy=(x*y-y^2)/x^2’,’x’);

SREERAJ K. P., LR. IN EC 23


6047 – Simulation Lab with Numerical Software Semester 6

5.
clc;
clear all;
close all;
syms x y;
y51=dsolve(’Dy=tan(y/x)+y/x’);
y52=dsolve(’Dy=tan(y/x)+y/x’,’x’);

OUTPUT

1.
y11 = C2*exp(a*t)
y12 = C4*exp(a*x)

2.
y21 = exp(a*t)
y22 = exp(a*x)

3.
y31 = (exp(-(pi*a*i)/4)*exp(a*t*i))/(exp(-(pi*a*i)/4) + exp((pi*a*i)/4)) + (exp((pi*a*i)/4)*exp(-
a*t*i))/(exp(-(pi*a*i)/4) + exp((pi*a*i)/4))
y32 = (exp(-(pi*a*i)/4)*exp(a*x*i))/(exp(-(pi*a*i)/4) + exp((pi*a*i)/4)) + (exp((pi*a*i)/4)*exp(-
a*x*i))/(exp(-(pi*a*i)/4) + exp((pi*a*i)/4))

4.
y41 = -x/(exp(-x*(C19 + t/x^2)) - 1)
y42 = x/(C22 + log(x))

5.
y51 = solve(y + x*tan(y/x) == 0, y)
solve(int(1/(y + x*tan(y/x)), y, ’IgnoreAnalyticConstraints’, true) - t/x - C25== 0, y)
y52 = x*asin(C30*x)

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 24


6047 – Simulation Lab with Numerical Software Semester 6

CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Describe the process of setting up a differential equation in MATLAB Simulink.
What are the essential steps involved?
𝑑2 𝑦 𝑑𝑦
2. Solve the second-order differential equation 𝑑𝑥 2 = 5 𝑑𝑥 + 6𝑦 = 0 using MATLAB.
Provide both the general solution and a specific solution satisfying the initial
𝑑𝑦
conditions y(0) = 2, (0) = 1.
𝑑𝑥
PRACTICAL RELATED QUESTIONS
1. Explain the role of boundary conditions in solving partial differential equations using
MATLAB. Provide an example of how MATLAB handles boundary value problems
(BVPs) for second-order PDEs.
2. What are the various plotting functions available in MATLAB for visualizing
solutions to differential equations? Explain how these plots help in understanding the
behavior of solutions.

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://in.mathworks.com/help/symbolic/solve-a-system-of-
linear-equations.html
Web  https://in.mathworks.com/help/matlab/math/systems-of-linear-
1 equations.html
references
 https://in.mathworks.com/help/matlab/ref/linsolve.html
 http://matlab.cheme.cmu.edu/2011/10/20/linear-algebra-
approaches-to-solving-systems-of-constant-coefficient-odes/
ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 25


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 3 Date:


EIGEN VALUES AND EIGEN VECTORS

PRACTICAL SIGNIFICANCE
Eigenvalues and eigenvectors are crucial in various fields like physics and
engineering. In MATLAB, they help in solving systems of differential equations,
understanding stability in control systems, and analyzing structural mechanics. By calculating
eigenvalues, MATLAB can determine stability criteria, while eigenvectors help identify the
principal directions in a system, aiding in understanding complex phenomena like vibrations
or fluid dynamics. These concepts empower engineers and scientists to comprehend and
manipulate the behavior of systems efficiently.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Determine eigen values and eigen vectors of a square matrix and verify mathematically.
THEORY
For an n × n matrix A, the real number λ is called an Eigen value of A if there exists a
nonzero vector x in Rn such that Ax = λx. The vector x is called an eigenvector belonging to
λ. The equation Ax = λx is equivalent to (A − λI)x = 0, so all of the following are equivalent:

• λ is an Eigen value of A.
• (A − λI)x = 0 has a nontrivial solution.

SREERAJ K. P., LR. IN EC 26


6047 – Simulation Lab with Numerical Software Semester 6

• A − λI is singular.
• det(A − λI) = 0

The eigenvectors for λ are the nonzero solutions x to (A − λI)x = 0. These vectors
together with the 0 vector is called the eigen space corresponding to eigen value λ. The
expression det(A − λI) is a polynomial in λ of degree n, called the characteristic polynomial.
By property 4, the eigen values are the roots of the characteristic equation det(A − λI) = 0.
Determining eigen values and eigenvectors with MATLAB using below two methods:
1. In MATLAB we can find the characteristic polynomial of a matrix A by entering
poly(A). If A is an n×n matrix, poly(A) is a row vector with n+1 elements that are the
coefficients of the characteristic polynomial. The command roots(C) computes the
roots of the polynomial whose coefficients are the elements of the vector C. Thus,
roots (poly(A)) returns the eigen values of A in a column vector.
To find the eigenvectors corresponding to each eigenvalue found above, we need to
find the nonzero solutions x to (A−I)x = 0. One way of doing this in MATLAB is to
compute rref(A-I) and then use Gauss-Jordan elimination.

The reduced form of echelon form for A − 2I gives the general solution to (A −2I)x =
0 0
0 as 𝑥 = [ 𝑟 ] = 𝑟 [1], the form for eigenvectors corresponding to λ = 2.
𝑟 1

SREERAJ K. P., LR. IN EC 27


6047 – Simulation Lab with Numerical Software Semester 6

Similarly, the reduced echelon forms for A − 1I and A − (−1)I allow us to determine
1 1
eigenvectors of the form 𝑠 [0] for λ = 1 and 𝑡 [−1] for λ = −1.
1 1
2. Determining the eigenvalues and eigenvectors in MATLAB is to use the eig function.
For an n × n matrix A, eig(A) returns a n × 1 column vector whose elements are the
eigenvalues of A. The command in the form
[V D] = eig(A)
computes both the eigenvalues and eigenvectors of A. V will be a matrix whose
columns are eigenvectors of A and D will be a diagonal matrix whose entries along
the diagonal are eigenvalues of A. The ith column of V; V (:; i), is the eigenvector
corresponding to the eigenvalue D(i; i). A sample session is shown for the matrix
A above.

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window

SREERAJ K. P., LR. IN EC 28


6047 – Simulation Lab with Numerical Software Semester 6

PROBLEM STATEMENT – PERFORM IN LAB


Determine the eigen values and eigen vectors of the given square matrix.
1 3 0
1. 𝐴 = [ 2 6 4]
−1 0 2
1 −2
2. 𝐵 = [ ]
−5 4
2 2 −3
3. 𝐶 = [ 2 1 −6]
−1 2 0
6 −2 2
4. 𝐷 = [−2 3 −1]
2 −1 3
3 1 4
5. 𝐸 = [0 2 6]
0 0 5

PROGRAM

1.
clc;
clear all;
close all;
A = [1, 3, 0; 2, 6, 4; -1, 0, 2];
%method 1
rA=roots(poly(A));
vA1=rref(A-rA(1)*eye(3));
vA2=rref(A-rA(2)*eye(3));
vA3=rref(A-rA(3)*eye(3));
%method 2
[ VA DA ]=eig(A);

2.
clc;
clear all;
close all;
B = [1, -2; -5, 4];
%method 1
rB=roots(poly(B));
vB1=rref(B-rB(1)*eye(2));
vB2=rref(B-rB(2)*eye(2));
%method 2
[ VB DB ]=eig(B);

SREERAJ K. P., LR. IN EC 29


6047 – Simulation Lab with Numerical Software Semester 6

3.
clc;
clear all;
close all;
C = [2, 2, -2; 2, 1, -6; -1, 2, 0];
%method 1
rC=roots(poly(C));
vC1=rref(C-rC(1)*eye(3));
vC2=rref(C-rC(2)*eye(3));
vC3=rref(C-rC(3)*eye(3));
%method 2
[ VC DC ]=eig(C);

4.
clc;
clear all;
close all;
D = [6, -2, 2; -2, 3, -1; 2, -1, 3];
%method 1
rD=roots(poly(D));
vD1=rref(D-rD(1)*eye(3));
vD2=rref(D-rD(2)*eye(3));
vD3=rref(D-rD(3)*eye(3));
%method 2
[ VD DD ]=eig(D);

5.
clc;
clear all;
close all;
E = [3, 1, 4; 0, 2, 6; 0, 0, 5];
%method 1
rE=roots(poly(E));
vE1=rref(E-rE(1)*eye(3));
vE2=rref(E-rE(2)*eye(3));
vE3=rref(E-rE(3)*eye(3));
%method 2
[ VE DE ]=eig(E);

OUTPUT

1.
6.6056
𝑟𝐴 = [ 3.0000 ]
−0.6056

SREERAJ K. P., LR. IN EC 30


6047 – Simulation Lab with Numerical Software Semester 6

1 0 0
𝑣𝐴1 = [0 1 0]
0 0 1
1.0000 0 1.0000
𝑣𝐴2 = [ 0 1.0000 0.6667]
0 0 0
1.0000 0 −2.6056
𝑣𝐴3 = [ 0 1.0000 1.3944 ]
0 0 0
0.8352 −0.6396 0.4694
𝑉𝐴 = [−0.4470 −0.4264 0.8771 ]
0.3205 0.6396 −0.1019
−0.6056 0 0
𝐷𝐴 = [ 0 3.0000 0 ]
0 0 6.6056

2.
6
𝑟𝐵 = [ ]
−1
1.0000 0.4000
𝑣𝐵1 = [ ]
0 0
1 −1
𝑣𝐵2 = [ ]
0 0
−0.7071 0.3714
𝑉𝐵 = [ ]
−0.7071 −0.9285
−1 0
𝐷𝐵 = [ ]
0 6

3.
3.0000
𝑟𝐶 = [2.6458𝑖 ]
2.6458𝑖
1 0 0
𝑣𝐶1 = [0 1 0]
0 0 1
1 0 −1
𝑣𝐶2 = [0 1 −0.50000 − 1.3229𝑖 ]
0 0 0
1 0 −1
𝑣𝐶3 = [0 1 −0.5000 + 1.3229𝑖 ]
0 0 0
0.8285 −0.1768 + 0.4677𝑖 −0.1768 − 0.4677𝑖
𝑉𝐶 = [0.5523 −0.7071 −0.7071 ]
0.0921 −0.1768 + 0.4677𝑖 −0.1768 − 0.4677𝑖
3 0 0
𝐷𝐶 = [0 2.6458𝑖 0 ]
0 0 −2.6458𝑖

SREERAJ K. P., LR. IN EC 31


6047 – Simulation Lab with Numerical Software Semester 6

4.
8
𝑟𝐷 = [2]
2
1 0 0
𝑣𝐷1 = [0 1 0]
0 0 1
1 0 0
𝑣𝐷2 = [0 1 0]
0 0 1
1 0 0
𝑣𝐷3 = [0 1 0]
0 0 1
0.2842 0.5025 0.8165
𝑉𝐷 = [−0.3313 0.8506 −0.4082]
−0.8997 −0.1544 0.4082
2.0000 0 0
𝐷𝐷 = [ 0 2.0000 0 ]
0 0 8.0000

5.
5
𝑟𝐸 = [3]
2
1.0000 0 −3.0000
𝑣𝐸1 = [ 0 1.0000 −2.0000]
0 0 0
0 1 0
𝑣𝐸2 = [0 0 1]
0 0 0
1.0000 1.0000 0
𝑣𝐸3 = [ 0 0 1.0000]
0 0 0
1.0000 −0.7071 0.8081
𝑉𝐸 = [ 0 0.7071 0.5345]
0 0 0.2673
3 0 0
𝐷𝐸 = [0 2 0]
0 0 5

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 32


6047 – Simulation Lab with Numerical Software Semester 6

CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Generate a random symmetric matrix of size 4x4 and compute its eigenvalues.
Discuss any observations you make about the eigenvalues of symmetric matrices.
2. Compare the computation time required to find eigenvalues and eigenvectors for
matrices of different sizes (e.g., 100x100, 500x500, 1000x1000). Plot a graph
illustrating the relationship between matrix size and computation time.
PRACTICAL RELATED QUESTIONS
1. How many eigenvalues does a square matrix have?
2. What does an eigenvalue represent in the context of a matrix?
3. Can a non-square matrix have eigenvalues?
4. What MATLAB command is used to check if a matrix is diagonalizable?
5. What property do eigenvectors possess when a matrix is multiplied by them?

REFERENCES

Sl. Text
Auth
No Book/ Publication
or
. Website
 https://in.mathworks.com/help/matlab/ref/eig.html
Web  https://www.geeksforgeeks.org/eigenvalues-and-eigenvectors-in-
matlab/
1 referenc
 https://youtu.be/VGVTHDN3XL4
es  https://www.math.ucdavis.edu/~wally/teaching/67/assignments/eigenv
alues_98.pdf

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 33


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 4 Date:


ROOTS OF A POLYNOMIAL

PRACTICAL SIGNIFICANCE
Finding roots of polynomials using MATLAB has practical significance in various
fields like engineering, physics, and economics. It helps in solving real-world problems by
determining the values that make an equation equal to zero, aiding in system stability
analysis, control system design, and signal processing. These roots provide critical
information about the behaviour and characteristics of systems, allowing engineers and
scientists to make informed decisions and predictions. MATLAB's efficient algorithms for
root-finding empower professionals to analyze complex systems and optimize designs
effectively.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.
PRACTICAL OUTCOME
Determine roots of a polynomial and verify mathematically.
THEORY
Polynomial
Polynomials are functions that have the form

𝑓(𝑥) = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 … + 𝑎𝑛 𝑥 𝑛

SREERAJ K. P., LR. IN EC 34


6047 – Simulation Lab with Numerical Software Semester 6

The coefficients a0, a1,…, an are often real numbers and n which is a nonnegative integer, is
the degree or order of the polynomial.

Roots of a polynomial 𝑓(𝑥) = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 … + 𝑎𝑛 𝑥 𝑛 are the values of x for which


f(x) = 0 are -1 and -2. There are n roots of a polynomial with degree n.
In MATLAB
Polynomials are described by using a row vector of the coefficients of the polynomial
beginning with the highest power of x and inserting zeros for "missing" terms:

𝑓(𝑥) = 9𝑥 3 − 5𝑥 2 + 3𝑥 + 7

𝑔(𝑥) = 6𝑥 2 − 𝑥 + 2
The polynomial vector will be

𝑓 = [9 −5 3]
𝑔 = [6 −1 2]

The command "roots" determines the roots of a polynomial. The usage of the function
is:
r= roots (p)
where r is a column vector with the roots and p is a row vector with the coefficients of
the polynomial.
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window

PROBLEM STATEMENT – PERFORM IN LAB


Determine the eigen values and eigen vectors of the given square matrix.

1. 5𝑥 5 + 2𝑥 4 + 𝑥 3 + 𝑥 + 8 = 0
2. 3𝑥 6 + 15𝑥 5 − 10𝑥 3 + 4𝑥 = 0

SREERAJ K. P., LR. IN EC 35


6047 – Simulation Lab with Numerical Software Semester 6

3. 105 + 86𝑥 2 − 176𝑥 − 16𝑥 3 + 𝑥 4 = 0


4. 𝑥 4 − 3𝑥 2 − 42𝑥 − 40 = 0
5. 𝑥 4 + 12𝑥 − 5 = 0
6. 𝑥 4 − 14𝑥 3 + 73𝑥 2 − 168𝑥 + 144 = 0

PROGRAM

1.
clc;
clear all;
close all;
a1=[5, 2, 1, 0, 1, 8];
%method 1
r1=roots(a1);
%method 2
syms x;
s1=solve(5∗x^5 + 2∗x^4 + 1∗x^3 + 0∗x^2 + 1∗x + 8);

2.
clc;
clear all;
close all;
a2=[3, 15, 0, -10, 0, 4, 0];
%method 1
r2=roots(a2);
%method 2
syms x;
s2=solve(3∗x^6 + 15∗x^5 − 10∗x^3 + 4∗x);

3.
clc;
clear all;
close all;
a3=[1, -16, 86, -176, 105];
%method 1
r3=roots(a3);
%method 2
syms x;
s3=solve(105 + 86∗x^2 − 176∗x − 16∗x^3 + 1∗x^4);

4.
clc;
clear all;
close all;

SREERAJ K. P., LR. IN EC 36


6047 – Simulation Lab with Numerical Software Semester 6

a4=[1, 0, -3, -42, -40];


%method 1
r4=roots(a4);
%method 2
syms x;
s4=solve(x^4 − 3∗x^2 − 42∗x − 40);

5.
clc;
clear all;
close all;
a5=[1, 0, 0, 12, -5];
%method 1
r5=roots(a5);
%method 2
syms x;
s5=solve(x^4 + 12∗x − 5);

6.
clc;
clear all;
close all;
a6=[1, -14, 73, -168, 144];
%method 1
r6=roots(a6);
%method 2
syms x;
s6=solve(x^4 − 14∗x^3 + 73∗x^2 − 168∗x + 144);

OUTPUT

1.
𝑎1 = [5 2 1 0 1 8]
−1.1142
−0.4413 + 1.0530𝑖
𝑟1 = −0.4413 − 1.0530𝑖
0.7984 + 0.6812𝑖
[ 0.7984 − 0.6812𝑖 ]
−1.114
0.7984 − 0.6812 ∗ 𝑖
𝑠1 = −0.4413 + 1.053 ∗ 𝑖
−0.4413 − 1.0530 ∗ 𝑖
[ 0.7984 + 0.6812 ∗ 𝑖 ]

2.
𝑎2 = [3 15 0 10 0 4 0]

SREERAJ K. P., LR. IN EC 37


6047 – Simulation Lab with Numerical Software Semester 6

0
−4.8613 + 0.0000𝑖
−0.6925 + 0.3093𝑖
𝑟2 =
−0.6925 − 0.3093𝑖
0.6232 + 0.2975𝑖
[ 0.6232 − 0.2975𝑖 ]
0
−4.8613
0.6231 + 0.2975 ∗ 𝑖
𝑠2 =
−0.6925 + 0.3093 ∗ 𝑖
−0.6925 − 0.3093 ∗ 𝑖
[ 0.6231 − 0.2975 ∗ 𝑖 ]

3.
𝑎3 = [3 15 0 −10 0 4 0]
7.0000
𝑟3 = [5.0000]
3.0000
1.0000
1
𝑠3 = [3]
5
7

4.
𝑎4 = [1 0 −3 −42 −40]
4.0000 + 0.0000𝑖
𝑟4 = [−1.5000 + 2.7839𝑖 ]
−1.5000 − 2.7839𝑖
−1.0000 + 0.0000𝑖
4
−1
1
𝑠4 = (312 𝑖) /2 − 3/2
1
[− (31 𝑖) /2 − 3/2]
2

5.
𝑎5 = [1 0 0 12 −5]
−2.4142
𝑟5 = [1.0000 + 2.0000𝑖 ]
1.0000 − 2.0000𝑖
0.4142 + 0.0000𝑖
21/2 − 1
1/2
𝑠5 = [−2 − 1]
1 + 21
1 − 2𝑖

SREERAJ K. P., LR. IN EC 38


6047 – Simulation Lab with Numerical Software Semester 6

6.
𝑎6 = [1 −14 73 −168 144]
4.0000
𝑟6 = [4.0000]
3.0000
3.0000
3
𝑠6 = [3]
4
4

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

PROBLEM STATEMENT – TO BE SOLVED BY STUDENT


1. Create a MATLAB program that generates a plot of a polynomial function f(x)=2x 4-
3x3+5x2-7x+10 over the interval [-3, 3]. Find and display the roots of this polynomial
using MATLAB's functions. Plot the function and mark the roots on the graph.
2. Compare the efficiency and accuracy of two different methods (e.g., roots() function
vs. other iterative methods like Newton-Raphson) in finding the roots of a given
polynomial equation. Provide a MATLAB script that computes the roots using both
methods and discusses their advantages and disadvantages in terms of accuracy and
computational complexity.

PRACTICAL RELATED QUESTIONS


1. Can the root-finding function in MATLAB handle multiple roots of a polynomial?
2. Can MATLAB find complex roots of a polynomial?
3. Is there any limit to the order of the polynomial for finding its roots in MATLAB?
4. Does the ‘roots’ function work for all polynomial degrees?
5. What happens if the polynomial has no roots in MATLAB?

SREERAJ K. P., LR. IN EC 39


6047 – Simulation Lab with Numerical Software Semester 6

REFERENCES

Sl. Text
Autho
No Book/ Publication
r
. Website
 https://in.mathworks.com/help/matlab/ref/roots.html
Web  https://youtu.be/MmPtxZOUfQE
1 reference  https://www.educba.com/matlab-root-finding/
s  https://www.math.csi.cuny.edu/Computing/matlab/Tutorial/tutorial0
07.html

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 40


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 5 Date:


GENERATION OF SIGNALS

PRACTICAL SIGNIFICANCE
Generating signals using MATLAB holds immense practical significance in various
fields like telecommunications, signal processing, and control systems by enabling simulation
and analysis of real-world scenarios. It allows engineers to prototype and test algorithms
before implementation, saving time and resources. MATLAB's signal generation capabilities
aid in understanding signal behavior, enabling the development of robust systems and
algorithms for applications like image processing, audio signal analysis, and sensor
technologies. Its versatility empowers researchers and practitioners to explore, model, and
manipulate signals with ease, facilitating innovation and advancements in numerous
technological domains.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications


RELEVANT COURSE OUTCOMES(COS)
 Use MATLAB tool for simulating/implementing given application.
PRACTICAL OUTCOME
Generation of various signals and sequences (Periodic and Aperiodic), such as Step,
Square, Saw tooth, Triangular, Sinusoidal, Ramp signal.
THEORY
Plotting
Plots are very useful tool for presenting information. This is true in any field, but
specially in science and engineering, where MATLAB is mostly used. MATLAB has many
commands that can be used for creating different types of plots. These include standard plots
with linear axes, plots with logarithmic and semi-logarithmic axes, polar plots, 3-D contour

SREERAJ K. P., LR. IN EC 41


6047 – Simulation Lab with Numerical Software Semester 6

surfaces and mesh plots, and many more. In this experiment you will learn how MATLAB
can be used to create and format many types of 2-D and 3-D plots.
2-D Plot of a Function
In many situations there is a need to plot a given function. This can be done by using the
‘plot’ or the ‘fplot’ command. In order to plot a function y =f(x) with the plot command, the
user needs to first create a vector of x for the domain over which the function will be plotted.
Then a vector y is created with the corresponding values of f(x) by using element-by-element
calculations as explained in Experiment number 1. Once the two vectors are defined, they can
be used in the plot command. The fplot command plots a function with the form y=f(x)
between specified limits. The command has the form
fplot(‘function’,limits,’line specifiers’)
‘function’ can be typed directly as a string inside the command. For example if the
function that is being plotted is f(x) = 8x^2+5 cos(x),it is typed as:’8*x^2+5*cos(x)’. the
function can include MATLAB built-in functions and functions that are created by the users.
Plotting multiple graphs in the same plot
In many situations there is a need to make several graphs in the same plot. There are
three methods to plot multiple graphs in one figure. One is by using the plot command, the
second by using the hold on and hold off and the third is by using the line command.

Sl. Command Description


No.
1 plot(x, y) Plots the variation of y with respect to x
2 xlabel(‘x’) Gives the label for x axis
3 ylabel(‘cos(x)’) Gives the label for y axis
4 title('plot name') Gives the name of plot
5 fplot ( ‘function string,’ The function fplot gets around our choice of interval
[xstart, xend]) used to generate the plot, and instead decides the number
of plotting points to use for us
6 plot(t,f,t,g,'--') To plot multiple functions, call the plot(x, y) command
with multiple pairs x, y defining the independent and
dependent variables used in the plot in pairs. This is
followed by a character string enclosed in single quotes
to tell us what kind of line to use to generate the second
curve
7 ‘Linewidth’ Increases thickness of curve
8 legend('sinh(x)','cosh(x)') To name the curves
9 plot(x,y,'r',x,z,'b') Differentiates the curves with colors r-red, b-blue, g-
green,
k-black, w-white, y-yellow, m-magenta, c-cyan.
10 axis([xmin xmax ymin Plot range

SREERAJ K. P., LR. IN EC 42


6047 – Simulation Lab with Numerical Software Semester 6

ymax])
11 subplot(1,2,1) Creates the plot with 2 panes and 1 row, and that this
particular plot will appear in the first pane
12 bar(x,y) Creates bar chart
13 [x,y] = meshgrid (-5 : 0.1 : Generate a matrix of elements that give the range over x
5 ,–3 : 0.1 : 3); and y we want to use along with the specification of
increment in each case

Basic functions to plot


Unit Step Function
Unit step function in continuous time is denoted by u(t). It is defined as

1 ; 𝑡≥0
𝑢(𝑡) = {
0 ; 𝑡<0

Unit step function in discrete time is denoted by u[n]. It is defined as

1 ; 𝑛≥0
𝑢[𝑛] = {
0 ; 𝑛<0

Unit Impulse Function


An ideal impulse function is a function that is zero everywhere but at the origin,
where it is infinitely high. However, the area of the impulse is finite.
Impulse function is continuous time is denoted by δ(t). and it is defined as

1 ; 𝑡=0
𝛿(𝑡) = {
0 ; 𝑡≠0

Impulse function is discrete time is denoted by δ[n]. and it is defined as

SREERAJ K. P., LR. IN EC 43


6047 – Simulation Lab with Numerical Software Semester 6

1 ; 𝑛=0
𝛿[𝑛] = {
0 ; 𝑛≠0

Ramp Signal
Ramp signal in continuous time is denoted by r(t), and it is defined as

𝑡 ; 𝑡≥0
𝑟(𝑡) = {
0 ; 𝑡<0

Ramp signal in discrete time is denoted by r[n], and it is defined as

𝑛 ; 𝑛≥0
𝑟[𝑛] = {
0 ; 𝑡<0

Sinusoidal Signal
The sine wave or sinusoid is a mathematical function that describes a smooth
repetitive oscillation. It occurs often in pure mathematics, as well as physics, signal
processing, electrical engineering and many other fields. Its most basic form as a function of
time (t) is:

𝑥(𝑡) = 𝐴 cos (𝜔0 𝑡 + ∅)

where:
• A, the amplitude, is the peak deviation of the function from its center position.

• 𝜔0 , the angular frequency, specifies how many oscillations occur in a unit time interval, in
radians per second

SREERAJ K. P., LR. IN EC 44


6047 – Simulation Lab with Numerical Software Semester 6

• ∅, the phase, specifies where in its cycle the oscillation begins at t = 0.


Sinusoidal signal in discrete time is in the form of

𝑥[𝑛] = 𝐴 cos (Ω0 𝑛 + 𝜙)

Square Signal
The simplest formula for the square waveform is just taking the sign of the sine

𝑠(𝑡) = 𝑠𝑔𝑛(𝑠𝑖𝑛(𝜔0 𝑡))

Triangular Signal
A triangle wave is a non-sinusoidal waveform named for its triangular shape. A
bandlimited triangle wave pictured in the time domain (top) and frequency domain (bottom).
The fundamental is at 220 Hz (A2). Like a square wave, the triangle wave contains only odd
harmonics. However, the higher harmonics roll off much faster than in a square wave
(proportional to the inverse square of the harmonic number as opposed to just the inverse).
Triangular signal in continuous time is denoted as x(t)

|𝑡|
𝑥(𝑡) = 𝐴 [1 − ]
𝑇

Sawtooth Signal
The sawtooth wave (or saw wave) is a kind of non-sinusoidal waveform. It is named a
sawtooth based on its resemblance to the teeth on the blade of a saw. The convention is that a
sawtooth wave ramps upward and then sharply drops. However, there are also sawtooth
waves in which the wave ramps downward and then sharply rise. The latter type of sawtooth
wave is called a 'reverse sawtooth wave' or 'inverse sawtooth wave'.

SREERAJ K. P., LR. IN EC 45


6047 – Simulation Lab with Numerical Software Semester 6

The simplest formula for the sawtooth wave is a modulo approach:

1
𝑠(𝑡) = 2 (𝑡% ) 𝑓 − 1
𝑓

where f is the sawtooth’s frequency in Hz, t is time in seconds, and % is the modulo
operator applied to real values.
The formula reads, “increase the value linearly (t), jump back to 0 every period, scale
to the [0,1] range (multiplication by f), and then expand the range from [0,1] to [−1,1]
(multiplication by 2 and subtraction of 1).”
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see figure window

PROGRAM

Unit impulse signal


%unit impulse function%
clc;
clear all;
close all;
t=-10:1:10;
x=(t==0);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('unit impulse function');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('unit impulse discrete function');

SREERAJ K. P., LR. IN EC 46


6047 – Simulation Lab with Numerical Software Semester 6

Unit step signal


%unit step function%
clc;
clear all;
close all;
N=21;
t=-10:1:10;
x=[zeros(1,11),ones(1,10)];
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('unit step function');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('unit step discrete function');

Unit ramp signal


%unit ramp function%
clc;
clear all;
close all;
t=0:1:10;
x=[t.*ones(1,11)];
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('unit ramp function');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('unit ramp discreat function');

Square wave
%square function%
clc;
clear all;
close all;
t=0:0.01:2;
x=square(2*pi*t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('square signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('square sequence');

SREERAJ K. P., LR. IN EC 47


6047 – Simulation Lab with Numerical Software Semester 6

Sine wave
%sinusoidal function%
clc;
clear all;
close all;
t=0:0.01:2;
x=sin(2*pi*t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('sinusoidal signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('sinusoidal sequence');

Triangular wave
%triangular function%
clc;
clear all;
close all;
t=0:0.01:2;
x=sawtooth(2*pi*5*t,0.5);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('triangular signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('triangular sequence');

Sawtooth wave
%sawtooth function%
clc;
clear all;
close all;
t=0:0.01:2;
x=sawtooth(2*pi*5*t);
subplot(2,1,1);
plot(t,x,'g');
xlabel('time');
ylabel('amplitude');
title('sawtooth signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time');
ylabel('amplitude');
title('sawtooth sequence');

SREERAJ K. P., LR. IN EC 48


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

Unit impulse signal Unit step signal

Unit ramp signal Square wave

Sine wave Triangular wave

SREERAJ K. P., LR. IN EC 49


6047 – Simulation Lab with Numerical Software Semester 6

Sawtooth wave

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Plot triangular and sawtooth wave of same frequency and plot in the same figure
window.
2. Generate a sinusoidal signal x(t)=A⋅sin(2πft+ϕ) where A=2, f=5 Hz, and ϕ=π/4. Plot
the signal over the time interval 0 ≤ t ≤ 2 seconds.
3. Create a square wave signal x(t) with a frequency of 2 Hz and a duty cycle of 30%.
Plot the signal over the time interval 0 ≤ t ≤ 4 seconds.

PRACTICAL RELATED QUESTIONS


1. How can you customize the appearance of a plot in MATLAB? Provide examples of
modifying color, line style, and marker style.
2. Describe the difference between 'plot' and 'stem' functions in MATLAB. When would
you use each one for signal visualization?
3. What are the steps to plot multiple signals on the same graph in MATLAB? Explain
with an example.

SREERAJ K. P., LR. IN EC 50


6047 – Simulation Lab with Numerical Software Semester 6

4. How can you add legends to a plot in MATLAB? Provide the syntax and an example
of adding a legend to differentiate between plotted signals.
5. Discuss the significance of the 'hold on' and 'hold off' commands in MATLAB
plotting. When and why would you use them?
6. Explain the process of saving a MATLAB plot as an image file. What are the
available file formats, and how do you specify them in MATLAB?

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://in.mathworks.com/help/signal/gs/impulse-step-and-
ramp-functions.html
Web  https://in.mathworks.com/help/signal/ref/square.html
1
references  https://thewolfsound.com/sine-saw-square-triangle-pulse-
basic-waveforms-in-synthesis/
 https://in.mathworks.com/help/signal/ref/sawtooth.html

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 51


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 6 Date:


3D PLOTS

PRACTICAL SIGNIFICANCE
In MATLAB, the significance of 3D representation lies in its ability to visually
portray complex data with depth and perspective. This dimensionality allows for a more
comprehensive analysis of volumetric data, enabling a better understanding of relationships
and patterns within the data. Moreover, MATLAB's 3D plotting capabilities aid in visualizing
surfaces, which is crucial in fields like engineering, physics, and biology, where depicting
functions, terrain, or experimental results as surfaces greatly enhances comprehension.
Surface plotting in MATLAB is instrumental in representing mathematical functions,
experimental data, and modelling results in a way that emphasizes their behaviour across
multiple dimensions, providing a clearer insight into their characteristics and trends. This
functionality empowers researchers, engineers, and scientists to analyze and interpret data
more effectively in their respective fields.

RELEVANT PROGRAM OUTCOMES(POS)


PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.

COMPETENCY AND PRACTICAL SKILLS


This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Plot different types of plots 3D, surface plot, polar plot.

SREERAJ K. P., LR. IN EC 52


6047 – Simulation Lab with Numerical Software Semester 6

THEORY
Three-Dimensional Graphics
One of the best features of MATLAB is the use of 3D plotting to create beautiful
visualisation of functions and relationships between them. It offers 3-dimensional plotting
functions such as plot3, comet3, mesh, surf, surfl, contour, ezsurf, fsurf etc.
MATLAB provides a variety of functions to display 3-D data. Some functions plot lines
in 3-D, while others draw surfaces and wire frames. In addition, colour can be used to
represent a fourth dimension. When colour is used in this manner, it is called pseudo colour,
since colour is not inherent or natural property of the underlying data in the way that colour
in a photograph is natural characteristic of the image.
a) LINE PLOTS: General format of the command is plot3(x1,y1,z1,S1,x2,y2,z2,S2,…)
where xn,yn and zn are vectors or matrices and Sn are optional character strings
specifying colour, marker symbol and or line style.
b) MESH PLOT: MATLAB defines a mesh surface by the z-coordinates of points
above a rectangular grid in the x-y plane. It formats a mesh plot by joining adjacent
points with straight lines. The result looks like a fishing net with knots at the data
points.
c) SURFACE PLOTS: A surface plot is like a mesh plot, except that the spaces
between the lines called patches are filled in. Plots of this type are generated using the
surf function.

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see figure window

SREERAJ K. P., LR. IN EC 53


6047 – Simulation Lab with Numerical Software Semester 6

PROGRAM

Helix using the function plot3()


clc;
clear all;
close all;
theta=0:pi/100:10*pi ;
x=cos(theta);
y=sin(theta);
z=theta;
plot3(x,y,z);
xlabel('x value');
ylabel('y value');
zlabel('z value');
title('helix');

Cylinder using the function plot3()


clc;
clear all;
close all;
theta=0:pi/100:100*pi; %More number of points to make a cylinder
x=cos(theta);
y=sin(theta);
z=theta;
plot3(x,y,z);
xlabel('x value');
ylabel('y value');
zlabel('z value');
title('helix');

Data as a surface using mesh()


clc;
clear all;
close all;
z=[1:5;2:6;3:7];
mesh(z);

Data as a surface using surf()


clc;
clear all;
close all;
z=[1:5;2:6;3:7];
surf(z);

Surface plot using surfl()


clc;
clear all;
close all;
z=peaks(10); %You can choose other values and see the difference
surfl(z); % surface plot with colour-based lighting
title('surface plot using surfl()');

SREERAJ K. P., LR. IN EC 54


6047 – Simulation Lab with Numerical Software Semester 6

Contour plot using contour()


clc;
clear all;
close all;
z=peaks(15);
% contour(z, number_of_contour_levels)
contour(z,5); % 5 different contour levels
title('contour plot with 5 contour levels')
colormap hsv

Surface plot using ezsurf()


syms x y %Symbolic variables need to be declared
ezsurf('x^2 + y^2');

Surface plot for a function using meshgrid()


clc;
clear all;
close all;
x=-1:.1:1;
y=0:.1:1.5;
[X,Y]=meshgrid(x,y);
F=(2-cos(pi*X)).*exp(Y);
surf(X,Y,F);
xlabel('x');
ylabel('y');
title('f=(2-cos*pi*x)*e^y')

Surface plot for a function using cylinder()


clc;
clear all;
close all;
t = 0:pi/10:2*pi;
[X,Y,Z ]= cylinder(2+cos(t));
surf(X,Y,Z);
axis square;
title('f=2+cost')

SREERAJ K. P., LR. IN EC 55


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

Helix using the function plot3() Cylinder using the function plot3()

Data as a surface using mesh() Data as a surface using surf()

Surface plot using surfl() Contour plot using contour()

Surface plot for a function using


Surface plot using ezsurf()
meshgrid()

SREERAJ K. P., LR. IN EC 56


6047 – Simulation Lab with Numerical Software Semester 6

Surface plot for a function using cylinder()

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Plot a 3d surface plot for the function x.*exp(-x.^2-y.^2) for range -2 to 2.

SREERAJ K. P., LR. IN EC 57


6047 – Simulation Lab with Numerical Software Semester 6

PRACTICAL RELATED QUESTIONS


1. What are the primary differences between a mesh plot and a surface plot in
MATLAB? When would you use one over the other?
2. How do you customize the appearance of a 3D surface plot in MATLAB, such as
changing the colormap or adjusting the viewing angle?
3. Can you explain the concept of contour lines on a 3D surface plot? How are contour
lines generated and visualized in MATLAB?
4. Discuss the significance of colormap in a 3D surface plot. How can it be customized
in MATLAB?

REFERENCES

Text
Sl.
Book/ Author Publication
No.
Website
 https://subarna-lamsal1.medium.com/basics-of-beautiful-3d-
plotting-in-matlab-b85e252b244c
 https://www.studocu.com/in/document/chandigarh-college-of-
Web engineering-and-technology/routing-and-switching/matlab-lab-
1 manual/65664798
references  https://in.mathworks.com/help/matlab/visualize/creating-3-d-
plots.html
 https://mathweb.ucsd.edu/~bdriver/21d-s99/matlab-
primer2.html#s18

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 58


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 7 Date:


DIODE CHARACTERISTICS

PRACTICAL SIGNIFICANCE
Plotting diode characteristics in MATLAB is crucial for understanding their
behaviour under different conditions like voltage and current. It helps in visualizing the
diode's forward and reverse bias characteristics, aiding engineers and researchers in designing
and analyzing circuits accurately. MATLAB's graphical representation allows for quick
analysis of the diode's nonlinear behaviour, enabling parameter extraction and model fitting
for various applications in electronics. Ultimately, these plotted characteristics facilitate
informed decision-making in circuit design and optimization processes.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Plot input output characteristics of diode(P-N junction).

THEORY
V-I characteristics of P-N junction diodes is a curve between the voltage and current
through the circuit. Voltage is taken along the x-axis while the current is taken along the y-
axis. The below graph is the V-I characteristics curve of the P-N junction diode.

SREERAJ K. P., LR. IN EC 59


6047 – Simulation Lab with Numerical Software Semester 6

Fig 7.1 V-I characteristics of bipolar transistor

With the help of the curve, we can understand that there are three regions in which the
diode works, and they are:

• Zero bias
• Forward bias
• Reverse bias
When the P-N junction diode is in zero bias condition, there is no external voltage applied
and this means that the potential barrier at the junction does not allow the flow of current.
When the P-N junction diode is in forward bias condition, the p-type is connected to the
positive terminal while the n-type is connected to the negative terminal of the external
voltage. When the diode is arranged in this manner, there is a reduction in the potential
barrier. For silicone diodes, when the voltage is 0.7 V and for germanium diodes, when the
voltage is 0.3 V, the potential barriers decrease, and there is a flow of current.
When the diode is in forward bias, the current increases slowly, and the curve obtained is
non-linear as the voltage applied to the diode overcomes the potential barrier. Once the diode
overcomes the potential barrier, the diode behaves normally, and the curve rises sharply as
the external voltage increases, and the curve obtained is linear.
When the P-N junction diode is in negative bias condition, the p-type is connected to the
negative terminal while the n-type is connected to the positive terminal of the external
voltage. This results in an increase in the potential barrier. Reverse saturation current flows in
the beginning as minority carriers are present in the junction.

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

SREERAJ K. P., LR. IN EC 60


6047 – Simulation Lab with Numerical Software Semester 6

PROCEDURE
1. Open MATLAB
2. Open a new simulation window by clicking on simulink button.
3. Window that appears in simulink library browser the window contains component
that can be plotted into simulink or design window.
4. Drag & drop the following components from library and do the settings also as given.

Component Simulink block Block parameter

Diode

Controlled Voltage Source

SREERAJ K. P., LR. IN EC 61


6047 – Simulation Lab with Numerical Software Semester 6

Series RLC branch

Ramp

Multimeter

Demux

SREERAJ K. P., LR. IN EC 62


6047 – Simulation Lab with Numerical Software Semester 6

Bus selector

Scope

Powergui

5. Run the simulation with Slope = 1in the ramp for obtaining forward V-I
characteristics.
6. Run the simulation with Slope = -1in the ramp for obtaining forward V-I
characteristics.
SIMULINK MODEL FOR SIMULATION

SREERAJ K. P., LR. IN EC 63


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

DIODE FORWARD V-I CHARACTERISTICS

DIODE REVERSE V-I CHARACTERISTICS

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 64


6047 – Simulation Lab with Numerical Software Semester 6

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Demonstrate the use of Simulink to analyze the impact of different resistors on a
diode's voltage-current relationship.
PRACTICAL RELATED QUESTIONS
1. What are the different regions of operation for a diode?
2. How does the temperature affect the diode characteristics, and can this be simulated in
MATLAB Simulink?
3. Discuss the differences between ideal and practical diode characteristics and their
impact on circuit analysis.
REFERENCES

Sl Text
. Book/ Aut
Publication
N Websi hor
o. te
 https://www.avit.ac.in/lab/electrical_circuits_and_electronic_devices_lab/
Web download/17ECCC93/lab_manual.pdf
 https://www.youtube.com/watch?v=qb8McSN8hHw
1 refere
 https://youtu.be/vCrFplXxuaQ
nces  https://byjus.com/physics/p-n-junction/#v-i-characteristics-of-pn-junction-
diode
ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 65


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 8 Date:


BJT CHARACTERISTICS

PRACTICAL SIGNIFICANCE
Plotting transistor characteristics in MATLAB allows engineers to visualize and
analyze the behaviour of transistors under different operating conditions. These plots help in
understanding key parameters like current-voltage relationships, gain, and cutoff regions,
aiding in circuit design and optimization. MATLAB's graphical representations enable quick
identification of transistor operating regions, assisting in efficient circuit design and
troubleshooting. Furthermore, these characteristics aid in the validation and verification of
theoretical models, ensuring accurate transistor behaviour in practical applications.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Plot input output characteristics of BJT(Bipolar Junction Transistor).
THEORY
In Common Emitter (CE) configuration, the emitter is the common terminal. Hence, the input
is between the base and the emitter while the output is between the collector and the emitter.
Two terms that you must remember:

• Input characteristic – the variation of the base current (IB) with the base-emitter
voltage (VBE)

SREERAJ K. P., LR. IN EC 66


6047 – Simulation Lab with Numerical Software Semester 6

• Output characteristic – the variation of the collector current (IC) with the collector-
emitter voltage (VCE)
Input Characteristics
A curve is plotted between the base current (IB) and the base-emitter voltage (VBE) to
study the input characteristics of the junction transistor in CE configuration. The collector-
emitter voltage (VCE) is kept at a fixed value to study the relation between IB and VBE.

Fig 8.1 BJT input characteristics

Output Characteristics
Plot a curve is between the Collector current (IC) and the collector-emitter voltage
(VCE). Also, keep the base current (IB) at a steady value.

Fig 8.1 BJT output characteristics

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

SREERAJ K. P., LR. IN EC 67


6047 – Simulation Lab with Numerical Software Semester 6

PROCEDURE
1. Open MATLAB
2. Open a new simulation window by clicking on simulink button.
3. Window that appears in simulink library browser the window contains component
that can be plotted into simulink or design window.
4. First create the Simulink model for output characteristics and then for input
characteristics.
5. Drag & drop the following components from library and do the settings also as given.
Block name Block icon Block settings

DC voltage source

npn bipolar transistor Default settings

Current sensor Default settings

Controlled voltage
Default settings
source

PS-Simulink
Default settings
Converter

Simulink-PS
Default settings
Converter

Ramp

SREERAJ K. P., LR. IN EC 68


6047 – Simulation Lab with Numerical Software Semester 6

Scope Default settings

Solver configuration Default settings

6. Using the logging option in the configuration settings of the scope, save the Scope
measuring IC values as ScopeData and the Scope measuring VCE values as
ScopeData1.
7. Run the simulation. The two scopes gives plots, IC vs time and VCE vs time.
8. To get the plot between VCE vs IC, plot these two values against each other using the
function
plot(ScopeData1.signals.values,ScopeData.signals.values)
9. To plot the output characteristics for various values of IB in a single plot, run the
simulation for IB values ranging from 10mA to 60mA and generate the two scope
datas in the workspace as mentioned in Step 5. The variables used for various scope
datas are given below.
IB value Variable for scope data of IC Variable for scope data of VCE
10mA ScopeData ScopeData1
20mA ScopeData2 ScopeData3
30mA ScopeData4 ScopeData5
40mA ScopeData6 ScopeData7
50mA ScopeData8 ScopeData9
60mA ScopeData10 ScopeData11
10. Create an m-file using the code given in the code section to use all the above scope
data to plot the output characteristics for more than one value of IB.
11. Create the Simulink model for finding input characteristics.
12. Using the logging option in the configuration settings of the scope, save the Scope
measuring IB values as ScopeData and the Scope measuring VBE values as
ScopeData1.
13. Run the simulation. The two scopes gives plots, IB vs time and VBE vs time.
14. To get the plot between VBE vs IB, plot these two values against each other using the
function
plot(ScopeData1.signals.values,ScopeData.signals.values)
15. To plot the output characteristics for various values of VCE in a single plot, run the
simulation for VCE values ranging from 0V to 1V and generate the two scope datas in
the workspace as mentioned in Step 5. The variables used for various scope datas are
given below.
VCE value Variable for scope data of ID Variable for scope data of VDS
0V ScopeData ScopeData1
0.1V ScopeData2 ScopeData3
0.2V ScopeData4 ScopeData5

SREERAJ K. P., LR. IN EC 69


6047 – Simulation Lab with Numerical Software Semester 6

0.3V ScopeData6 ScopeData7


0.5V ScopeData8 ScopeData9
1V ScopeData10 ScopeData11
16. Create an m-file using the code given in the code section to use all the above scope
data to plot the output characteristics for more than one value of VCE.

SIMULINK MODEL FOR SIMULATION

Output characteristics

Input characteristics

SREERAJ K. P., LR. IN EC 70


6047 – Simulation Lab with Numerical Software Semester 6

MATLAB SCRIPT FILE

Output characteristics
plot(ScopeData1.signals.values,ScopeData.signals.values,'b')
hold on
plot(ScopeData3.signals.values,ScopeData2.signals.values,'g')
hold on
plot(ScopeData5.signals.values,ScopeData4.signals.values,'c')
hold on
plot(ScopeData7.signals.values,ScopeData6.signals.values,'m')
hold on
plot(ScopeData9.signals.values,ScopeData8.signals.values,'y')
hold on
plot(ScopeData11.signals.values,ScopeData10.signals.values,'k')
hold on
axis([0 5 0 6])
xlabel('Collector to Emitter voltage(VCE)')
ylabel('Collector current(IC)')
legend('IB=10mA','IB=20mA','IB=30mA','IB=40mA','IB=50mA','IB=60mA
')
title('BJT output characteristics')
Input characteristics
plot(ScopeData1.signals.values,ScopeData.signals.values,'b')
hold on
plot(ScopeData3.signals.values,ScopeData2.signals.values,'g')
hold on
plot(ScopeData5.signals.values,ScopeData4.signals.values,'c')
hold on
plot(ScopeData7.signals.values,ScopeData6.signals.values,'m')
hold on
plot(ScopeData9.signals.values,ScopeData8.signals.values,'y')
hold on
plot(ScopeData11.signals.values,ScopeData10.signals.values,'k')
hold on
axis([0 1 0 0.3])
xlabel('Base to Emitter voltage(VBE)')
ylabel('Base current(IB)')
legend('VCE=0V','VCE=0.1V','VCE=0.2V','VCE=0.3V','VCE=0.5V','VCE=
1V')
title('BJT input characteristics')

SREERAJ K. P., LR. IN EC 71


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

Output characteristics

Input characteristics

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 72


6047 – Simulation Lab with Numerical Software Semester 6

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Plot the input and output characteristics of pnp BJT.

PRACTICAL RELATED QUESTIONS


1. Discuss the significance of the base current and collector current in the input
characteristics of a BJT.
2. What is Early effect in BJT? How does it affect the input characteristics?
3. Discuss the importance of load lines in BJT output characteristics. How can you
implement and analyze load lines using MATLAB Simulink?

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://in.mathworks.com/help/sps/ug/npn-bipolar-transistor-
Web characteristics.html
1  https://www.electronics-tutorials.ws/transistor/tran_2.html
references
 https://www.brainkart.com/article/Characteristics-of-an-NPN-
transistor-in-common-emitter-configuration_2988/

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 73


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 9 Date:


MOSFET CHARACTERISTICS

PRACTICAL SIGNIFICANCE
Analyzing MOSFET characteristics using MATLAB holds practical significance in
electronic circuit design by providing a detailed insight into device behavior. MATLAB
allows engineers to simulate and visualize key parameters such as threshold voltage,
transconductance, and drain current, aiding in the optimization of circuit performance. This
enables designers to fine-tune MOSFET operating points, ensuring optimal power efficiency
and signal integrity. Furthermore, MATLAB facilitates the exploration of various MOSFET
configurations and their impact on overall circuit behaviour, streamlining the design process
and contributing to the development of high-performance electronic systems.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Plot input output characteristics of MOSFET.
THEORY
MOSFET stands for Metal Oxide Silicon Field Effect Transistor or Metal Oxide
Semiconductor Field Effect Transistor.
Depending upon the type of materials used in the construction, and the type of
operation, the MOSFETs are classified as in the following figure.

SREERAJ K. P., LR. IN EC 74


6047 – Simulation Lab with Numerical Software Semester 6

Fig 9.1 Types of MOSFET

Construction of N- Channel MOSFET


Let us consider an N-channel MOSFET to understand its working. A lightly doped P-
type substrate is taken into which two heavily doped N-type regions are diffused, which act
as source and drain. Between these two N+ regions, there occurs diffusion to form an
Nchannel, connecting drain and source.

Fig 9.2 Construction of n-channel MOSFET

A thin layer of Silicon dioxide (SiO2) is grown over the entire surface and holes are
made to draw ohmic contacts for drain and source terminals. A conducting layer of
aluminium is laid over the entire channel, upon this SiO2 layer from source to drain which
constitutes the gate. The SiO2 substrate is connected to the common or ground terminals.
Characteristics of MOSFET

Fig 9.2 (a) Transfer characteristics (b) Output characteristics

SREERAJ K. P., LR. IN EC 75


6047 – Simulation Lab with Numerical Software Semester 6

Fig 9.2a shows the transfer characteristics (drain-to-source current IDS versus gate-to-
source voltage VGS) of n-channel Enhancement-type MOSFETs. From this, it is evident that
the current through the device will be zero until the VGS exceeds the value of threshold
voltage VT. This is because under this state, the device will be void of channel which will be
connecting the drain and the source terminals. Under this condition, even an increase in VDS
will result in no current flow as indicated by the corresponding output characteristics (IDS
versus VDS) shown by Figure Fig 9.2b. As a result, this state represents nothing but the cut-
off region of MOSFET’s operation.
Next, once VGS crosses VT, the current through the device increases with an increase
in IDS initially and then saturates to a value as determined by the VGS (saturation region of
operation) i.e. as VGS increases, even the saturation current flowing through the device also
increases. This is evident by Figure b where IDSS2 is greater than IDSS1 as VGS2 > VGS1, IDSS3 is
greater than IDSS2 as VGS3 > VGS2, so on and so forth. Further, Figure b also shows the locus of
pinch-off voltage (black discontinuous curve), from which VP is seen to increase with an
increase in VGS.
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB
2. Open a new simulation window by clicking on simulink button.
3. Window that appears in simulink library browser the window contains component
that can be plotted into simulink or design window.
4. Drag & drop the following components from library and do the settings also as given.
Block name Block icon Block settings

DC voltage source

n-channel MOSFET Default settings

Current sensor Default settings

SREERAJ K. P., LR. IN EC 76


6047 – Simulation Lab with Numerical Software Semester 6

Controlled voltage
Default settings
source

PS-Simulink
Default settings
Converter

Simulink-PS
Default settings
Converter

Ramp

Scope Default settings

Solver configuration Default settings

5. Using the logging option in the configuration settings of the scope, save the Scope
measuring ID values as ScopeData and the Scope measuring VDS values as
ScopeData1.
6. Run the simulation. The two scopes gives plots, ID vs time and VDS vs time.
7. To get the plot between VDS vs ID, plot these two values against each other using the
function
plot(ScopeData1.signals.values,ScopeData.signals.values)
8. To plot the drain characteristics for various values of VGS in a single plot, run the
simulation for VGS values ranging from 4 to 9V and generate the two scope datas in
the workspace as mentioned in Step 5. The variables used for various scope datas are
given below.
VGS value Variable for scope data of ID Variable for scope data of VDS
4V ScopeData ScopeData1
5V ScopeData2 ScopeData3

SREERAJ K. P., LR. IN EC 77


6047 – Simulation Lab with Numerical Software Semester 6

6V ScopeData4 ScopeData5
7V ScopeData6 ScopeData7
8V ScopeData8 ScopeData9
9V ScopeData10 ScopeData11
9. Create an m-file using the code given in the code section to use all the above scope
data to plot the drain characteristics for more than one value of VGS.

SIMULINK MODEL FOR SIMULATION

MATLAB SCRIPT FILE


plot(ScopeData1.signals.values,ScopeData.signals.values)
hold on
plot(ScopeData3.signals.values,ScopeData2.signals.values,'g')
hold on
plot(ScopeData5.signals.values,ScopeData4.signals.values,'c')
hold on
plot(ScopeData7.signals.values,ScopeData6.signals.values,'m')
hold on
plot(ScopeData9.signals.values,ScopeData8.signals.values,'y')
hold on
plot(ScopeData11.signals.values,ScopeData10.signals.values,'k')
hold on
axis([0 6 0 100])

SREERAJ K. P., LR. IN EC 78


6047 – Simulation Lab with Numerical Software Semester 6

xlabel('Drain to Source voltage(VDS)')


ylabel('Drain current(ID)')
legend('VGS=4V','VGS=5V','VGS=6V','VGS=7V','VGS=8V','VGS=9V')

OUTPUT WAVEFORMS

MOSFET DRAIN CHARACTERISTICS

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Plot the drain characteristics of p-channel MOSFET.

SREERAJ K. P., LR. IN EC 79


6047 – Simulation Lab with Numerical Software Semester 6

PRACTICAL RELATED QUESTIONS


1. Define MOSFET pinch-off voltage. How does it affect the MOSFET's operation, and
how can it be simulated in MATLAB Simulink?
2. What is the significance of the threshold voltage in a MOSFET? How can you
determine it experimentally in MATLAB Simulink?

REFERENCES

Sl. Text
Autho
No Book/ Publication
r
. Website
Web  https://youtu.be/8Z_qz8I5WLE
 https://www.tutorialspoint.com/basic_electronics/basic_electronics_
1 referenc
mosfet.htm
es  https://www.electrical4u.com/mosfet-characteristics/

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 80


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 10 Date:


FULL WAVE BRIDGE RECTIFIER

PRACTICAL SIGNIFICANCE
Implementing a full-wave bridge rectifier with an LC filter in MATLAB Simulink is
practically significant for power electronics applications. This setup helps convert AC to DC
efficiently, reducing ripple voltage and enhancing the quality of the output signal. The
Simulink model allows real-time simulation, enabling engineers to analyze and optimize the
circuit's performance before physical implementation. Moreover, it aids in understanding the
behavior of the rectifier-filter combination under varying loads and input conditions,
facilitating robust design practices in power systems.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Simulate single Phase Full Wave Diode Bridge Rectifier with LC Filter.
THEORY
A rectifier is an electrical device that converts an Alternating Current (AC) into a Direct
Current (DC) by using one or more P-N junction diodes.

SREERAJ K. P., LR. IN EC 81


6047 – Simulation Lab with Numerical Software Semester 6

Fig 10.1 Rectifier

There are two types of rectifiers – Half wave and Full wave.
Full wave bridge rectifier
The bridge rectifier circuit is made of four diodes D1, D2, D3, D4, and a load resistor
RL. The four diodes are connected in a closed-loop configuration to efficiently convert the
alternating current (AC) into Direct Current (DC).

Fig 10.2 Full wave bridge rectifier

The input signal is applied across terminals A and B, and the output DC signal is
obtained across the load resistor RL connected between terminals C and D.
When an AC signal is applied across the bridge rectifier, terminal A becomes positive
during the positive half cycle while terminal B becomes negative. This results in diodes D1
and D3 becoming forward biased while D2 and D4 becoming reverse biased.
During the negative half-cycle, terminal B becomes positive while terminal A
becomes negative. This causes diodes D2 and D4 to become forward biased and diode D1 and
D3 to be reverse biased.
The current flow across load resistor RL is the same during the positive and negative half-
cycles.

Fig 10.2 Full wave bridge rectifier – input and output wavforms

SREERAJ K. P., LR. IN EC 82


6047 – Simulation Lab with Numerical Software Semester 6

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model , click the New Model button on the Library Browser’s
toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
• Sources library (the Sine Wave block)
• Sinks library (the Scope block)
• Commonly used blocks
5. Sine wave block drag and drop from sources to new model.
6. Construct the model as shown in figure with blocks and links to connect them
7. Set the parameters for linear transformer as:
• Units = S.I.
• Nominal power and frequency [Pn(VA) fn(Hz)] = [ 1e3 50 ]
• Winding 1 parameters [V1(Vrms) R1(ohm) L1(H)] = [2 0 0]
• Winding 1 parameters [V1(Vrms) R1(ohm) L1(H)] = [1 0 0]
• Uncheck the check box – Three windings transformer
8. Set the value of RL = 100.
9. Run the simulink by clicking on run button and observe the waveforms to obtain the
output of full wave bridge rectifier.
10. Now add LC filter to get filtered output.
11. First keep L=173 mH and C=318uF and observe the output waveform.
12. Then keep L=5 mH and C=100uF and observe the output waveform.
13. Then keep L=5 mH and C=470uF and observe the output waveform.

SREERAJ K. P., LR. IN EC 83


6047 – Simulation Lab with Numerical Software Semester 6

SIMULINK MODEL FOR SIMULATION


Full wave bridge rectifier

Full wave bridge rectifier with LC filter

SREERAJ K. P., LR. IN EC 84


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

FULL WAVE BRIDGE RECTIFIER

FULL WAVE BRIDGE RECTIFIER WITH LC FILTER, L=173 mH AND C=318uF

SREERAJ K. P., LR. IN EC 85


6047 – Simulation Lab with Numerical Software Semester 6

FULL WAVE BRIDGE RECTIFIER WITH LC FILTER, L=5 mH AND C=100uF

FULL WAVE BRIDGE RECTIFIER WITH LC FILTER, L=5 mH AND C=470uF

SREERAJ K. P., LR. IN EC 86


6047 – Simulation Lab with Numerical Software Semester 6

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

PROBLEM STATEMENT – TO BE SOLVED BY STUDENT


1. Implement C-filter and π-filter at the output of full wave bridge rectifier and compare
its performance with LC filter.

PRACTICAL RELATED QUESTIONS


1. What is the role of an LC filter in a rectifier circuit? How does it contribute to
smoothing the rectified output?
2. Discuss the significance of the LC filter parameters (inductance and capacitance) in
smoothing the output waveform of a rectifier.
3. Explain the concept of ripple factor in rectifier circuits. How does the use of an LC
filter impact the ripple factor?

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://youtu.be/U0oi0YhDtak
Web  https://youtu.be/3mrePJq2L1o
1  https://www.physics-and-radio-electronics.com/electronic-
references devices-and-circuits/rectifier/bridgerectifierwithfilter.html
 https://youtu.be/7jox3w0kVjs

SREERAJ K. P., LR. IN EC 87


6047 – Simulation Lab with Numerical Software Semester 6

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 88


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 11 Date:


SOLUTION OF ELECTRICAL NETWORKS

PRACTICAL SIGNIFICANCE
Node and mesh analysis are fundamental techniques in electrical circuit analysis.
MATLAB enables the application of these methods to solve complex circuits efficiently,
offering a practical way to understand and design circuits. Through MATLAB, engineers can
quickly implement node analysis to determine node voltages or mesh analysis to calculate
mesh currents, streamlining the analysis process and aiding in circuit optimization. This
software facilitates not only the computation but also visualization of results, allowing for
easier interpretation and validation of circuit designs.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Solve node, mesh and loop equations of simple electrical/network circuits.
THEORY
Mesh analysis
Mesh analysis is a method for obtaining loop currents. The technique uses Kirchoff
voltage law (KVL) to write a set of independent simultaneous equations. The Kirchoff
voltage law states that the algebraic sum of all the voltages around any closed path in a circuit
equals zero.

SREERAJ K. P., LR. IN EC 89


6047 – Simulation Lab with Numerical Software Semester 6

In mesh analysis, we want to obtain current from a set of simultaneous equations. The
latter equations are easily set up if the circuit can be drawn in planar fashion. This implies
that a set of simultaneous equations can be obtained if the circuit can be redrawn without
crossovers.
For a planar circuit with n-meshes, the KVL can be used to write equations for each
mesh that does not contain a dependent or independent current source. Using KVL and
writing equations for each mesh, the resulting equations will have the general form:

where:
I1, I2, ... In are the unknown currents for meshes 1 through n.
Z11, Z22, …, Znn are the impedance for each mesh through which individual current flows.
Zij, j # i denote mutual impedance.
∑ Vx is the algebraic sum of the voltage sources in mesh x.
Equation can be expressed in matrix form as

The solution to Equation is

In MATLAB, we can compute [I] by using the command


I=inv(Z)*V
Node analysis
Kirchhoff’s Current Law(KCL) states that for any electrical circuit, the algebraic sum
of all the currents at any node in the circuit equals zero. In nodal analysis, if there are n nodes

SREERAJ K. P., LR. IN EC 90


6047 – Simulation Lab with Numerical Software Semester 6

in a circuit, and we select a reference node, the other nodes can be numbered from V1 through
Vn-1. With one node selected as the reference node, there will be n-1 independent equations.
If we assume that the admittance between nodes i and j is given as Yij, we can write the nodal
equations:

V1, V2 and Vm are voltages from nodes 1, 2 and so on ..., n with respect to the reference node.
∑ Ix is the algebraic sum of current sources at node x.
Equation can be expressed in matrix form as

The solution of the above equation is

In MATLAB, we can compute [V] by using the command


V=inv(Y)*I
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. Open MATLAB.
2. Open new M-file.
3. Type the program.
4. Save in current directory.
5. Compile and Run the program.
6. For the output see command window.
7. Implement the same circuit in Simulink and measure the voltages or currents using
node analysis or mesh analysis respectively and cross check the results obtained using
solving the equation written using MATLAB script file.

SREERAJ K. P., LR. IN EC 91


6047 – Simulation Lab with Numerical Software Semester 6

PROBLEM STATEMENT – PERFORM IN LAB

1. Use the mesh analysis to find the current flowing through the resistor RB.

2. Use the mesh analysis to find all the three mesh currents.

3. For the circuit shown below, find the nodal voltages V1, V2 and V3.

4. For the circuit shown below, find the nodal voltages V1 and V2.

SREERAJ K. P., LR. IN EC 92


6047 – Simulation Lab with Numerical Software Semester 6

EQUATIONS USED FOR SOLVING THE CIRCUIT

1.
Loop 1,
40𝐼1 − 10𝐼2 − 30𝐼3 = 10
Loop 2,
−10𝐼1 + 30𝐼2 − 5𝐼3 = 0
Loop 3,
−30𝐼1 − 5𝐼2 + 65𝐼3 = 0
In matrix form
40 −10 −30 𝐼1 10
[−10 30 𝐼
−5 ] [ 2 ] = [ 0 ]
−30 −5 65 𝐼3 0

2.
Loop 1,
3𝐼1 − 1𝐼2 − 2𝐼3 = 8
Loop 2,
−1𝐼1 + 8𝐼2 − 3𝐼3 = 10
Loop 3,
−2𝐼1 − 3𝐼2 + 10𝐼3 = 12
In matrix form
3 −1 −2 𝐼1 8
[−1 8 −3] [𝐼2 ] = [10]
−2 −3 10 𝐼3 12

3.
For node1,
𝑉1 − 𝑉2 𝑉1 − 𝑉3
+ −5=0
10 20
0.15𝑉1 − 0.1𝑉2 − 0.05𝑉3 = 5
For node2,
𝑉2 − 𝑉1 𝑉2 𝑉2 − 𝑉3
+ + =0
10 50 40
−0.1𝑉1 + 0.145𝑉2 − 0.025𝑉3 = 0
For node3,
𝑉3 − 𝑉1 𝑉3 − 𝑉2
+ −2=0
20 40
−0.05𝑉1 − 0.025𝑉2 + 0.075𝑉3 = 2
In matrix form
0.15 −0.1 −0.05 𝑉1 5
[ −0.1 0.145 −0.025] [𝑉2 ] = [0]
−0.05 −0.025 0.075 𝑉3 2

4.
For node1,
𝑉1 − 60 𝑉1 − 𝑉2
+ =1
20 30
0.083𝑉1 − 0.033𝑉2 = 4
For node2,

SREERAJ K. P., LR. IN EC 93


6047 – Simulation Lab with Numerical Software Semester 6

𝑉2 − 𝑉1 𝑉2 − 40 𝑉2
+ + =0
30 50 100
−0.033𝑉1 + 0.063𝑉2 = 0.8
In matrix form
0.083 −0.033 𝑉1 4
[ ][ ] = [ ]
−0.033 −.063 𝑉2 0.8

PROGRAM

1.
clc;
clear all;
close all;
mesh=[40, -10, -30, 10; -10, 30, -5, 0; -30, -5, 65, 0];
I=rref(mesh);

2.
clc;
clear all;
close all;
mesh=[ 3, -1, -2, 8; -1, 8, -3, 10; -2, -3, 10, 12];
I=rref(mesh);

3.
clc;
clear all;
close all;
mesh=[ 0.15, -0.1, -0.05, 5; -0.1, 0.145, -0.025, 0; -0.05 -0.025, 0.075,2];
V=rref(node);

4.
clc;
clear all;
close all;
node=[3, -1, -2, 8; -1, 8, -3, 10; -2, -3, 10, 12];
I=rref(mesh);

OUTPUT

1.
1 0 0 0.4753
𝐼 = [0 1 0 0.1975]
0 0 1 0.2346
Hence I1 = 0.4753A, I2 = 0.1975A and I3 = 0.2346A
Current through R3 = I3 - I2 = 0.0371A

SREERAJ K. P., LR. IN EC 94


6047 – Simulation Lab with Numerical Software Semester 6

2.
1 0 0 6.0126
𝐼 = [0 1 0 3.2704]
0 0 1 3.3836
Hence I1 = 6.0126A, I2 = 3.2704A and I3 = 3.3836A

3.
1 0 0 404.2857
𝑉 = [0 1 0 350 ]
0 0 1 412.8571
Hence V1 = 404.2857V, V2 = 350V and V3 = 412.8571V

4.
1 0 67.2464
𝑉=[ ]
0 1 47.9227
Hence V1 = 67.2462V, V2 = 47.9227V

SIMULINK MODEL

1.

SREERAJ K. P., LR. IN EC 95


6047 – Simulation Lab with Numerical Software Semester 6

2.

3.

SREERAJ K. P., LR. IN EC 96


6047 – Simulation Lab with Numerical Software Semester 6

4.

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Take a linear circuit containing voltage sources, current sources and resistors. Perform
node and mesh analysis of the same using Simulink and evaluate the obtained voltage
and current value results.

PRACTICAL RELATED QUESTIONS


1. Discuss some practical applications where node analysis is more advantageous
compared to mesh analysis, and vice versa.
2. What are the types of circuits that are generally more efficiently solved using node
analysis rather than mesh analysis?

SREERAJ K. P., LR. IN EC 97


6047 – Simulation Lab with Numerical Software Semester 6

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://www.youtube.com/watch?v=6shhCVcI-5o
 https://www.youtube.com/watch?v=szYlkPFyJ7o
 https://www.learnvern.com/matlab-simulink-tutorial/mesh-
Web analysis-in-simulink
1
references  https://www.learnvern.com/matlab-simulink-tutorial/node-
analysis-in-simulink
 https://electricalacademia.com/circuits-with-matlab/mesh-
analysis-using-matlab-loop-analysis-using-matlab/

ASSESSMENT SCHEME

Performance indicators Weightage


Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 98


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 12 Date:


TIME RESPONSE OF RLC CIRCUIT

PRACTICAL SIGNIFICANCE
The time response of an RLC circuit in MATLAB Simulink is crucial as it helps
analyze the behaviour of the circuit over time when subjected to different inputs. It allows
engineers to study transient behaviours such as settling time, overshoot, and damping in the
circuit's response to input signals. Understanding these responses aids in designing and
optimizing circuit parameters for specific applications, ensuring stable and desired
performance. MATLAB Simulink's visualization tools provide an intuitive way to observe
and analyze these time-domain characteristics efficiently.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications


RELEVANT COURSE OUTCOMES(COS)
 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Simulate an R-L-C circuit to determine time response.
THEORY

Fig 12.1 Series RLC circuit

SREERAJ K. P., LR. IN EC 99


6047 – Simulation Lab with Numerical Software Semester 6

RLC(Resistor, Inductor, Capacitor) circuits are widely used in a variety of application


such as filters in communication systems, ignition system in automobiles, defibrillator circuit
in bio medical application etc.
The transient response in the fluctuation in current and voltage in a circuit after the
application of a step voltage or current before it settles down to its steady state. This
experiment focuses on simulation of series RLC circuit to demonstrate transient analysis of
circuit element.

• Resistor: the application of a voltage V to a resistor with resistance R ohm results in a


current I according to the formula I = V=R. the current response to voltage change is
instantaneous. A resistor has no transient response.
• Inductor: A change in voltage across an inductor with inductance L Henry does not
result in an instantaneous change in the current through the I-V relationship described
𝑑𝑖
by the equation 𝑣 = 𝐿 . The relationship implies that the voltage across an inductor
𝑑𝑡
approach zero as the current reaches a steady value. This means that in a dc current an
inductor will eventually act like a short circuit.
• Capacitor: The transient response of a capacitor is such that it resists instantaneous
𝑑𝑣
change in the voltage across it. Its I-V relationship is described by 𝑖 = 𝐶 𝑑𝑡 . . This
implies that as the voltage across the capacitor reaches a steady vale, the current
through it approaches zero, in other words, a capacitor eventually acts like an open
circuit in a DC circuit.
A series RLC circuit can be modelled as a second order differential equation. The analysis of
series RLC circuit for step input involves finding the solution to a second order linear
differential equation with a unit step forcing function.
The application of KVL around the loop of the RLC circuit shown in figure gives
𝑑𝑖 1
𝑖𝑅 + 𝐿 + ∫ 𝑖𝑑𝑡 = 𝑉𝑖𝑛
𝑑𝑡 𝐶
When differentiated w.r.t. time, we get the second order linear differential equation

𝑑𝑖 𝑑2𝑖 1
𝑅 +𝐿 2+ 𝑖 =0
𝑑𝑡 𝑑𝑡 𝐶
𝑑 2 𝑖 𝑅 𝑑𝑖 1
2
+ + 𝑖=0
𝑑𝑡 𝐿 𝑑𝑡 𝐿𝐶
This equation describes the response of the circuit.
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

SREERAJ K. P., LR. IN EC 100


6047 – Simulation Lab with Numerical Software Semester 6

PROCEDURE
1. To start Simulink, you must start the MATLAB first.
2. Now open the Simulink, by clicking on Simulink Icon.
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
• Sources library (the Sine Wave block)
• Sinks library (the Scope block)
• Commonly used blocks
5. Construct the model as shown in figure with blocks and links to connect them.
6. Set the parameters of the blocks used in the model.
7. Run the simulink by clicking on run button.
8. Double click on scope block to observe waveforms.

SIMULINK MODEL FOR SIMULATION

SREERAJ K. P., LR. IN EC 101


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

𝒅𝟐 𝒊
Scope output:
𝒅𝒕𝟐

𝒅𝒊
Scope output: 𝒅𝒕

SREERAJ K. P., LR. IN EC 102


6047 – Simulation Lab with Numerical Software Semester 6

Scope output: i(t)

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Demonstrate the use of Simulink to analyze the effects of different input signals (e.g.,
step, impulse) on the time response of an RLC circuit. What conclusions can you
draw from these simulations?
2. Create a Simulink model for a second-order RLC circuit and simulate its response to a
square wave input. Determine the damping factor and natural frequency from the
output response.

SREERAJ K. P., LR. IN EC 103


6047 – Simulation Lab with Numerical Software Semester 6

3. Develop a Simulink model for an RLC circuit and analyze the effect of varying the
resistor value on the transient response. Plot and compare the responses for different
resistance values.

PRACTICAL RELATED QUESTIONS


1. Describe the components of an RLC circuit and their roles in the time response
analysis.
2. Discuss the differences between overdamped, underdamped, and critically damped
responses in an RLC circuit.
3. Discuss the role of initial conditions in the time response of an RLC circuit.

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://youtu.be/iTlOsq6rxE4
 https://youtu.be/5MvCddRRilg
1 Web references  https://microcontrollerslab.com/solving-rlc-circuit-
matlab/
 https://shameeraku.coffeecup.com/resources/Lab10.pdf

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 104


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 13 Date:


AMPLITUDE MODULATOR

PRACTICAL SIGNIFICANCE
Implementing an amplitude modulator using MATLAB Simulink allows for real-time
simulation and analysis of modulation techniques, providing a hands-on understanding of
signal processing concepts. It offers a practical way to visualize how varying the amplitude of
a carrier signal encodes information, crucial in telecommunications and broadcasting.
Simulink's graphical interface simplifies the design process, enabling swift prototyping and
testing of different modulation schemes before deployment. Overall, this tool facilitates
practical learning and experimentation, crucial for engineers and researchers in the field of
communications.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.
PRACTICAL OUTCOME
Plot amplitude modulated wave by giving carrier, modulating signal and depth of modulation.
THEORY
Amplitude modulation is the process in which amplitude of the carrier wave will change
in accordance with the modulating signal wave. The waveform of AM consists of two
signals, modulating that is baseband or low frequency signal and carrier that is high
frequency signal. These two signals are mixed together in modulator to obtain Amplitude
Modulated Signal.

SREERAJ K. P., LR. IN EC 105


6047 – Simulation Lab with Numerical Software Semester 6

There are three types of AM modulation:


a. Critical Modulation
b. Under Modulation
c. Over Modulation
When the value of m = 1, then it is perfect modulation. When the value of m < 1 ,then it
is under modulation. When the value of m < >1, then it is over modulation.
Let modulating signal of AM wave is represented as

𝑒𝑚 = 𝐸𝑚 𝑠𝑖𝑛𝜔𝑚 𝑡
where, Em is the peak amplitude of modulating signal and wm = 2πfm. Let carrier signal of
AM wave is represented as

𝑒𝑐 = 𝐸𝑐 𝑠𝑖𝑛𝜔𝑐 𝑡

where, Ec is the peak amplitude of modulating signal and wc = 2πfc.

AM wave is expressed as 𝑒𝐴𝑀 = 𝐴𝑠𝑖𝑛(2𝜋𝑓𝑐 )𝑡, where A is instantaneous value of envelope


and is given by 𝐴 = 𝐸𝑐 + 𝑒𝑚 which gives 𝐴 = 𝐸𝑐 + 𝐸𝑚 𝑠𝑖𝑛(2𝜋𝑓𝑚 )𝑡. Therefore on substitution

𝑒𝐴𝑀 = [𝐸𝑐 + 𝐸𝑚 𝑠𝑖𝑛(2𝜋𝑓𝑚 )𝑡]𝑠𝑖𝑛(2𝜋𝑓𝑐 )𝑡


𝐸𝑚
𝑒𝐴𝑀 = 𝐸𝑐 [1 + 𝑠𝑖𝑛(2𝜋𝑓𝑚 )𝑡] 𝑠𝑖𝑛(2𝜋𝑓𝑐 )𝑡
𝐸𝑐

𝑒𝐴𝑀 = 𝐸𝑐 [1 + 𝑚𝑠𝑖𝑛(2𝜋𝑓𝑚 )𝑡]𝑠𝑖𝑛(2𝜋𝑓𝑐 )𝑡


where m is the modulation index.
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model , click the New Model button on the Library Browser’s
toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
• Sources library (the Sine Wave block)
• Sinks library (the Scope block)
• Commonly used blocks

SREERAJ K. P., LR. IN EC 106


6047 – Simulation Lab with Numerical Software Semester 6

5. Sine wave block drag and drop from sources to new model
6. Construct the model as shown in 10.1 with blocks and links to connect them
7. Set the parameters for modulating signal as:
• Amplitude = 1
• Frequency = 2π
• Phase = 0
• Sample time = 1/1000
8. Set the parameters for carrier signal as:
• Amplitude = 1
• Frequency = 2π*25
• Phase = 0
• Sample time = 1/1000
9. Set the parameters for modulation index = 0.5 for under modulation, 1 for perfect
modulation, 1.5 for over modulation.
10. Run the simulink by clicking on run button.
11. Double click on scope block to observe waveforms.

SIMULINK MODEL FOR SIMULATION

OUTPUT WAVEFORMS

Message signal Carrier signal

SREERAJ K. P., LR. IN EC 107


6047 – Simulation Lab with Numerical Software Semester 6

AM signal with m=0.5(Under modulated)

AM signal with m=1(Critically modulated)

AM signal with m=1.5(Over modulated)

SREERAJ K. P., LR. IN EC 108


6047 – Simulation Lab with Numerical Software Semester 6

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

PROBLEM STATEMENT – TO BE SOLVED BY STUDENT


1. Explain the concept of double sideband (DSB) modulation in the context of AM. How
would you visualize and analyze DSB-SC modulation using Simulink?
2. Describe the demodulation process for an AM signal. How can you implement this
demodulation using Simulink?

PRACTICAL RELATED QUESTIONS


1. Explain the principle of amplitude modulation. How does it differ from frequency and
phase modulation?
2. How do you vary the modulation index in an AM modulator using Simulink? What
impact does it have on the modulated signal?
3. Discuss the differences between ideal and practical diode characteristics and their
impact on circuit analysis.
4. Compare and contrast various types of AM modulation (e.g., DSB, DSB-SC, SSB).

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://youtu.be/p-lfEoyKX2M
 https://electrosome.com/am-generation-simulink/
1 Web references
 https://www.divilabs.com/2014/03/matlab-code-to-
simulate-generate.html

SREERAJ K. P., LR. IN EC 109


6047 – Simulation Lab with Numerical Software Semester 6

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 110


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 14 Date:


FREQUENCY MODULATOR

PRACTICAL SIGNIFICANCE
Implementing a Frequency Modulator using MATLAB Simulink allows for the
simulation and analysis of modulation techniques, crucial in communication systems. It aids
in understanding how information is encoded onto carrier signals, influencing bandwidth
utilization and signal quality. Simulink's visualization tools enable real-time observation of
the modulation process, facilitating troubleshooting and optimization of modulation
parameters. This practical implementation helps engineers grasp the complexities of
frequency modulation, vital in designing robust communication systems.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Plot frequency modulated wave by giving carrier, modulating signal and depth of modulation.
THEORY
In Frequency Modulation (FM), the amplitude of the sinusoidal carrier wave was modulated
in AM, this time the instantaneous frequency of a sinusoidal carrier wave will be modified
proportionally to the variation of amplitude of the message signal. The FM signal is
expressed as

𝑠(𝑡) = 𝐴𝑐 cos (2𝜋𝑓𝑐 + 𝛽 sin(2𝜋𝑓𝑚 𝑡))

SREERAJ K. P., LR. IN EC 111


6047 – Simulation Lab with Numerical Software Semester 6

Where Ac is amplitude of the carrier signal, fc is the carrier frequency β is the


modulation index of the FM wave.
A PLL demodulates an FM signal using feedback to force a voltage-controlled
oscillator (VCO) to remain in phase with the carrier of the incoming signal. The message
signal m(t) is recovered as the control input of the VCO.
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Sinks library (the Scope block).
Commonly used blocks
Math operations
DSP system toolbox
5. Construct the model as shown in figure with blocks and links to connect them
6. Set the parameters for modulating signal as:
• Amplitude = 1
• Frequency = 2π*10
• Phase = 0
• Sample time = 1/1000
7. Set the parameters for constant as:
• Constant value = 100
8. Set the parameters for Gain as:
• Constant value = 50
9. Set the parameters for sum as:
• List of signs = |++
• Sample time = 0.001
10. Set the parameters for trigonometric function as:
• Function = cos
11. Set the parameters for Gain1 as:
• Gain = 2*pi
12. Set the parameters for Analog Filter as:
• Design method = Butterworth

SREERAJ K. P., LR. IN EC 112


6047 – Simulation Lab with Numerical Software Semester 6

• Filter type = Low pass


• filter order = 5
• Passband edge frequency = 2*pi*10
13. Set the parameters for Continuous-time VCO as:
• Output amplitude = 1
• Quiescent frequency = 100
• Input sensitivity = 50
14. Set the parameters for modulation index = 0.5 for under modulation, 1 for perfect
modulation, 1.5 for over modulation.
15. Run the simulink by clicking on run button.
16. Double click on scope block to observe waveforms.

SIMULINK MODEL FOR SIMULATION

SREERAJ K. P., LR. IN EC 113


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

Message signal and FM signal

FM signal and demodulated signal

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 114


6047 – Simulation Lab with Numerical Software Semester 6

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Demonstrate the process of varying the modulation index in a Simulink frequency
modulation model? How does this affect the output signal?
2. Investigate the bandwidth requirements for FM transmission. Design a Simulink
model to depict how changing the modulation index influences the signal bandwidth.

PRACTICAL RELATED QUESTIONS


1. What are the key parameters that define frequency modulation? How are these
parameters adjusted in Simulink?
2. Discuss the advantages and disadvantages of frequency modulation compared to other
modulation techniques.
3. Describe the steps to analyze the frequency spectrum of a modulated signal using
Simulink. How would you interpret the spectrum to understand the modulation
characteristics?
4. Discuss practical applications of frequency modulation. Can you think of real-world
scenarios where FM is preferred over other modulation techniques?

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://youtu.be/0CXhRgNl-us
 https://in.mathworks.com/help/comm/ug/fm-modulation-and-
Web demodulation.html
1
references  https://www.divilabs.com/2014/04/frequency-modilation-fm-
simulation.html
 https://www.12000.org/my_notes/simulink_related/index.htm

SREERAJ K. P., LR. IN EC 115


6047 – Simulation Lab with Numerical Software Semester 6

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 116


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 15 Date:


PULSE MODULATION SCHEMES

PRACTICAL SIGNIFICANCE
Pulse modulation schemes, implemented using MATLAB Simulink, play a pivotal
role in signal processing by encoding analog information into digital signals. These schemes,
like Pulse Amplitude Modulation (PAM) or Pulse Width Modulation (PWM), enable efficient
transmission, reducing noise susceptibility and ensuring accurate signal reproduction.
MATLAB Simulink's simulation capabilities allow for real-time modelling and analysis,
offering a robust platform to evaluate and optimize various pulse modulation techniques for
diverse applications, from telecommunications to control systems. Mastering these
techniques through Simulink enhances understanding and proficiency in digital
communication and signal processing domains.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications


RELEVANT COURSE OUTCOMES(COS)
 Use MATLAB tool for simulating/implementing given application.
PRACTICAL OUTCOME
Simulate Pulse Amplitude Modulation(PAM), Pulse Width Modulation(PWM) and Pulse
Position Modulation(PPM) schemes.
THEORY
Pulse Amplitude Modulation
Pulse Amplitude Modulation (PAM) is an analog modulating scheme in which the
amplitude of the pulse carrier varies proportional to the instantaneous amplitude of the
message signal. The pulse amplitude modulated signal, will follow the amplitude of the
original signal, as the signal traces out the path of the whole wave.

SREERAJ K. P., LR. IN EC 117


6047 – Simulation Lab with Numerical Software Semester 6

Fig 15.1 PAM signal

Pulse Width Modulation


Pulse Width Modulation (PWM) is an analog modulating scheme in which the
duration or width or time of the pulse carrier varies proportional to the instantaneous
amplitude of the message signal. The width of the pulse varies in this method, but the
amplitude of the signal remains constant.

Fig 15.2 PWM signal

Pulse Position Modulation


Pulse Position Modulation (PPM) is an analog modulating scheme in which the
amplitude and width of the pulses are kept constant, while the position of each pulse, with
reference to the position of a reference pulse varies according to the instantaneous sampled
value of the message signal. Pulse position modulation is done in accordance with the pulse
width modulated signal. Each trailing of the pulse width modulated signal becomes the
starting point for pulses in PPM signal. Hence, the position of these pulses is proportional to
the width of the PWM pulses.

Fig 15.3 PPM signal

SREERAJ K. P., LR. IN EC 118


6047 – Simulation Lab with Numerical Software Semester 6

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Sinks library (the Scope block).
Commonly used blocks
Math operations
DSP system toolbox
5. Construct the model as shown in figure with blocks and links to connect them
6. Set the parameters for signal generator as:
• Waveform = sine
• Amplitude = 0.9
• Frequency = 1
• Unit = rad/sec
7. Set the parameters for saw tooth generator as:
• Waveform = saw tooth
• Amplitude = 1
• Frequency = 10
• Unit = rad/sec
8. Set the parameters for pulse generator as:
• Pulse type = time based
• Amplitude = 1
• Period = 0.1
• Pulse width = 1
• Phase delay = 0
9. Set the parameters for monostable multivibrator as:
• Edge detection = rising
• Pulse duration = 0.05s
• Initial condition of previous input = 0
• Sample time = 0

SREERAJ K. P., LR. IN EC 119


6047 – Simulation Lab with Numerical Software Semester 6

SIMULINK MODEL FOR SIMULATION

SREERAJ K. P., LR. IN EC 120


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS

Pulse Amplitude Modulation

Pulse Width Modulation

Pulse Position Modulation

SREERAJ K. P., LR. IN EC 121


6047 – Simulation Lab with Numerical Software Semester 6

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. How does MATLAB Simulink facilitate the analysis of pulse modulation schemes in
terms of signal reconstruction? Demonstrate the reconstruction process of a
modulated signal using Simulink blocks.

PRACTICAL RELATED QUESTIONS


1. Explain the concept of pulse modulation. How does it differ from continuous
waveform modulation techniques?
2. Discuss the differences between PAM, PWM, and PPM.
3. What are the major sources of distortion in pulse modulation schemes?

REFERENCES

Sl Text
. Book/ Aut
Publication
N Webs hor
o. ite
 https://www.youtube.com/watch?v=jnuXL5beA74
Web  https://www.youtube.com/watch?v=OvYnblg7G24
1 refere  https://www.vedantu.com/question-answer/what-is-pam-pwm-and-ppm-
class-12-physics-cbse-60d4c5bb5bde31476b3bf9cc
nces  https://www.tutorialspoint.com/principles_of_communication/principles_of
_communication_analog_pulse_modulation.htm

SREERAJ K. P., LR. IN EC 122


6047 – Simulation Lab with Numerical Software Semester 6

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 123


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 16 Date:


PULSE CODE MODULATION

PRACTICAL SIGNIFICANCE
Pulse Code Modulation (PCM) is practically significant as it enables efficient digital
representation of analog signals, crucial in various communication systems. Using MATLAB
Simulink, PCM can be simulated to showcase its ability to accurately sample, quantize, and
encode analog data into discrete digital signals. Understanding PCM through Simulink helps
in designing and optimizing communication systems, ensuring fidelity and reliability in
transmitting and storing information. This practical application aids engineers in
implementing robust digital communication schemes across diverse industries like
telecommunications, audio processing, and medical instrumentation.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Simulate Pulse Code Modulation(PCM), scheme.
THEORY
In Pulse Code Modulation (PCM) a signal is pulse code modulated to convert its
analog information into a binary sequence, i.e., 1s and 0s. The output of a PCM will resemble
a binary sequence. The following figure shows an example of PCM output with respect to
instantaneous values of a given sine wave.

SREERAJ K. P., LR. IN EC 124


6047 – Simulation Lab with Numerical Software Semester 6

Fig 16.1 PCM output

Instead of a pulse train, PCM produces a series of numbers or digits, and hence this
process is called as digital. Each one of these digits, though in binary code, represent the
approximate amplitude of the signal sample at that instant.
In Pulse Code Modulation, the message signal is represented by a sequence of coded
pulses. This message signal is achieved by representing the signal in discrete form in both
time and amplitude.
Basic Elements of PCM
The transmitter section of a Pulse Code Modulator circuit consists of Sampling,
Quantizing and Encoding, which are performed in the analog-to-digital converter section.
The low pass filter prior to sampling prevents aliasing of the message signal.
The basic operations in the receiver section are regeneration of impaired signals,
decoding, and reconstruction of the quantized pulse train. Following is the block diagram of
PCM which represents the basic elements of both the transmitter and the receiver sections.

Fig 16.2 PCM block diagram

SREERAJ K. P., LR. IN EC 125


6047 – Simulation Lab with Numerical Software Semester 6

Low Pass Filter


This filter eliminates the high frequency components present in the input analog
signal which is greater than the highest frequency of the message signal, to avoid aliasing of
the message signal.
Sampler
This is the technique which helps to collect the sample data at instantaneous values of
message signal, so as to reconstruct the original signal. The sampling rate must be greater
than twice the highest frequency component W of the message signal, in accordance with the
sampling theorem.
Quantizer
Quantizing is a process of reducing the excessive bits and confining the data. The sampled
output when given to Quantizer, reduces the redundant bits and compresses the value.
Encoder
The digitization of analog signal is done by the encoder. It designates each quantized
level by a binary code. The sampling done here is the sample-and-hold process. These three
sections LPF, Sampler and Quantizer will act as an analog to digital converter. Encoding
minimizes the bandwidth used.
Regenerative Repeater
This section increases the signal strength. The output of the channel also has one
regenerative repeater circuit, to compensate the signal loss and reconstruct the signal, and
also to increase its strength.
Decoder
The decoder circuit decodes the pulse coded waveform to reproduce the original
signal. This circuit acts as the demodulator.
Reconstruction Filter
After the digital-to-analog conversion is done by the regenerative circuit and the
decoder, a low-pass filter is employed, called as the reconstruction filter to get back the
original signal.
Hence, the Pulse Code Modulator circuit digitizes the given analog signal, codes it
and samples it, and then transmits it in an analog form. This whole process is repeated in a
reverse pattern to obtain the original signal.
RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

SREERAJ K. P., LR. IN EC 126


6047 – Simulation Lab with Numerical Software Semester 6

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Sinks library (the Scope block).
Commonly used blocks
Math operations
DSP system toolbox
5. Construct the model as shown in figure with blocks and links to connect them
6. Set the parameters for pulse generator as:
• Pulse type = time based
• Amplitude = 1
• Period = 1/3000 sec
• Pulse width = 30%
• Phase delay = 0
7. Set the parameters for sine wave generator as:
• Sine type = time based
• Amplitude = 5
• Bias = 0
• Frequency = 2*pi*50
• Phase = pi/2
• Sample time = 1/50000
8. Set the parameters for quantizer as:
• Quantization interval = 1
• Sample time = -1
9. Set the parameters for uniform encoder as:
• Peak = 5
• Bits = 8
10. Set the parameters for Integer to bit converter as:
• Number of bits per integer(M) = 8
• Treat input values as = Signed
• Output bit order = MSB first
• Output data type = Inherit via internal rule
11. Set the parameters for Bit to integer converter as:
• Number of bits per integer(M) = 8
• After bit packing, treat resulting integer values as = Signed
• Input bit order = MSB first
12. Set the parameters for uniform encoder as:

SREERAJ K. P., LR. IN EC 127


6047 – Simulation Lab with Numerical Software Semester 6

• Peak = 5
• Bits = 8
13. Set the parameters for analog filter design as:
• Design method = Butterworth
• Filter type = low pass
• Filter order = 8
• Passband edge frequency (rad/s) = 2*pi*55
14. Run the simulation for 0.1 sec.

SIMULINK MODEL FOR SIMULATION

SREERAJ K. P., LR. IN EC 128


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT WAVEFORMS
Encoder

Input message signal

Sampled Signal

Quantized signal

SREERAJ K. P., LR. IN EC 129


6047 – Simulation Lab with Numerical Software Semester 6

Uniform encoded signal

Binary output – PCM

Decoder

Decoded signal

SREERAJ K. P., LR. IN EC 130


6047 – Simulation Lab with Numerical Software Semester 6

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. How does the sampling rate affect the quality of PCM? Can you demonstrate this
relationship using a Simulink model?
2. Can you simulate the effect of quantization noise in PCM using MATLAB Simulink?
How does changing the number of bits per sample affect this noise?

PRACTICAL RELATED QUESTIONS


1. What are the advantages and disadvantages of PCM compared to other analog-to-
digital conversion methods?
2. Discuss the significance of quantization in PCM. How does varying the number of
quantization levels impact the signal quality?
3. Explain the role of a low-pass filter in PCM.

REFERENCES

Sl Text
. Book/ Auth
Publication
N Websi or
o. te
 https://youtu.be/5JjtzzFa6iw
Web  https://youtu.be/sMkOuFH5CPc
1 referen  https://www.tutorialspoint.com/digital_communication/digital_communic
ces ation_pulse_code_modulation.htm
 https://www.elprocus.com/pulse-code-modulation-and-demodulation/

SREERAJ K. P., LR. IN EC 131


6047 – Simulation Lab with Numerical Software Semester 6

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 132


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 17 Date:


LOGIC GATES USING SIMULINK

PRACTICAL SIGNIFICANCE
Implementing logic gates using MATLAB Simulink allows for the simulation and
analysis of complex digital systems, enabling engineers to design and verify intricate circuits
efficiently. It provides a visual representation of logic operations, aiding in the understanding
and debugging of circuits before physical implementation. MATLAB Simulink's integration
with other MATLAB functionalities enables seamless exploration and optimization of logic
gate configurations, streamlining the design process. Ultimately, utilizing Simulink for logic
gates fosters rapid prototyping and enhances the reliability of digital systems by fine-tuning
designs in a controlled virtual environment..
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Simulate AND, OR, NAND, NOR, XOR, NOT Gates using blocks.
THEORY
A logic gate is a simple switching circuit that determines whether an input pulse can
pass through to the output in digital circuits. The building blocks of a digital circuit are logic
gates, which execute numerous logical operations that are required by any digital circuit.
These can take two or more inputs but only produce one output.

SREERAJ K. P., LR. IN EC 133


6047 – Simulation Lab with Numerical Software Semester 6

The mix of inputs applied across a logic gate determines its output. Logic gates use
Boolean algebra to execute logical processes. Logic gates are found in nearly every digital
gadget we use on a regular basis.

Truth
Gate Description Table Logic Symbol Timing diagram
A B Y
The output is active
high if any one of 0 0 0
the input is in 0 1 1
OR
active high state, 1 0 1
Mathematically, Q 1 1 1
=A+B
The output is active
high only if both 0 0 0
the inputs are in 0 1 0
AND
active high state, 1 0 0
Mathematically, Q 1 1 1
= A:B
In this gate the
output is opposite
0 1
NOT to the input state,
1 0
Mathematically,
𝑄 = 𝐴̅
The output
is active high
only if both 0 0 1
the inputs are 0 1 0
NOR
in active low 1 0 0
state, 1 1 0
Mathematically,
𝑄 = 𝐴 ̅̅̅̅̅̅̅̅̅
+ 𝐵
The output is active
high only if any 0 0 1
one of the input is 0 1 1
NAND
in active low state, 1 0 1
Mathematically 1 1 0
𝑄 = 𝐴 ̅̅̅̅̅̅
.𝐵

SREERAJ K. P., LR. IN EC 134


6047 – Simulation Lab with Numerical Software Semester 6

The output is active


high only if any 0 0
one of the input is 0 1
XOR
in active high state, 1 1
Mathematically, 1 1
𝑄 = 𝐴̅𝐵 + 𝐴𝐵̅

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Logical operations
5. Construct the model as shown in figure with blocks and links to connect them
6. Set constant block with 0 or 1 as per the truth table of the gates for giving the digital
input.
7. Set logic operator blocks as NOT, AND, OR, NAND, NOR, XOR and XNOR.
8. Set display from the sink block to observe the digital output.
9. Set constant blocks A=0, B=0 and observe the output of all gates.
10. Set constant blocks A=0, B=1 and observe the output of all gates.
11. Set constant blocks A=1, B=0 and observe the output of all gates.
12. Set constant blocks A=1, B=1 and observe the output of all gates.

SREERAJ K. P., LR. IN EC 135


6047 – Simulation Lab with Numerical Software Semester 6

SIMULINK MODEL FOR SIMULATION

OUTPUT

OR AND NOT NAND NOR XOR XNOR


A B Y A B Y A Y A B Y A B Y A B Y A B Y
0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1
0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0
1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 1 0 0
1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 1

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 136


6047 – Simulation Lab with Numerical Software Semester 6

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Implement a circuit that involves cascading logic gates (e.g., AND followed by NOT)
to perform a specific logical operation. Validate its correctness with varied inputs.
2. Design identical logic circuits using both Simulink blocks and fundamental gates
(AND, OR, NOT). Compare their performances in terms of simulation time,
complexity, and accuracy.
PRACTICAL RELATED QUESTIONS
1. Explain the significance of Boolean algebra in the design and analysis of logic gates.
2. Demonstrate how you would construct a XOR gate using basic logic gates.
3. Explain the concept of a universal gate and its importance in digital circuit design.

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://www.youtube.com/watch?v=1JErYxPHl2E
 https://www.youtube.com/watch?v=2KUAZcGmvS
1 Web references
4
 https://www.geeksforgeeks.org/logic-gates/

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 137


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 18 Date:


FULL ADDER AND FULL SUBTRACTOR

PRACTICAL SIGNIFICANCE
Full adders and full subtractors are fundamental building blocks in digital circuits,
crucial for arithmetic operations in computers. In MATLAB Simulink, implementing a full
adder allows for efficient addition of multiple bits, essential for complex calculations in
processors and mathematical operations in digital systems. Conversely, utilizing a full
subtractor enables subtraction functionalities, crucial in applications like data processing and
signal manipulation. Simulink's simulation capabilities allow for the verification and testing
of these crucial components, ensuring their accuracy and reliability in various computational
tasks.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.
PRACTICAL OUTCOME
Develop a model for full adder and full subtractor.
THEORY
Full Adder
In Half adder there is no provision to add the carry generated by lower bits while
adding present inputs that is when multibit addition is performed. Hence a third input is
added and this circuit is used to add A, Band Cin where A, B are present state inputs and Cin
is the last state output that is previous carry. This circuit is known as Full Adder.

SREERAJ K. P., LR. IN EC 138


6047 – Simulation Lab with Numerical Software Semester 6

A B Cin S Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

Fig 18.1 Logical diagram of full adder

Full Subtractor
A full subtractor is used for performing multibit subtraction where the borrow from
the previous bit position is available. This circuit has three inputs A (minuend), B
(subtrahend) and C (borrow from previous stage) and two outputs Difference (D) and Borrow
(b).

A B C D b
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1

Fig 18.2 Logical diagram of full subtractor

SREERAJ K. P., LR. IN EC 139


6047 – Simulation Lab with Numerical Software Semester 6

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Sinks library (the Scope block).
Commonly used blocks
Logical operations block
5. Construct the model as shown in figure with blocks and links to connect them.
6. Set constant block with 0 or 1 as per the truth table of the circuit of full adder and
verify the truth table from the output shown in the display.
7. Set constant block with 0 or 1 as per the truth table of the circuit of full adder and
verify the truth table from the output shown in the display.

SIMULINK MODEL FOR SIMULATION

Full adder

SREERAJ K. P., LR. IN EC 140


6047 – Simulation Lab with Numerical Software Semester 6

Full subtractor

OUTPUT
Full Adder

A B Cin S C
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Full Subtractor

A B C d b
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1

SREERAJ K. P., LR. IN EC 141


6047 – Simulation Lab with Numerical Software Semester 6

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

PROBLEM STATEMENT – TO BE SOLVED BY STUDENT


1. Create a Simulink model of a full adder using two half adders.
2. Create a Simulink model of a full subtractor using two half subtractors.

PRACTICAL RELATED QUESTIONS


1. Describe the working principle of a full adder. How does it differ from a half adder?
2. Discuss the advantages of a full adder over a combination of half adders in terms of
performance and circuit complexity.
3. Discuss the concept of two's complement and its relevance to subtraction in digital
circuits.

REFERENCES

Sl. Text Book/


Author Publication
No. Website
 https://www.geeksforgeeks.org/adders-and-subtractors-in-
digital-logic/
1 Web references
 https://www.tutorialspoint.com/adders-and-subtractors-in-
digital-electronics

SREERAJ K. P., LR. IN EC 142


6047 – Simulation Lab with Numerical Software Semester 6

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 143


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 19 Date:


4:1 MULTIPLEXER & 1:4 DEMULTIPLEXER

PRACTICAL SIGNIFICANCE
The 4:1 multiplexer holds practical significance in data routing by selecting one of
four input lines based on a two-bit control signal, allowing for efficient data handling in
various applications like digital communication systems. In MATLAB Simulink,
implementing this multiplexer enables the simulation and analysis of complex systems,
showcasing its role in signal processing and control. Conversely, the 1:4 multiplexer operates
by selecting one of four outputs based on a single select input, facilitating tasks such as data
demultiplexing and control signal generation in digital circuits, which can also be effectively
modelled and studied within MATLAB Simulink for system design and analysis purposes.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.
PRACTICAL OUTCOME
Develop a model for multiplexer and demultiplexer.
THEORY
A multiplexer (Mux) is a device that allows digital information from several sources to be
routed on to a single line for transmission over that line to a common destination. The basic
multiplexer has several data input lines (D0, D1,…,Dn-1) and single output line(Y). It has also
data select inputs (S0, S1,…,Sm-1) which permits digital data on any one input to be switched
to the output line. Multiplexers are also known as Data Selectors. The select lines m and the
input lines n are related by the formula: 2m = n.

SREERAJ K. P., LR. IN EC 144


6047 – Simulation Lab with Numerical Software Semester 6

4:1 Multiplexer
A 4-to-1 multiplexer consists of four data inputs D0 through D3, two input select lines
S1 through S0 and a single output line Y. Depending on the select lines combinations,
multiplexer decodes the inputs.
Fig 19.1 shows the block diagram of a 4:1 multiplexer with Enable input pin which
enable or disable the multiplexer. Since the number data bits given to the MUX are four then
2 bits (22=4) are needed to select one of the four data bits.

Fig 19.1 (a) Block diagram of mux (b) Logical diagram of mux

The truth table for a 4-to-1 multiplexer is given below with eight combinations of inputs so as
to generate each output corresponds to input.

Enable Select Lines Output


E S1 S0 Y
0 X X 0
1 0 0 D0
1 0 1 D1
1 1 0 D2
1 1 1 D3

Demultiplexer
A Demultiplexer is a data distributor read as DEMUX. It is opposite to multiplexer or
MUX. It is a process of taking information from one input and transmitting over one of many
outputs.
1:4 Demultiplexer
The block diagram of a 1: 4 Demux having only one data input I and four outputs. It
has two select lines S0, S1 which are used as the control signals. There is a strobe input E
which is active low. The data bit at input I is transferred to one of the eight outputs depending
upon the states of the select lines.

SREERAJ K. P., LR. IN EC 145


6047 – Simulation Lab with Numerical Software Semester 6

Fig 19.2 (a) Block diagram of demux (b) Logical diagram of demux

Data Input Select Lines Outputs


I S1 S0 Y3 Y2 Y1 Y0
I 0 0 0 0 0 I
I 0 1 0 0 I 0
I 1 0 0 I 0 0
I 1 1 I 0 0 0

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Sinks library (the Scope block).
Logical design block
5. Construct the model as shown in figure with blocks and links to connect them.
6. Select the switches to switch between 0 and 1 to set the value of input(Ds) and select
lines(S0, S1).
7. Verify the truth table from the output obtained in the display.

SREERAJ K. P., LR. IN EC 146


6047 – Simulation Lab with Numerical Software Semester 6

SIMULINK MODEL FOR SIMULATION

4:1 Multiplexer

1:4 Demultiplexer

SREERAJ K. P., LR. IN EC 147


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT
4:1 Multiplexer

Select Lines Output


S1 S0 Y
X X 0
0 0 D0
0 1 D1
1 0 D2
1 1 D3

1:4 Demultiplexer

Data Input Select Lines Outputs


I S1 S0 Y3 Y2 Y1 Y0
I 0 0 0 0 0 I
I 0 1 0 0 I 0
I 1 0 0 I 0 0
I 1 1 I 0 0 0

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
PROBLEM STATEMENT – TO BE SOLVED BY STUDENT
1. Create a Simulink model of a 4:1 multiplexer using two 2:1 multiplexers.
2. Create a Simulink model of a 8:1 multiplexer using basic gates.

PRACTICAL RELATED QUESTIONS


1. Explain the purpose of a multiplexer in digital electronics. How does it differ from a

SREERAJ K. P., LR. IN EC 148


6047 – Simulation Lab with Numerical Software Semester 6

demultiplexer?
2. What are the key advantages of using a multiplexer in digital circuits? Provide at least
three advantages.
3. Discuss the practical applications of multiplexers and demultiplexers in real-world
scenarios or industries.
4. How does a multiplexer differ from a decoder? Discuss their functionalities and
provide examples where each would be more suitable.

REFERENCES

Sl. Text
Autho
No Book/ Publication
r
. Website
 https://youtu.be/FGWsievcnEw
Web  https://www.gyaanibuddy.com/assignments/assignment-detail/41-
multiplexer-1-4-de-multiplexer/
1 referenc
 https://www.tutorialspoint.com/digital_circuits/digital_circuits_demul
es tiplexers.htm
 https://www.electronicshub.org/multiplexer-and-demultiplexer/

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 149


6047 – Simulation Lab with Numerical Software Semester 6

Experiment no.: 20 Date:


FLIPFLOPS

PRACTICAL SIGNIFICANCE
Implementing flip-flops using MATLAB holds practical significance in digital circuit
design and analysis. Firstly, MATLAB provides a platform for simulating and verifying flip-
flop behavior, aiding engineers in understanding and optimizing sequential logic circuits.
Secondly, it facilitates the exploration of different flip-flop configurations and their impact on
system performance, allowing for efficient design iterations. Thirdly, MATLAB enables the
visualization of timing diagrams and waveforms, aiding in the identification and resolution of
potential timing issues in flip-flop-based designs. Lastly, the use of MATLAB in flip-flop
implementation accelerates the development process, reducing prototyping time and
contributing to the overall efficiency of digital system design.
RELEVANT PROGRAM OUTCOMES(POS)
PO1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics,
science and engineering fundamentals and engineering specialization to solve the engineering
problems.
PO4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools
and appropriate technique to conduct standard tests and measurements.
PO7. Lifelong Learning: Ability to analyse individual needs and engage in updating in the
context of technological changes.
COMPETENCY AND PRACTICAL SKILLS
This practical is expected to develop the following skills for the industry-identified
competency: ‘Use MATLAB for implementing various problems in engineering.”

 To use the MATLAB in implementing of various applications

RELEVANT COURSE OUTCOMES(COS)


 Use MATLAB tool for simulating/implementing given application.

PRACTICAL OUTCOME
Develop a model of D, T and JK Flipflop.
THEORY
JK Flipflop
The JK flip flop is one of the most used flip flops in digital circuits. The JK flip flop is a
universal flip flop having two inputs 'J' and 'K'. The only difference between JK flip flop and

SREERAJ K. P., LR. IN EC 150


6047 – Simulation Lab with Numerical Software Semester 6

SR flip flop is that when both inputs of SR flip flop is set to 1, the circuit produces the invalid
states as outputs, but in case of JK flip flop, there are no invalid states even if both 'J' and 'K'
flip flops are set to 1.

Fig 20.1 (a) JK flip flop block diagram (b) JK flip flop using NAND

Fig 20.2 Truth table for JK FF

When both of the inputs of JK flip flop are set to 1 and clock input is also pulse "High" then
from the SET state to a RESET state, the circuit will be toggled. The JK flip flop work as a T-
type toggle flip flop when both of its inputs are set to 1.
The JK flip flop is an improved clocked SR flip flop. But it still suffers from the "race"
problem. This problem occurs when the state of the output Q is changed before the clock
input's timing pulse has time to go "Off". We have to keep short timing plus period (T) for
avoiding this period. Fig 20.2 Truth table for JK flip flop.
D Flip Flop

SREERAJ K. P., LR. IN EC 151


6047 – Simulation Lab with Numerical Software Semester 6

Fig 20.3 Logical diagram and truth table for D FF

T flipflop

Fig 20.3 Logical diagram and truth table for T FF

RESOURCES REQUIRED

Sl. No. Name of resource Suggested Specification Quantity


1 Desktop PC Loaded with open-source EDA tool (VHDL) 1 no.
2 MATLAB 2014a onwards 1 no.

PROCEDURE
1. To start Simulink, you must start the MATLAB first
2. Now open the Simulink, by clicking on Simulink Icon
3. To create a new model, click the New Model button on the Library Browser’s toolbar.
4. To create the model, you need to drag and drop required blocks into the model from
the following Simulink block libraries:
Sources library (the Sine Wave block)
Sinks library (the Scope block).
Logical design block
5. Construct the model as shown in figure with blocks and links to connect them.
6. Select the switches to switch between 0 and 1 to set the value of inputs.
7. Verify the truth table from the output obtained in the display.

SREERAJ K. P., LR. IN EC 152


6047 – Simulation Lab with Numerical Software Semester 6

SIMULINK MODEL FOR SIMULATION

JK, D and T flip flops

SREERAJ K. P., LR. IN EC 153


6047 – Simulation Lab with Numerical Software Semester 6

OUTPUT
JK flip flop

J K Qn Qn+1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
D flip flop

D Qn Qn+1
0 0 0
0 1 0
1 0 1
1 1 1
T flip flop

T Qn Qn+1
0 0 0
0 1 1
1 0 1
1 1 0

RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
INTERPRETATION OF RESULTS
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
CONCLUSION
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

SREERAJ K. P., LR. IN EC 154


6047 – Simulation Lab with Numerical Software Semester 6

PROBLEM STATEMENT – TO BE SOLVED BY STUDENT


1. Create a Simulink model for a 4-bit shift register using D flipflop.

PRACTICAL RELATED QUESTIONS


1. Explain the purpose of using flip-flops in digital circuits. How do they differ from
other sequential logic elements?
2. Explain the difference between synchronous and asynchronous reset in flip-flops.

REFERENCES

Sl. Text
Autho
No Book/ Publication
r
. Website
Web  https://www.geeksforgeeks.org/flip-flop-types-their-conversion-and-
applications/
1 referenc
 https://www.tutorialspoint.com/digital_circuits/digital_circuits_flip_f
es lops.htm

ASSESSMENT SCHEME
Performance indicators Weightage
Process related (27 marks) 60%
1 Coding ability 20%
2 Debugging ability 30%
3 Follow ethical practices 10%
Product related (18 marks) 40%
1 Relevance of output of the problem definition. 20%
2 Timely Submission of report, Answer to sample questions. 20%
Total (37.5 marks) 100%

SREERAJ K. P., LR. IN EC 155

You might also like