0% found this document useful (0 votes)
13 views83 pages

JNTUA Simulation Lab Manual R20 - 1

The Simulation Lab Manual for the Department of Electronics & Communication Engineering at Vemu Institute of Technology outlines the vision and mission of the institute and department, along with program educational objectives and outcomes. It details various experiments to be conducted using MATLAB, including signal generation, Fourier analysis, and filter response, along with guidelines for laboratory conduct and evaluation criteria. Additionally, it introduces MATLAB as a powerful tool for technical computing and simulation, emphasizing its importance in engineering education.

Uploaded by

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

JNTUA Simulation Lab Manual R20 - 1

The Simulation Lab Manual for the Department of Electronics & Communication Engineering at Vemu Institute of Technology outlines the vision and mission of the institute and department, along with program educational objectives and outcomes. It details various experiments to be conducted using MATLAB, including signal generation, Fourier analysis, and filter response, along with guidelines for laboratory conduct and evaluation criteria. Additionally, it introduces MATLAB as a powerful tool for technical computing and simulation, emphasizing its importance in engineering education.

Uploaded by

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

www.android.universityupdates.in | www.universityupdates.in | https://telegram.

me/jntua

SIMULATION LAB MANUAL

Department of Electronics & Communication Engineering

VEMU INSTITUTE OF TECHNOLOGY::P.KOTHAKOTA


NEAR PAKALA, CHITTOOR-517112
(Approved by AICTE, New Delhi & Affiliated to JNTUA, Anantapuramu)
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

SIMULATION LAB MANUAL

Name:

H.T.No:

Year/Semester:_
Department of Electronics & Communication Engineering
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

VEMU Institute of Technology


Dept. of Electronics and Communication Engineering

Vision of the Institute


To be one of the premier institutes for professional education producing dynamic
and vibrant force of technocrats with competent skills, innovative ideas and leadership qualities
to serve the society with ethical and benevolent approach.
Mission of the Institute
Mission_1: To create a learning environment with state-of-the art infrastructure, well equipped
laboratories, research facilities and qualified senior faculty to impart high quality technical
education.
Mission_2: To facilitate the learners to inculcate competent research skills and innovative ideas
by Industry-Institute Interaction.
Mission_3: To develop hard work, honesty, leadership qualities and sense of direction in
learners by providing value based education.

Vision of the Department


To develop as a center of excellence in the Electronics and Communication
Engineering field and produce graduates with Technical Skills, Competency, Quality, and
Professional Ethics to meet the challenges of the Industry and evolving Society.
Mission of the Department
Mission_1: To enrich Technical Skills of students through Effective Teaching and Learning
practices to exchange ideas and dissemination of knowledge.
Mission_2: To enable students to develop skill sets through adequate facilities, training on core
and multidisciplinary technologies and Competency Enhancement Programs.
Mission_3: To provide training, instill creative thinking and research attitude to the students
through Industry-Institute Interaction along with Professional Ethics and values.

Programme Educational Objectives (PEOs)

PEO 1: To prepare the graduates to be able to plan, analyze and provide innovative ideas to
investigate complex engineering problems of industry in the field of Electronics and
Communication Engineering using contemporary design and simulation tools.

PEO-2: To provide students with solid fundamentals in core and multidisciplinary domain for
successful implementation of engineering products and also to pursue higher studies.

PEO-3: To inculcate learners with professional and ethical attitude, effective communication
skills, teamwork skills, and an ability to relate engineering issues to broader social context at
work place
www.android.universityupdates.in | www.universityupdates.in |

Programme Outcomes (Pos)

PO_1 Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering problems.
PO_2 Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
PO_3 Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
PO_4 Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
PO_5 Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.
PO_6 The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO_7 Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.
PO_8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO_9 Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO_10 Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
PO_11 Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
PO_12 Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.

Programme Specific Outcome (PSOs)

Electronic System Design/Analysis: Apply the fundamental concepts of Electronics and


Communication Engineering to design and analysis of Electronics Systems for applications
PSO_1
including Signal Processing, Communication & Networking, Embedded Systems, VLSI design and
Control Systems etc.,
Software Tools: Proficiency in specialized software tools and computer programming useful for
PSO_2 the design and analysis of complex electronic systems to meet challenges in contemporary
business environment.
www.android.universityupdates.in | www.universityupdates.in |
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY ANANTAPUR

II B.Tech. I-Sem (ECE)


(20A04301P) SIMULATION LAB
Understand the basic concepts of programming in MATLAB and explain use of built-in
C216.1 Functions to perform assigned task.
C216.2 Generate signals and sequences, Input signals to the systems to perform various operations.
C216.3 Analyze signals using Fourier, Laplace and Z-Transforms.
C216.4 Compute Fourier transform of a given signal and plot its magnitude and phase spectrum.
Verify Sampling theorem, Determine Convolution and Correlation between signals and
C216.5 Sequences.
List of Experiments:

1. Write a program to generate various Signals and Sequences: Periodic and Aperiodic,
Unit Impulse, Unit Step, Square, Saw tooth, Triangular, Sinusoidal, Ramp, Sinc function.
2. Perform operations on Signals and Sequences: Addition, Multiplication,
Scaling, Shifting, Folding, Computation of Energy and Average Power.
3. Write a program to find the trigonometric & exponential Fourier series coefficients of
a rectangular periodic signal. Reconstruct the signal by combining the Fourier series
coefficients with appropriate weightages- Plot the discrete spectrum of the signal.
4. Write a program to find Fourier transform of a given signal. Plot its amplitude and
phase spectrum.
5. Write a program to convolve two discrete time sequences. Plot all the sequences.
6. Write a program to find autocorrelation and cross correlation of given sequences.
7. Write a program to verify Linearity and Time Invariance properties of a
given Continuous/Discrete System.
8. Write a program to generate discrete time sequence by sampling a continuous
time signal. Show that with sampling rates less than Nyquist rate, aliasing occurs
while reconstructing the signal.
9. Write a program to find magnitude and phase response of first order low pass and
high pass filter. Plot the responses in logarithmic scale.
10. Write a program to find response of a low pass filter and high pass filter, when a
speech signal is passed through these filters.
11. Write a program to generate Complex Gaussian noise and find its mean,
variance, Probability Density Function (PDF) and Power Spectral Density (PSD).
12. Generate a Random data (with bipolar) for a given data rate (say 10kbps). Plot the
same for a time period of 0.2 sec.
13. To plot pole-zero diagram in S-plane/Z-plane of given signal/sequence and verify
its stability.

Note: All the experiments are to be simulated using MATLAB or equivalent software.
www.android.universityupdates.in | www.universityupdates.in |
VEMU INSTITUTE OF
TECHNOLOGY::P.KOTHAKOTA NEAR
PAKALA, CHITTOOR-517112
(Approved by AICTE, New Delhi & Affiliated to JNTUA, Anantapur)
Department of Electronics &Communication Engineering
(20A04301P) SIMULATION LAB II B.Tech– I SEM
LIST OF EXPERIMENTS TO BE CONDUCTED
1. Generation of Various Signals and Sequences.

2. Operations on Signals and Sequences.

3. (a) Trigonometric Fourier series.


(b) Exponential Fourier series.

4. Magnitude and Phase Spectrum of Fourier Transforms.

5. Convolution of Two Sequences.

6. Auto Correlation & Cross – Correlation.


7. (a)Linear System or Non –Linear System.

(b)Time- Invariant or Time- Variant System.

8. Sampling Theorem.

9. Low Pass Filter &High Pass Filter.

10. Speech Signal.

11. Gaussian Noise.

12. Random Bipolar Data Generation.

13. Zeros and Poles in S-Plane and Z-Plane.

ADDITIONAL EXPERIMENTS (BEYOND CURRICULUM)

1. GIBB’S Phenomenon.

2. Spectral Analysis of Composite (Added and Multiplied) Signals.


www.android.universityupdates.in | www.universityupdates.in |

CONTENTS

S. NO. NAME OF THE EXPERIMENT PAGE NO

1. Generation of Various Signals And Sequences

2. Operations on Signals and Sequences

3. (a)Trigonometric Fourier series


(b)Exponential Fourier Series
4. Magnitude and Phase Spectrum of Fourier Transforms

5. Convolution of Two Sequences

6. Auto Correlation & Cross - Correlation


(a)Linear System or Non –Linear System
7. (b)Time- Invariant or Time- Variant System

8. Sampling Theorem

9. Low Pass Filter &High Pass Filter

10. Speech Signal

11. Gaussian Noise

12. Random Bipolar Data Generation

13. Zeros and Poles in S-Plane and Z-Plane

Additional Experiments (Beyond Curriculum)


14. GIBB’S Phenomenon

15. Spectral Analysis of Composite (Added and Multiplied) Signals


www.android.universityupdates.in | www.universityupdates.in |

DOs & DON’Ts IN LABORATORY

DO'S
1. Read and understand how to carry out experiment thoroughly before coming to
the Lab.
2. Students should come to the lab in-time
3. It is mandatory to come to lab in a formal dress (Shirts, Trousers, ID card, and
Shoes for Boys - Chudidhar for Girls). Strictly no Jeans for both Girls and Boys.
4. It is mandatory to come with observation book and lab record in which previous
experiment should be written in record and the present lab's experiment in
observation book
5. Observation book of the present lab experiment should be get corrected on the
same day and Record should be corrected on the next scheduled lab session.
6.Bring all the required stationery like graph sheets, pencil & eraser, different color pens
etc.
7. Any failure / malfunction of PC must be reported to the faculty.
8. After completing your lab session SHUTDOWN the Systems, TURNOFF the
power switches and arrange the chairs properly.
DON'Ts
1. Do not eat food, drink beverages or chew gum in the laboratory.
2. Late corners are not allowed to enter the Laboratory.
3. Don't talk aloud or crack jokes in Laboratory.
4. Do not open any irrelevant sites on computer.
5. Do not use a flash drive on computers.
6. Do not upload, delete or alter any software on the computer.
7. Do not remove anything from the computer Laboratory without permission.
www.android.universityupdates.in | www.universityupdates.in |

SCHEME OF EVALUATION

Marks Awarded
Total
S.No Program Date Record Obs. Viva Attd. 30(M)
(10M) (10M) (5M) (5M)
1. Generation of Various Signals and Sequences
2. Operations on Signals and Sequences

3. (a)Trigonometric Fourier Series


(b)Exponential Fourier Series
4. Magnitude and Phase Spectrum of Fourier
Transforms
5. Convolution of Two Sequences
6. Auto Correlation & Cross - Correlation
(a)Linear System or Non –Linear System
7. (b)Time-Invariant or Time-variant System

8. Sampling Theorem

9. Low Pass Filter &High Pass Filter


10. Speech Signal
11. Gaussian Noise
12. Random Bipolar Data Generation
13. Zeros and Poles in S-Plane and Z-Plane
Additional Experiments (Beyond Curriculum)
14. GIBB’S Phenomenon
15. Spectral Analysis of Composite (Added and
Multiplied) Signals

Signature of Lab In-charge


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

INTRODUCTION TO MATLAB
INTRODUCTION:

1. MATLAB is a mathematical software package which is used extensively in academia


and industry.
2. MATLAB stands for Matrix Laboratory
3. It is one of the leading Scientific and Technical computing software, used by many engineers
and scientists.
4. This was developed by CLEVE MOLER, a professor of mathematics and computer science.
5. Over the last two decades MATLAB has evolved into a much powerful and versatile package,
useful for a wide variety of academic, research and industrial applications.

IMPORTANCE OF MATLAB:

1. As a matrix-based system it is great tool for simulation and data analysis.


2. It is simple, powerful and easy to learn programming language as it provides extensive online
help.
3. Unlike other high-level languages like FORTRAN,C, etc., it does not require any variable
declaration and dimension statements at the beginning.
4. MATLAB programs written for solving complex problems take a fraction of time and look
very small in general when compared to the codes of high-level language.
5. It also enables the users to write their own functions for easy customization.
6. It is excellent and very powerful for two- and three-dimensional graphics and animation.
7. It is an indispensable Graphical User Interface(GUI) tool and used for proper understanding of
concepts in advanced subjects like mathematics, signals and systems, control systems, digital
signal processing, VLSI design, etc,.
8. It also provides several optional ‘tool boxes’ such as statistics toolbox, control system
toolbox, signal processing toolbox, etc. where toolbox provides a set of functions written for
specific application.
9. It is compatible, with most operating systems such as windows, Linux, etc.
10. It uses matrix notation it replaces several ‘for’ loops which are usually found in C type of
codes.

GETTING STARTED WITH MATLAB:

 LAUNCHING MATLAB: If MATLAB is installed on your computer, you can possibly


find the MATLAB icon as a shortcut on your desktop of the windows-based system, after
you login to the computer using your user id and the password.

 MATLAB DESKTOP LAYOUT: When you launch MATLAB for the first time, the
MATLAB desktop appears with a default layout. You can change the desktop
configuration to suits your need.
 THE COMMAND WINDOW: It is the place where you enter all MATLAB commands
at the “command prompt”(>>).MATLAB executes the commands and display the result of
each operation performed.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

 THE COMMAND HISTORY WINDOW: All the commands entered recently at the
command prompt are stored in the “command History” window, for future use, until you
select and delete them purposefully.

 THE CURRENT DIRECTORY WINDOW: It displays the list of all files and folders
under the current directory, which happens to be the ‘work’ sub-directory, by default,
under the MATLAB root directory.

 CHANGING THE CURRENT DIRECTORY: A new directory called ‘set path’


window shows all directories and subdirectories which are visible to MATLAB.

1. Click on ‘add folder’. A new window called ‘Browser for Folder’


2. Click on up or down arrow buttons until the ‘E’ drive appears, select it by clicking
once on it.
3. Click on ‘Make New Folder ‘and ‘slab’ in the ‘folder’ window and say OK
4. The set path window now should look like the one that the new directory is added to
the MATLAB search path.
5. Click on ‘save’ and then ‘close’
6. Type cd E:\slab at the command prompt and press ’Enter’ and can start creating new
files

 MATLAB EDITOR AND DEBUGGER :

1. Create a new file called a ‘.m’, into which the MATLAB commands, comments and
the data can be entered.
2. Edit all that is written into the file using the usual commands such as cut, copy, etc.,
3. Import data such as ASCII text or a huge matrix, from an external environment in to
the file.
4. Save the file in a chosen directory.
5. Debug the MATLAB commands by running the program either line in a step mode or
run a portion of the program by setting break points.
6. Open an existing .m file for a possible modification.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp:1 (a) Date:

GENERATION OF CONTINUOUS SIGNALS

AIM: To write a MATLAB Program to generate Continuous Time Signals such as unit step saw
tooth, triangular, sinusoidal, ramp, and sinc function.

SOFTWARE REQURIED :

MATLAB (2019b 9.7version) Software


.
PROCEDURE:-
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:-

clc;
clear all;
close
all;
t=-10:0.01:10;
L=length(t);
for i=1:L
%to generate unit Step and ramp
function if t(i)<0
x1(i)=0;
x2(i)=0;
else
x1(i)=1;
x2(i)=t(i);
end;
end;
%to generate sinusoidal function
f=0.1;
x3=sin(2*pi*f*t);
%to generate Triangular and Sawtooth
waveforms x4=sawtooth(t,0.5);
x5=sawtooth(t);

%to generate sinc


function x6=sinc(t);
figure;
subplot(2,3,1);
plot(t,x1);
xlabel('t--->');ylabel('amp--->');
title('unit step');
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

subplot(2,3,2);
plot(t,x2);
xlabel('t--->');ylabel('amp--->');
title('unit ramp');
subplot(2,3,3);
plot(t,x3);
xlabel('t--->');ylabel('amp--->');
title('sinusoidal');
subplot(2,3,4);
plot(t,x4);
xlabel('t--->');ylabel('amp--->');
title('triangular');
subplot(2,3,5);
plot(t,x5);
xlabel('t--->');ylabel('amp--->');
title('sawtooth');
subplot(2,3,6);
plot(t,x6);
xlabel('t--->');ylabel('amp--->');
title('sinc function');
OUTPUT WAVEFORMS:

RESULT:
Hence MATLAB program written and executed successfully to generate of continuous
time signals such as unit step, saw tooth, triangular, sinusoidal, and ramp and sinc function.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 1(b) Date:


GENERATION OF DISCRETE SIGNALS
AIM: To write a MATLAB Program to generate Discrete Time Signals such as unit impulse, unit
step, unit ramp, exponential and sinusoidal signals.

SOFTWARE REQURIED :

MATLAB (2019b 9.7version) Software

PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:
clc;
clear all;
close
all;
n=-10:1:10;
L=length(n);
for i=1:L
if n(i)==0
x1(i)=1;
else
x1(i)=0;
end;
if n(i)>=0
x2(i)=1;
x3(i)=n(i);
else
x2(i)=0;
x3(i)=0;
end;
end;
% to generate exponential
sequence a=0.85;
x4=a.^n;
% to generate sinusoidal sequence
f=0.1;
x5=sin(2*pi*f*n);
figure;
subplot(3,2,1);
stem(n,x1);
xlabel('time n---->');
ylabel('amplitude---->');
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

title('Unit impulse signal');


subplot(3,2,2);
stem(n,x2);xlabel('time n---->');
ylabel('amplitude---->');
title('Unit step signal')
subplot(3,2,3);
stem(n,x3);
xlabel('time n---->');
ylabel('amplitude---->');
title('Unit ramp signal');
subplot(3,2,4);
stem(n,x4);
xlabel('time n---->');
ylabel('amplitude---->');
title('exponential signal');
subplot(3,2,[5,6]);
stem(n,x5);
xlabel('time n---->');
ylabel('amplitude---->');
title('sinusoidal signal');

OUTPUT WAVEFORMS:-

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULT:
Hence MATLAB program written and executed successfully to generate of discrete time
signals such as unit impulse, unit step, and unit ramp, exponential and sinusoidal signals.

CONCLUSION:

1.

2.

VIVA -VOCE QUESTIONS:


1. Define a signal?
2. Write the Classification of Signals?
3. What difference between Continuous Time Signal and Discrete Time Signal?
4. What is difference Digital and Discrete Time Signal?
5. Write steps involved in converting analog in to digital signal?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 2 (a) Date:


OPERATIONS ON SIGNALS
COMPUTATION OF ENERGY AND AVERAGE POWER
AIM: To perform various operations on signals such as addition, multiplication, Scaling, shifting and
folding, computation of energy and average power using MATLAB program.

SOFTWARE REQURIED :

MATLAB (2019b 9.7version) Software


.
PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:

clc,
close all;
clear all;
t=0:0.001:1;
L=length(t);
f1=1;
f2=3;
x1=sin(2*pi*f1*t);
x2=sin(2*pi*f2*t);
figure(' Name ', ' operationd on signals ')
subplot(3,2,1);
plot(t,x1,'b',t,x2,'r');
xlabel('time t---->');
ylabel('amplitude---->');
title('the signals x1(t) and x2(t)');
x3=x1+x2;
subplot(3,2,2);
plot(t,x3);
xlabel('time t---->');
ylabel('amplitude---->');
title('the sum of x1(t) and x2(t)');
x4=x1.*x2;
subplot(3,2,3);
plot(t,x4); xlabel('time t---->');
ylabel('amplitude---->');
title('the multiplication of x1(t) and x2(t)');
a=2;
y1=a*x1;

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

subplot(3,2,4);
plot(t,y1);
xlabel('time t---->');
ylabel('amplitude---->');
title('the scaling of x1signal);
t=-1:0.001:0;
x5=sin(2*pi*f1*(-t));
x6=sin(2*pi*f2*(-t));
subplot(3,2,5);
plot(t,x5,'b',t,x6,'r');
xlabel('time t---->');
ylabel('amplitude---->');
title('the folding of x1(t)and x2(t)');
x7=[zeros(1,200),x2(1:(L-200))];
subplot(3,2,6);
plot(t,x7);
xlabel('time t---->');
ylabel('amplitude---->');
title('the shifting of x1(t)and x2(t)');
%program for Energy of a
signal t=0:pi:10*pi;
z2=cos(2*pi*50*t).^2;
E=sum(abs(z2).^2);disp('Energy of given signal is');E
% program for Power of a signal
P=(sum(abs(z2).^2))/length(z2);
disp('Power of given signal
is');P

OUTPUT WAVEFORMS:
Energy of given signal

is E = 4.0388

Power of given signal

is P =0.3672

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULT:
Hence the various operations on signal such as addition, multiplication, scaling ,shifting
and folding, computation of energy and average power using MATLAB program was completed
successfully.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 2 (b) Date:


OPERATIONS ON SEQUENCES
COMPUTATION OF ENERGY AND AVERAGE POWER
AIM: To perform various operations on sequences such as addition, multiplication, Scaling, shifting
and folding, computation of energy and average power using MATLAB program.

SOFTWARE REQURIED :

MATLAB (2019b 9.7version) Software


.
PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:
clc;
clear all;
close
all;
s1=input('Enter the Sequence 1: '); %Both s1 and s2 sequences are same length
n=0:length(s1) -1;
s2=input('Enter the Sequence 2: ');
subplot(2,2,1); stem(n,s1); xlabel('samples'); ylabel('amplitude'); title('first sequence');
subplot(2,2,2);stem(n,s2); xlabel('samples'); ylabel('amplitude');
title('second sequence');
s3=s1+s2; % Sum
subplot(2,2,3);stem(n,s3); xlabel('samples'); ylabel('amplitude');
title('sum of the sequences');
s4=s1.*s2; % Multiplication
subplot(2,2,4);stem(n,s4); xlabel('samples'); ylabel('amplitude');
title('multiplication of sequences');
figure;
subplot(3,2,[1,2]); stem(n,s1); xlabel('samples'); ylabel('amplitude'); title('first sequence');
s5=3*s1 ;% Amplitude Scaling
s6=s1/3 ;% Signal attenuation
subplot(3,2,3) ; stem(n,s5) ; xlabel('samples'); ylabel('amplitude');
title('Amplitude Scaled');
subplot(3,2,4) ; stem(n,s6) ; xlabel('samples'); ylabel('amplitude');title('Attenuated ') ;
s7=upsample(s1,2); % Signal Exapansion
s8=downsample(s1,3); % Signal Compression
n1 = 0:length(s7)-1;
n2 = 0:length(s8)-1;
subplot(3,2,5) ; stem(n1,s7) ; xlabel('samples'); ylabel('amplitude'); title(' Enlarged ')
subplot(3,2,6) ; stem(n2,s8) ; xlabel('samples'); ylabel('amplitude');
title('Compressed ')
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

figure;
subplot(2,2,1); stem(n,s1); xlabel('samples'); ylabel('amplitude'); title('first sequence');
n3=n+2; % delaying by 2
n4=n-3; % advanced by 3
s9=fliplr(s1);
n5=fliplr(-n);
subplot(2,2,2) ; stem(n5,s9) ; xlabel('samples'); ylabel('amplitude');
title('time reversed Sequence');
subplot(2,2,3) ; stem(n3,s1) ; xlabel('samples'); ylabel('amplitude');
title('delayed Sequence');
subplot(2,2,4) ; stem(n4,s1) ; xlabel('samples'); ylabel('amplitude');
title('advanced Sequence');
%Energy and Average Power
E = sum(s1.^2);
disp('Energy of given signal
is');E P = sum(s1.^2)/length(s1);
disp('Power of given signal is');P

OUTPUT WAVEFORMS:

Enter the Sequence 1: [1 2 3 4]


Enter the Sequence 2: [1 2 1 2]
Energy of given signal is
E =30
Power of given signal is
P =7.5000

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULT:
Hence the various operations on sequences such as addition, multiplication, scaling,shifting
and folding, computation of energy and average power using MATLAB program was completed
successfully.

CONCULSION:

1.

2.

VIVA -VOCE QUESTIONS:


1. Advance operation can’t be implemented in real time applications?
2. Write the expression for down and up sampling?
3. What is the effect of time reversal on time shifting operation?
4. What is the physical meaning of integration and difference operation?
5. Name the operations which are required to implement discrete time system ?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF E.C.E Page


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 3(a) Date:

TRIGONOMETRIC FOURIER SERIES

AIM: To write a MATLAB program to find the trigonometric Fourier series coefficients of a
rectangular periodic signal. Reconstruct the signal by combining the Fourier series coefficients with
appropriate weightages and also plot the discrete spectrum of the signal.
SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software

PROCEDURE:

 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:
clc
clear all
close
all
%% generation of periodic signal (time period axis etc)
T = 4; %time period (can be user defined)
w = (2*pi)/T;
t = -1:0.01:1;
N = 10; %number of harmonics (can be user
defined) n=1:N; %discrete axis
%% signals - choose 1 and comment other!
y = @(t)square(w.*t);
%% computation of a0,an and bn i.e trigonometric coeffecients
a0 = (1/T)*integral(y,0,T,'ArrayValued',true);
w = (2*pi)/T;
n = 1:N;
mul = @(t)cos(n'*w.*t);
mul2 = @(t)sin(n'*w.*t);
sig1 = @(t)y(t).*mul(t);
sig2=@(t)y(t).*mul2(t);
a = (2/T).*integral(sig1,0,T,'ArrayValued',true); %integral function takes function handles only
b = (2/T).*integral(sig2,0,T,'ArrayValued',true);
fphas=angle(a);
fphas1=angle(b);
%% Reconstruction of trigonometric
F.S z1=0;
w = (2*pi)/T;
for k = 1:N
z1 = z1 + a(k)*cos(k*w.*t)+b(k)*sin(k*w.*t);
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

end
z = a0 + z1;
err = immse(y(t),z);
%% plot figures
figure('Name','F.S trigonometric Series and
reconstruction') subplot(3,2,1);
stem(n,a);
title('Magnitude of an');
xlabel('Discrete axis');
ylabel('Magnitude');
subplot(3,2,2);
stem(n,b);
title('Magnitude of
bn'); xlabel('Discrete
axis');
ylabel('Magnitude');
subplot(3,2,3)
stem(n,fphas);
title('Phase of an');
xlabel('Discrete axis');
ylabel('Phase');
subplot(3,2,4)
stem(n,fphas1);
title('Phase of bn');
xlabel('Discrete axis');
ylabel('Phase');
subplot(3,2,5);
plot(t,y(t),'linewidth',2);
title('Original signal');
xlabel('Time axis');
ylabel('Amplitude');
subplot(3,2,6);
plot(t,z,'linewidth',2);
title('reconstructed signal');
xlabel('Time axis');
ylabel('Amplitude');

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

OUTPUT WAVEFORMS:

RESULT:
Hence the trigonometric Fourier series coefficients of a rectangular periodic signal using
MATLAB program was completed successfully.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 3(b) Date:

EXPONENTIAL FOURIER SERIES


AIM: To write a MATLAB program to find the Exponential Fourier series coefficients of a
rectangular periodic signal. Reconstruct the signal by combining the Fourier series coefficients with
appropriate weightages and also Plot the discrete spectrum of the signal.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:

 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For output see command window/figure window.
PROGRAM:
clc
clear all
close
all
%% generation of periodic sequence (time period axis etc)
T = 4; %time period (can be user defined)
w = (2*pi)/T;
t = -5:0.01:5;
N = 70; %number of harmonics (can be user
defined) n=1:N; %discrete axis
%% signals - choose 1 and comment other!
y = @(t)square(w.*t);
%% Calculation of Exponential Fourier Series Coefficients
w = (2*pi)/T;
n = 1:N;
C0 = (1/T).*integral(y,0,T,'ArrayValued',true);
mul = @(t)exp(-1j*n'*w.*t);
mul2 = @(t)exp(1j*n'*w.*t);
sig = @(t)y(t).*mul(t);
sig2 = @(t)y(t).*mul2(t);
Cn = (1/T).*integral(sig,0,T,'ArrayValued',true);
Cn_neg = (1/T).*integral(sig2,0,T,'ArrayValued',true);
fphas=angle(Cn);
fphas1=angle(Cn_neg);
%% reconstruction as per the series with doubling for complex values (amplitude)
w = (2*pi)/T;
z1 = 0;
for k = 1:N
z1 = z1 + Cn(k).*exp(1j*k*w.*t);
end
z_com = z1 + C0;
z_com = z_com*2;

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

%% checks if signal has any negative


cycles if y(t) >=0
z_f = real(z_com) - C0;
else
z_f =
z_com; end
%% mean square error computation
err_com = immse(y(t),real(z_f));
figure('Name','Complex F.S coeffecients and reconstruction');
subplot(3,2,1);
stem(n,abs(Cn));
title('Amplitude spectrum Cn');
xlabel('Discrete axis');
ylabel('Magnitude');
subplot(3,2,2);
stem(n,fphas);
title('Phase of Cn');
xlabel('Discrete axis');
ylabel('Phase');
subplot(3,2,3);
stem(n,abs(Cn_neg));
title('Amplitude spectrum Cn_neg');
xlabel('Discrete axis');
ylabel('Magnitude');
subplot(3,2,4);
stem(n,fphas1);
title('Phase of Cn_neg');
xlabel('Discrete axis');
ylabel('Phase');
subplot(3,2,5);
plot(t,y(t),'linewidth',2);
title('Original signal');
xlabel('Time axis');
ylabel('Amplitude');
subplot(3,2,6);
plot(t,real(z_f),'linewidth',2);
title('reconstructed signal');
xlabel('Time axis');
ylabel('Amplitude');

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

OUTPUT WAVEFORMS:

RESULT: Hence the Exponential Fourier series coefficients of a rectangular Periodic signal using
MATLAB program was completed successfully.

CONCLUSION:

1.

2.

VIVA -VOCE QUESTIONS:


1. What is Fourier series expansion of Signals?
2. List out the diritchlets conditions
3. What are the properties of CTFS?
4. How to calculate the Co-efficients in TFS
5. What is the relation between TFS &EFS

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 4 Date:

MAGNITUDE AND PHASE SPECTRUM OF FOURIER TRANSFORMS

AIM: To write a MATLAB program to find Fourier transform of the given signal and to plot its
magnitude and phase spectrum.

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software
. PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:
clc; clear all; close all;
syms t s ;
syms w float;
f=3*exp(-t)*heaviside(t); % given function
F=fourier(f); % to find Fourier
Transform disp('the fourier transform of 3*exp(-t)*u(t)
=');
disp(F); % to display the result in the command
window w=-2*pi:pi/50:2*pi;
F1=subs(F,w); % substitute w in F
function Fmag=abs(F1); % to find
magnitude Fphas=angle(F1); % to find
phase subplot(2,1,1);
plot(w,Fmag);
xlabel('w---->');
ylabel('Magnitude- - ->');
title('Magnitude spectrum');
grid;
subplot(2,1,2);
plot(w,Fphas);
xlabel('w---->');
ylabel('Phase in radians--->');
title('Phase spectrum');
grid;

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

OUTPUT WAVEFORMS:

RESULT:
Hence Fourier transform of given signal was calculated using MATLAB program and also
plotted its magnitude and phase spectrum successfully .

The Fourier transform of 3*exp (-t)*u (t)

=3/(1+i*w) Magnitude Spectrum

Phase Spectrum

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

CONCLUSION:

1.

2.

VIVA -VOCE QUESTIONS:

1. Write Fourier Transform Pairs?


2. Write all properties of Fourier Transform?
3. What is the difference between Fourier Transform and Fourier Series?
4. What is the significance of Time Multiplication property of FT?
5. Explain the physical meaning of Magnitude and Phase Spectrum?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF E.C.E Page


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 5 Date:

CONVOLUTION OF TWO SEQUENCES

AIM: To write a MATLAB program to find the convolution of two sequences.

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software

.
PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:

clc;
clear all;
close all;
n=0:8;
x1=1;
x2=0;
y1=x1.*(n>=0 & n<=2)+x2.*(n>=2 & n<=8);
subplot(2,2,1);
stem(n,y1);
axis([0 8 0 1.5]);
xlabel('time n---->');
ylabel('amplitude---->');
title('the sequence y1[n]')
y2=x1.*(n>=0 & n<=4)+x2.*(n>=4 & n<=8);
subplot(2,2,2);
stem(n,y2);
axis([0 8 0 1.5]);
xlabel('time n---->');
ylabel('amplitude---->');
title('the sequence y2[n]')
y=conv(y1,y2);
L=length(y);
n=0:L-1;
subplot(2,2,[3,4]);
stem(n,y);
axis([0 10 0 4]);
xlabel('time n---->');
ylabel('amplitude---->');
title('the convolution sequence of y1[n]&y2[n]');

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

OUTPUT WAVEFORMS:

RESULT:
Hence two discrete sequences convolved by using MATLAB program successfully and
plotted the sequences.

CONCULSION:
1.

2.

VIVA -VOCE QUESTIONS:


1. Write the formula for convolution in case of continuous time signal and discrete time signal?
2. Write operations required computing Convolution?
3. How many no. of samples will be there in the convolved signal?
4. Where we use convolution?
5. Write different methods used for computing convolution?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 6 Date:

AUTO-CORRELATION & CROSS-CORRELATION


BETWEEN SEQUENCES AND SIGNALS

AIM: To write a MATLAB program to compute autocorrelation and cross correlation between two
sequences and signals.

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software

.PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window

PROGRAM:
clc; clear all; close all;
% discrete time sequences
x=input(' Enter the first sequence x[n]= ');
y=input('Enter the second sequence y[n]= ');
z1=conv(x,fliplr(x)); % Autocorrelation of x\
z2=conv(x,fliplr(y)); % cross-correlation of x and y
figure('Name','autocorrelation and cross correlation between two sequences ')
subplot(4,1,1);stem(x);ylabel ('Amplitude');xlabel ('n--');title ('x(n) Vs n');
subplot(4,1,2);stem(y);ylabel ('Amplitude');xlabel ('n---');title ('y(n) Vs n');
subplot(4,1,3);stem(z1);ylabel ('Amplitude');xlabel ('n---');
title ('Autocorrelation of x(n)');
subplot(4,1,4);stem(z2);ylabel ('Amplitude');xlabel ('n---');
title ('Cross correlation of x(n) and y(n)');
disp('Autocorrelation of x(n) is');
disp(z1)
disp('Crosscorelation of x(n) and y(n) is');
disp(z2)
% Continuous time signals
t=0:0.01:2;
x=sin(2*pi*t);
y=square(2*pi*3*t);
z1=conv(x,fliplr(x));
z2=conv(x,fliplr(y));
t1=linspace(0,2*max(t),2*length(t)-1);
figure('Name','autocorrelation and cross correlation between two signals ')
subplot(4,1,1); plot(t,x); title('signal 1');axis([0 2 -1.5 1.5])
subplot(4,1,2); plot(t,y); title('signal 2'); axis([0 2 -1.5 1.5])
subplot(4,1,3); plot(t1,z1); title('autocorrelation of signal 1'); axis([0 4 -110 110])
subplot(4,1,4); plot(t1,z2); title('crosscorrelationof signals'); axis([0 4 -30 30])

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

INPUT SEQUENCE:
Enter the first sequence x[n]= [1 2 3 4]
Enter the second sequence y[n]= [1 2 1 2]
Autocorrelation of x(n) is
4 11 20 30 20 11 4

Crosscorelation of x(n) and y(n)


is 2 5 10 16 12 11 4
OUTPUT WAVEFORMS:

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULT:
Hence the auto correlation and cross correlation between sequences and signals were
executed by using MATLAB program successfully.

CONCULSION:

1.

2.

VIVA -VOCE QUESTIONS:


1. Define correlation and write types of correlation.
2. Compare correlation and convolution.
3. Write the formula for Correlation in continuous and discrete signal?
4. What are the applications of Correlation?
5. Under what conditions both convolution and correlation are equal.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 7(a) Date:

LINEAR SYSTEM OR NON-LINEAR SYSTEM

AIM: To write a MATLAB program to verify the given system is linear or non-linear.

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software

PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window
PROGRAM:
clc; clear all; close all;
x1=input('enter the x1[n] sequence='); % [0 2 4 6]
x2=input('enter the x2[n] sequence='); % [3 5 -2 -
5] if length(x1)~=length(x2)
disp(' length of x2 must be equal to the length of x1');
return;
end;
h=input('enter the h[n] sequence=');% [-1 0 -3 -1 2 1]
a=input('enter the constant a= '); % 2
b=input('enter the constant b= '); % 3
y01=conv(a*x1,h);
y02=conv(b*x2,h);
y1=y01+y02;
x=a*x1+b*x2;
y2=conv(x,h);
L=length(x1)+length(h)-1;
n=0:L-1;
subplot(2,1,1);
stem(n,y1);
label('n --->'); label('amp---->');
title('sum of the individual response');
subplot(2,1,2);
stem(n,y2);
xlabel('n --->'); ylabel('amp---->');
title('total response');
if y1==y2
disp('the system is a Linear system');
else
disp('the system is a non-linear system');end;

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

INPUT SEQUENCE:
Enter the x1[n] sequence= [0 2 4 6]
Enter the x2[n] sequence= [3 5 -2 -5]
Enter the h[n] sequence= [-1 0 -3 -1 2 1]
Enter the constant a= 2 & enter the constant b=
3 The system is a linear system

OUTPUT WAVEFORMS:

RESULT:
Hence linear or non-linear property of discrete system was verified successfully by using
MATLAB Program.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 7(b) Date:

TIME-INVARIANT OR TIME-VARIANT SYSTEM

AIM: To write a matlab program to verify the given system is Time –invariant or Time–variant.

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software
PROCEDURE:
 Open MATLAB
 Open new M-file
 Type the program
 Save in current directory
 Compile and Run the program
 For the output see command window\ Figure window
PROGRAM:
clc; clear all; close all;
x=input('enter the sequence x[n]='); %[0 2 3 1 -2 7 3]
h=input('enter the sequence h[n]='); %[4 -5 -11 -3 7 2 6 8 -15]
d=input('enter the positive number for delay d='); % 5
xdn=[zeros(1,d),x]; % delayed input
yn=conv(xdn,h); % output for delayed input
y=conv(x,h); % actual output
ydn=[zeros(1,d),y]; % delayed
output figure;
subplot(2,1,1);
stem(0:length(x)-
1,x);
xlabel('n ---->'),ylabel('amp --->');
title('the sequence x[n] ');
subplot(2,1,2);
stem(0:length(xdn)-1,xdn);
xlabel('n ---->'),ylabel('amp --->');
title('the delayed sequence of x[n] ');
figure;
subplot(2,1,1);
stem(0:length(yn)-
1,yn);
xlabel('n ---->'),ylabel('amp --->');
title('the response of the system to the delayed sequence of x[n] ');
subplot(2,1,2);
stem(0:length(ydn)-1,ydn);
xlabel('n ---->'),ylabel('amp --->');
title('the delayed output sequence ');
if yn==ydn
disp('the given system is a Time-invarient system');
else
disp('the given system is a Time-varient system');
end;

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

INPUT SEQUENCE:
Enter the sequence x[n] = [0 2 3 1 -2 7 3]
Enter the sequence h[n] = [4 -5 -11 -3 7 2 6 8 -15]
Enter the positive number for delay d=5
The given system is a Time-invariant system
OUTPUT WAVEFORMS:

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULT:

Hence time invariant or time variant property of discrete system was verified
successfully by using MATLAB Program.

CONCULSION:

1.

2.

VIVA VOCE QUESTIONS:


1. Classify the discrete time systems.
2. State the principle of superposition.
3. Define an LTI system.
4. Can you really work with time variant systems, in reality?
5. What is impulse response of an LTI system? Explain.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 8 Date:
SAMPLING THEOREM

AIM: To generate a discrete time sequence by sampling a continuous time signal using a
MATLAB Program.

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software

.
PROCEDURE:
 Open MATLAB Software
 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window\ Figure window.

PROGRAM:
clc;
close all;
clear all;
f1=3;
f2=23;
t=-0.4:0.0001:0.4;
x=cos(2*pi*f1*t)+cos(2*pi*f2*t);
figure(1);
plot(t,x,'-.r');
xlabel('time-----');
ylabel('amp---');
title('The original signal');
%case 1:
(fs<2fm)
fs1=1.4*f2;
ts1=1/fs1;
n1=-0.4:ts1:0.4;
xs1=cos(2*pi*f1*n1)+cos(2*pi*f2*n1);

figure(2);
stem(n1,xs1);
hold on;
plot(t,x,'-.r');
hold off;
legend('fs<2fm');
%case 2:
(fs=2fm)
fs2=2*f2;
ts2=1/fs2;
n2=-0.4:ts2:0.4;
xs2=cos(2*pi*f1*n2)+cos(2*pi*f2*n2);
figure(3);
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I
stem(n2,xs2);

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

hold on;
plot(t,x,'-.r');
hold off;
legend('fs=2fm');
%case 3:
(fs>2fm)
fs3=7*f2;
ts3=1/fs3;
n3=-0.4:ts3:0.4;
xs3=cos(2*pi*f1*n3)+cos(2*pi*f2*n3);
figure(4);
stem(n3,xs3);
hold on;
plot(t,x,'-.r');
hold off;
legend('fs>2fm');

OUTPUT WAVEFORMS:

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULTS:-

Hence a discrete time sequence was generated by sampling a continuous time signal by using a
MATLAB Program successfully.

CONCULSION:
1.

2.

VIVA VOCE QUESTIONS:


1. Define sampling theorem for low pass signal.
2. Write different types of sampling?
3. What is aliasing?
4. Find the nyquist sampling rate for x(t) = 4 Cos(2π103t)+ 3 Cos(4π103t)?
5. Find the nyquist sampling rate for x(t) = 4 Cos(2π103t)* Cos(4π103t)?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 9 Date:
IIR BUTTER WORTH LOW PASS & HIGH PASS FILTER

AIM: To write a MATLAB program to find magnitude and phase response of first order IIR Butter
worth low pass and high pass filter. Also plot the responses in logarithmic scale.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:
 Open MATLAB Software
 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window\ Figure window.
PROGRAM:

clc;
clear all;
close
all;
display('enter the iir filter design specifications');
rp=input('enter the pass band ripple:');
rs=input('enter the stop band ripple:');
wp=input('enter the pass band freq:');
ws=input('enter the stop band freq:');
fs=input('enter the sampling freq:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs);
c=input('enter choice filter 1.lpf 2.hpf /n');
if(c==1)
display('frequency response of IIR lpf is:');
[b,a]=butter(n,wn,'low');
end
if(c==2)
display('freq response of IIR hpf IS:');
[b,a]=butter(n,wn,'high');
end
w=0:0.01:pi;
h=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure;
subplot(2,1,1);
plot(w/pi,m);
title('mignitude response of IIR filter is:');
xlabel('(a)normalized frequency-->');
ylabel('gain in db-->');
subplot(2,1,2);
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

plot(w/pi,an);
title('phase response of IIR filter is;');
xlabel('(b) normalized frequency-->');
ylabel('phase in radians-->');

OUTPUT WAVEFORMS:
enter the iir filter design
specifications enter the pass band
ripple:2
enter the stop band ripple:20
enter the pass band freq:1000
enter the stop band freq:2000
enter the sampling freq:5000
enter choice filter 1.lpf 2.hpf /n

LOWPASSFILTER

HIGH PASS FILTER

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULTS: Hence magnitude and phase response of first order IIR Butter worth low pass and high
pass filter was plotted in logarithmic scale by using a MATLAB Program successfully.

CONCULSION:
1.

2.

VIVA VOCE QUESTIONS:

1. Define filter?
2. Name different types of filters?
3. Define 3 db frequency?
4. Define Bandwidth?
5. Define pass band, stop band and transition band?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 10 Date:
SPEECH SIGNAL

AIM: To write a MATLAB program to find response of a low pass filter and high pass filter, when
a speech signal is passed through these filters.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:

 Open MATALB
 Open new M-file
 Type the program
 Save in current directory
 Compile and run the program
 For the output see the command window / figure window

PROGRAM:
clc;clear; close all;
load(fullfile(matlabroot,'examples','signal','strong.mat'))
% soundsc(her,fs), disp('press any key to continue')
% pause
% soundsc(him,fs)
disp('press any key to
continue')
soundsc(her,fs);pause,
x = her';
y=x+.25*rand(1,length(x));
z=y';soundsc(z,fs);pause,
lp=fir1(50,.35,'low');figure,freqz(lp)
lpf=filter(lp,[10 1],y);
soundsc(lpf',fs);pause
hp = fir1(50,.35,'high');figure,freqz(hp)
hpf=filter(hp,3,y);
soundsc(hpf',fs);
figure
subplot(4,1,1);plot(x),title('original "strong" ')
subplot(4,1,2);plot(z),title('noisy signal ')
subplot(4,1,3);plot(lpf'),title('LPF output ')

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

subplot(4,1,4);plot(hpf'),title('HPF output')

OUTPUT WAVEFORMS:
Speech Signal-Saying the Word-“Strong”

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULT:
Hence the response of a low pass filter and high pass filter, when a speech signal is passed
through these filters was executed by using a MATLAB Program successfully.

CONCULSION:

1.

2.

VIVA VOCE QUESTIONS:


1. Definition of speech signal and audio signal?
2. What is frequency range of speech and audio signal?
3. What is Noise?
4. Define Magnitude and Phase Spectrum of filter?
5. What is the Transfer Function?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF E.C.E Page


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 11 Date:
GAUSSIAN NOISE

AIM: To generate a Gaussian noise and to compute its Mean, Mean Square Value, Skew, Kurtosis,
Probability Distribution Function (PDF) and Power Spectral Density (PSD).

SOFTWARE REQURIED :
MATLAB (2019b 9.7version) Software

.
PROCEDURE:
 Open MATLAB Software
 Open new M-file
 Type the program
 Save in current directory
 Run the program
 For the output see command window\ Figure window.

PROGRAM:
clc; clear all; close
all; t=-10:0.01:10;
L=length(t);
n=randn(1,L);
subplot(3,1,1);
plot(t,n);
xlabel('t --->'),ylabel('amp---->');
title('normal randon function');
nmean=mean(n);
disp('mean=');disp(nmean);
nmeansquare=sum(n.^2)/length(n);
disp('mean square=');disp(nmeansquare);
nstd=std(n);
disp('std=');disp(nstd);
nvar=var(n);
disp('var=');disp(nvar);
nskew=skewness(n);
disp('skew=');disp(nskew);
nkurt=kurtosis(n);
disp('kurt=');disp(nkurt);
p=normpdf(n,nmean,nstd);
subplot(3,1,2);
stem(n,p)
legend('Histogram','Theoretical PDF');
xlabel('Bins'); ylabel('PDF f_x(x)');
title('Power Density function');
xdft=fft(n);
xpsd=10*log10(abs(fftshift(xdft)));
norm_freq=linspace(-0.5, 0.5,
length(n));
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

subplot(3,1,3), plot(norm_freq,xpsd);
xlabel('Bins'); ylabel('PSD f_x(x)');
title( );

OUTPUT WAVEFORMS:
mean=0.0472
mean square= 1.0345
std=1.0163
var= 1.0328
skew=0.0279
kurt=2.870

RESULTS: Hence Gaussian signal was generated and calculated the parameters such as Mean,
Mean Square Value, Skew, Kurtosis, PSD and Probability Distribution Function by using MATLAB
programming.

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

CONCULSION:

1.

2.

VIVA VOCE QUESTIONS:


1. Write the formula for Mean, Mean Square, Variance and Standard deviation?
2. What are physical meaning of Mean, Mean Square, Variance and standard Deviation ?
3. Define Probability Density Function and Cumulative Distribution Function?
4. Write the properties of PDF and CDF?
5. Write the relation between mean, mean square and variance?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 12 Date:

RANDOM BIPOLAR DATA GENERATION

AIM: To generate a random data (with bipolar) for a given data rate.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:
 Open MATALB
 Open new M-file
 Type the program
 Save in current directory
 Compile and run the program
 For the output see the command window / figure window
PROGRAM:
clc;
clear all;
close
all;
tic;h = randi([0 1],1,10);toc
disp('The random Binary Sequence
is:') disp(h)
clf;tic
n=1;
l=length(h);
h(l+1)=1;
while n<=length(h)-1;
t=n-1:0.001:n;
if h(n) == 0
if h(n+1)==0
y=-(t<n-0.5)-(t==n);
else
y=-(t<n-0.5)+(t==n);
end
d=plot(t,y);grid on;
title('Line code BIPOLAR RZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
else
if h(n+1)==0
%y=(t>n-1)-2*(t==n);
y=(t<n-0.5)-1*(t==n);
else
%y=(t>n-1)+(t==n-1);
y=(t<n-0.5)+1*(t==n);
end
%y=(t>n-1)+(t==n-1);

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

d=plot(t,y);grid on;
title('Line code BIPOLAR RZ');
set(d,'LineWidth',2.5);
hold on;
axis([0 length(h)-1 -1.5 1.5]);
end
n=n+1;
%pause;
end
toc
OUTPUT WAVEFORMS:
Elapsed time is 0.000816 seconds.
The random Binary Sequence is:
0 1 0 0 0 0 1 1 1 0
Elapsed time is 1.010915 seconds.

RESULTS: Hence random data with bipolar signal was generated by using MATLAB
programming.

CONCULSION:

1.

2.

VIVA VOCE QUESTIONS:


1. What is data rate?
2. What is baud rate?
3. What is Line Coding?
4. What is Bipolar Return to Zero and Unipolar Return to Zero Coding?
5. What is Bipolar non Return Zero and Unipolar Non Return to Zero Coding?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 13 Date:
POLES AND ZEROS IN S- PLANE
AIM: To write a MATLAB program to plot pole-zero diagram in S-plane/Z-plane of given
signal/sequence and verify its stability.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:
 Open MATALB
 Open new M-file
 Type the program
 Save in current directory
 Compile and run the program
 For the output see the command window / figure window

PROGRAM:
clc; clear all; close all;
num=input('enter the numerator polynomial vector\n'); % [1 -2 1]
den=input('enter the denominator polynomial vector\n'); % [1 6 11
6] H=tf(num,den)
[p z]=pzmap(H);
disp('zeros are at ');
disp(z);
disp('poles are at ');
disp(p);
pzmap(H);
if max(real(p))>=0
disp(' All the poles do not lie in the left half of S-plane ');
disp(' the given LTI systen is not a stable system ');
else
disp('All the poles lie in the left half of S-plane ');
disp(' the given LTI systen is a stable system ');
end;

OUTPUT WAVEFORMS:

Enter the numerator polynomial vector [1 -2 1]


Enter the denominator polynomial vector [1 6 11 6]
Transfer function:
s^2 - 2 s + 1
s^3 + 6 s^2 + 11 s + 6

Zeros are at
1 1
Poles are at
-3.0000 -2.0000 -1.0000

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

All the poles lie in the left half of S-plane


The given LTI system is a stable system

RESULTS: Hence pole- zero in diagram in S-plane of the given signal was plotted and also verified
its stability by using MATLAB.

CONCLUSION:

1.

2.

VIVA QUESTIONS:
1. Define Transfer Function or System Function?
2. Define Pole and Zero?
3. Define Stability Criteria in S-Plan and Z-Plan?
4. Why the System Stability depends only on Pole location?
5. What is marginally stable and Absolute Stable systems?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

ADVANCED
EXPERIMENT

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 14 Date:

GIBB’S PHENOMENON
AIM: To write a MATLAB program to verify the Gibbs phenomenon.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:
 Open MATALB
 Open new M-file
 Type the program
 Save in current directory
 Compile and run the program
 For the output see the command window / figure window

PROGRAM:

% Gibb's
phenomenon clc;
clear all;
close all;
t=linspace(-2,2,2000);
u=linspace(-2,2,2000);
sq=[zeros(1,500),2*ones(1,1000),zeros(1,500)]; k=2;
N=[1,3,7,19,49,70];
for n=1:6;
an=[]; for
m=1:N(n)
an=[an,2*k*sin(m*pi/2)/(m*pi)]; end;
fN=k/2;
for m=1:N(n)
fN=fN+an(m)*cos(m*pi*t/2); end;
nq=int2str(N(n)); subplot(3,2,n),plot(u,sq,'r');hold
on;
plot(t,fN); hold off; axis([-2 2 -0.5 2.5]);grid;
xlabel('Time'), ylabel('y_N(t)');title(['N= ',nq]); end;

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

OUTPUT WAVEFORMS:

RESULTS: Hence Gibb’s Phenomenon was verified using MATLAB.

CONCULSION:

1.

2.

VIVA VOCE QUESTIONS:


1. Define Gibb’s Phenomenon?
2. Write Trigonometric (TFS) and Exponential Fourier Series (EFS)?
3. Write relation between TFS and EFS
4. Write the Fourier Series Expansion for Periodic Square signal?
5. State the Parseval’s relation for Power Signal?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

Exp: 15 Date:
SPECTRAL ANALYSIS OF COMPOSITE
(ADDED & MULTIPLIED) SIGNALS

AIM: To write a MATLAB program to spectral analysis of Composite (Added & Multiplied )
Signal.

SOFTWARE REQUIRED:
MATLAB (2019b 9.7version) Software
PROCEDURE:
 Open MATALB
 Open new M-file
 Type the program
 Save in current directory
 Compile and run the program
 For the output see the command window / figure window

PROGRAM:
clc;
clear all;
close
all;
Fs=1000;
T=1/Fs;
L=1000;
t=(0:L-1)*T;
%First signal(x1)
x1=cos(2*pi*20*t);
subplot(3,3,1);
plot(t(1:100),x1(1:100));
xlabel('t--->');ylabel('amp--->');
title('sine waveform-1');
%F.T of first signal-Y
n=2^nextpow2(L);
dim=2;
Y=fft(x1,n,dim);
p2=abs(Y/L);
p1=p2(:,1:n/2+1);
p1(:,2:end-1)=2*p1(:,2:end-1);
subplot(3,3,2);
plot(0:(Fs/n):(Fs/2-Fs/n),p1(1:n/2));
xlim([0 100])
xlabel('f--->');ylabel('amp--->');
title('FT of sine waveform-1');
%Second signal(x2)
x2=cos(2*pi*100*t);
subplot(3,3,3);
plot(t(1:100),x2(1:100));
xlabel('t--->');ylabel('amp--->');
VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa
www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

title('sine waveform-2');
%F.T of Second signal-Y1
Y1=fft(x2,n,dim);
p3=abs(Y1/L);
p4=p3(:,1:n/2+1);
p4(:,2:end-1)=2*p4(:,2:end-1);
subplot(3,3,4);
plot(0:(Fs/n):(Fs/2-Fs/n),p4(1:n/2));
xlim([0 300])
xlabel('f--->');ylabel('amp--->');
title('FT of sine waveform-2');
%Sum of two signals x3
x3=x1+x2;
subplot(3,3,5);
plot(t(1:100),x3(1:100));
xlabel('t--->');ylabel('amp--->');
title('addition if x1&x2');
%F.T of sum of two signals-
Y2 Y2=fft(x3,n,dim);
p5=abs(Y2/L);
p6=p5(:,1:n/2+1);
p6(:,2:end-1)=2*p6(:,2:end-1);
subplot(3,3,6);
plot(0:(Fs/n):(Fs/2-Fs/n),p6(1:n/2));
xlim([0 300])
xlabel('f--->');ylabel('amp--->');
title('FT of sine waveform-x3');
%Multiplication of two signals
x4 x4=x1.*x2;
subplot(3,3,7);
plot(t(1:100),x4(1:100));
xlabel('t--->');ylabel('amp--->');
title('Multiplication of x1&x2');
%F.T of Multiplication of two signals-Y3
Y3=fft(x4,n,dim);
p8=abs(Y3/L);
p9=p8(:,1:n/2+1);
p9(:,2:end-1)=2*p9(:,2:end-1);
subplot(3,3,[8,9]); plot(0:(Fs/n):
(Fs/2-Fs/n),p9(1:n/2)); xlim([0
300])
xlabel('f--->');ylabel('amp--->');
title('FT of sine waveform-x4');

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

OUTPUT WAVEFORMS: 20Hz,100Hz

20Hz,200Hz

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF Pa


www.android.universityupdates.in | www.universityupdates.in |

SIMULATION II B.Tech I

RESULTS:
Hence spectral analysis of Composite (Added & Multiplied ) Signal using by MATLAB
program successfully.

CONCULSION:

1.

2.

VIVA VOCE QUESTIONS:


1. State and prove time multiplication property of Fourier Transform?
2. What is modulation theorem?
3. What is the effect of Time shifting property on Phase Spectrum?
4. What is the effect of Time Compression and expansion on Magnitude Spectrum?
5. Explain the significance of Linear property of Fourier Transform?

VEMU INSTITUTE OF TECHNOLOGY, DEPT OF E.C.E Page

You might also like