0% found this document useful (0 votes)
9 views209 pages

MATLAB Matrix Operations Tutorial

This document outlines two experiments involving MATLAB: the first focuses on basic matrix operations such as addition, subtraction, and multiplication, while the second explores the generation of various signals including unit impulse, unit step, and sinc functions. It provides theoretical background, built-in functions, procedures for executing MATLAB programs, and sample exercises for practical application. The document emphasizes MATLAB's utility in numerical computation and signal processing within engineering contexts.

Uploaded by

rahulsinha8591
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)
9 views209 pages

MATLAB Matrix Operations Tutorial

This document outlines two experiments involving MATLAB: the first focuses on basic matrix operations such as addition, subtraction, and multiplication, while the second explores the generation of various signals including unit impulse, unit step, and sinc functions. It provides theoretical background, built-in functions, procedures for executing MATLAB programs, and sample exercises for practical application. The document emphasizes MATLAB's utility in numerical computation and signal processing within engineering contexts.

Uploaded by

rahulsinha8591
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

1

EXPERIMENT NO: 1
BASIC OPERATIONS ON MATRICES
AIM: - To write a MATLAB program to perform some basic operation on matrices such as addition,
subtraction, multiplication.

SOFTWARE REQURIED:-
1. MATLAB
2. Windows 8 and above.

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, 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:
1. 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)

2
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
2. Vector Functions:
Other MATLAB functions operate essentially on vectors returning a scalar value. Some of these
functions are given below.
1. max largest component : 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

3. 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 eg: diag([0.9092;0.5163;0.2661])
ans = 0.9092 0 0
3
0 0.5163 0
0 0 0.2661
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

4
PROCEDURE:-

5
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;


a=[1 2 -9 ; 2 -1 2; 3 -4 3];
b=[1 2 3; 4 5 6; 7 8 9];
disp('The matrix a= '); a
disp('The matrix b= '); b
% to find sum of a and b c=a+b;
disp('The sum of a and b is '); c
% to find difference of a and b d=a-b;
disp('The difference of a and b is '); d
%to find multiplication of a and b e=a*b;
disp('The product of a and b is '); e

6
\
OUTPUT:-

The matrix a= a =
1 2 -9
2 -1 2
3 -4 3

The matrix b=

b=
1 2 3
4 5 6
7 8 9

The sum of a and b is c =


2 4 -6
6 4 8
10 4 12

The difference of a and b is d =


0 0 -12
-2 -6 -4
-4 -12 -6

The product of a and b is e =


-54 -60 -66
12 15 18
8 10 12
RESULT:-

7
Finding addition, subtraction, multiplication using MATLAB was Successfully completed.

8
VIVA QUESTIONS:-
1. Expand MATLAB?And importance of MATLAB?
2. What is clear all and close all will do?
3. What is disp() and input()?
4. What is the syntax to find the eigen values and eigenvectors of the matrix?
5. What is the syntax to find the rank of the matrix?
6. How to determine rank of Matrix?
7. How to determine Rank of Matrix?
8. How to determine Transpose of Matrix?
9. How to determine Trace of Matrix?
10. How to determine Inverse of Matrix?

EXERCISE PROGRAMS
1. Enter the matrix M=[1,3,-1,6:2,4,0,-1;0,-2,3,-1;-1,2,-5,1] and N=[-1,-3,3;2,-1,6;1,4,-1;2,-1,2],
perform multiplication on M and N. Can order of multiplication be switched? Why or why not?
2. 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.
3. Find the transpose of null matrix using matlab
4. 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.
5. Write a matlab program to perform addition operation using 2x3 matrix. Assume any numbers
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]T
7. 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
8. Write a matlab program to perform addition operation using 3x2 matrix. Assume any numbers
9. 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
10. Find the addition of null matrix and unity matrix of order 3x3.
11. Write a MATLAB program to find rank of the matrix A= [6 5 9 3 5; 6 5 4 8 5; 6 3 5 7 9].
12. Write a MATLAB program to find Eigen of the matrix A= [2 5 9 3 4; 5 6 3 7 8; 9 8 6 5 4].
13. Write a MATLAB program to find inverse of the matrix A= [1 6 9 8 5; 9 3 5 8 4; 5 6 3 5 7]
14. Write a MATLAB program to find determinant of the matrix A= [1 6 9 8 5; 9 3 5 8 4; 5 6 3 5 7].
15. Write a MATLAB program to find Transpose of the matrix A=[1 6 9 8 5; 9 3 5 8 4; 5 6 3 5 7]
16. Find the multiplication of null matrix and unity matrix of order 3x3.

10
17. Write a matlab program to perform multiplication operation using 2x3 matrix. Assume any
numbers.
18. Write a MATLAB program to perform the division operation on the following matrix A = [2,-5, 21,-
21], b= [5,15,11,13].
19. Enter the matrix
A = [6 9 8 5;3 5 8 4;6 3 5 7], B = [5 9 3 5;5 4 8 5;3 5 7 9],
C = [5 9 3 4;6 3 7 8;8 6 5 4] Find [(A-B)+C]-1
20. Write a matlab program to perform division operation using 3x2 matrix. Assume any numbers
21. Write a MATLAB program to perform the division operation on the following matrix A = [5,-3,11,-
1], b= [6,5,1,13] and perform the transpose function on the answer.
22. Find the addition of null matrix and Identity matrix of order 4x4.
23. Enter the matrix M=[2,13,-11;12,4,2;-2,3,-1] and N=[2,-1,6;1,4,-1;2,-1,2], perform
multiplication on M and N.
24. Enter the matrix M = [-2,8,0] and N = [1 5 6 8; 2 5 6 9]
Perform addition and multiplication on M and N and see how matlab reacts.
25. Enter the matrix A = [6 9 8 5;3 5 8 4;6 3 5 7], B = [5 9 3 5;5 4 8 5;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
26. Find the addition of null matrix and unity matrix of order 4x4.
27. Write a MATLAB program to find rank of the matrix A= [6 4 9 3 5; 6 2 4 8 5; 6 3 1 7 9].
28. Write a MATLAB program to find Eigen of the matrix A= [2 5 0 3 4; 5 4 3 7 8; 9 1 6 5 4].
29. Write a MATLAB program to find inverse of the matrix A= [1 5 9 8 5;4 3 5 8 4; 5 6 3 5 0]
30. Write a MATLAB program to find determinant of the matrix A= [1 6 9 8 5; 9 3 5 6 4; 1 6 3 5 6].

Real Time application:


We see the results of matrix mathematics in every computer-generated image that has a reflection, or
dist

11
EXPERMENT NO:2
GENERATION OF VARIOUS SIGNALS & SEQUENCES
AIM:-
unit impulse, unit step, unit ramp, sinusoidal,square,saw tooth,triangular,sinc signals.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-
One of the more useful functions in the study of linear systems is the "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. This is, at first hard to visualize but we can do so by
using the graphs shown below.

12
Key Concept: Sifting Property of the Impulse If b>a, then
b

∫ δ ( t−T ) . f ( t ) dt=
a
{f0(T,∧otherwise
),∧a<T <b

Example: Another integral problem


Assume a<b, and evaluate the integral

Solution:
We now that the impulse is zero except at t=0 so

And

Unit Step Function

The unit step function and the impulse function are considered to be fundamental functions in
engineering, and it is strongly recommended that the reader becomes very familiar with both of these
functions.

The unit step function, also known as the Heaviside function, is defined as such:

13
Sometimes, u(0) is given other values, usually either 0 or 1. For many applications, it is irrelevant
what the value at zero is. u(0) is generally written as undefined.

Derivative
The unit step function is level in all places except for a discontinuity at t = 0. For this reason, the
derivative of the unit step function is 0 at all points t, except where t = 0. Where t = 0, the derivative
of the unit step function is infinite.

The derivative of a unit step function is called an impulse function. The impulse function will be
described in more detail next.

Integral
The integral of a unit step function is computed as such:

14
Sinc Function
There is a particular form that appears so frequently in communications engineering, that we give it
its own name. This function is called the "Sinc function" and is discussed below:

The Sinc function is defined in the following manner:

And Sinc(0)=1
The value of sinc(x) is defined as 1 at x = 0, since

This fact can be proven by noting that for x near 0,

Then, since cos(0) = 1, we can apply the Squeeze Theorem to show that the sinc function
approaches one as x goes to zero. Thus, defining sinc(0) to be 1 makes the sinc function continuous.

Also, the Sinc function approaches zero as x goes towards infinity, with the envelope of sinc(x)
tapering off as 1/x.

Rect Function
The Rect Function is a function which produces a rectangular-shaped pulse with a width of 1 centered
at t = 0. The Rect function pulse also has a height of 1. The Sinc function and the rectangular function
form a Fourier transform pair.

A Rect function can be written in the form:

15
where the pulse is centered at X and has width Y. We can define the impulse function above in terms
of the rectangle function by centering the pulse at zero (X = 0), setting it's height to 1/A and setting
the pulse width to A, which approaches zero:

16
We can also construct a Rect function out of a pair of unit step functions

Here, both unit step functions are set a distance of Y/2 away from the center point of (t - X). SAW
TOOTH:-
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 rises. The latter type of sawtooth wave is called a 'reverse sawtooth wave'
or 'inverse sawtooth wave'. As audio signals, the two orientations of sawtooth wave sound identical.
The piecewise linear function based on the floor function of timet, is an example of a sawtooth wave
with period 1.

Triangle wave
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).It is possible to approximate a triangle wave with
additive synthesis by adding odd harmonics of the fundamental, multiplying every (4n 1)th harmonic
by 1 (or changing its phase by ), and rolling off the harmonics by the inverse square of their relative
frequency to the [Link] infinite Fourier series converges to the triangle wave:

17
Sinusoidal Signal Generation
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:
where:
A, the amplitude, is the peak deviation of the function from its center position. , the angular
frequency, specifies how many oscillations occur in a unit time interval, in radians per second
, the phase, specifies where in its cycle the oscillation begins at t = 0. A sampled sinusoid may be

written as:
where f is the signal frequency, fs is the sampling frequency, is the phase and A is the amplitude of
the signal.

PROCEDURE:-

18
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:-
%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 discreat function');

19
%unit step function%

clc; clear all; close all; N=100; t=1:100;


x=ones(1,N);
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 discreat function');
%unit ramp function% clc;
clear all; close all; t=0:20;
x=t; 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');
%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');

20
ylabel('amplitude'); title('sinusoidal signal'); subplot(2,1,2);
stem(t,x,'r');
xlabel('time'); ylabel('amplitude'); title('sinusoidal sequence');

%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');
%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');

21
%trianguler 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('trianguler signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time'); ylabel('amplitude'); title('trianguler sequence');
%sinc function% clc;
clear all; close all;
t=linspace(-5,5); x=sinc(t); subplot(2,1,1);
plot(t,x,'g');
xlabel('time'); ylabel('amplitude'); title('sinc signal');
subplot(2,1,2);
stem(t,x,'r');
xlabel('time'); ylabel('amplitude'); title('sinc sequence');

22
OUTPUT:-
unit impulse function

unit impulse function


1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
time
unit impulse discreat function
1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
time

unit step function

1.5

0.5

0
0

time

Department of Electronics and Communication Engineering Page 23


1

0.5

time

Department of Electronics and Communication Engineering Page 24


unit step function

10 20 30 40 50 60 70 80 90 100
time
unit step discreat function

0
0 10 20 30 40 50 60 70 80 90 100

time

Department of Electronics and Communication Engineering Page 25


unit ramp function

unit ramp function


20

15

10

0
0 2 4 6 8 10 12 14 16 18 20
time
unit ramp discreat function
20

15

10

0
0 2 4 6 8 10 12 14
time

time

Department of Electronics and Communication Engineering Page 26


16 18 20

sinusoidal function

0.5

-0.5

-1

0.5

-0.5

time

Department of Electronics and Communication Engineering Page 27


sinusoidal signal

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time sinusoidal sequence

-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4

time

Department of Electronics and Communication Engineering Page 28


1.6 1.8 2

time

Department of Electronics and Communication Engineering Page 29


square function

0.5

-0.5

-1

0.5

-0.5

Department of Electronics and Communication Engineering Page 30


square signal

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time square sequence

-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4
time

Department of Electronics and Communication Engineering Page 31


1.6 1.8 2

sawtooth function

0.5

-0.5

-1

0.5

-0.5

Department of Electronics and Communication Engineering Page 32


sawtooth signal

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time sawtooth sequence

-1
0 0.2 0.4 0.6 0.8 1
time

Department of Electronics and Communication Engineering Page 33


1.2 1.4 1.6 1.8 2

Department of Electronics and Communication Engineering Page 34


trianguler function

0.5

-0.5

-1

0.5

-0.5

-1

Department of Electronics and Communication Engineering Page 35


trianguler signal

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time trianguler sequence

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time

sinc function

Department of Electronics and Communication Engineering Page 36


sinc signal

0.5

-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
time
sinc sequence
1

0.5

-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
time

RESULT:-
Thus the Generation of continuous time signals like unit step, sawtooth, triangular, sinusoidal, ramp
and sinc functions are successfully completed by using MATLAB.

Department of Electronics and Communication Engineering Page 37


VIVA QUESTIONS:-
1. Define Signal?
2. Define determistic and Random Signal?
3. Define Delta Function?
4. What is Signal Modeling?
5. Define Periodic and a periodic Signal?
6. Write the relation between Step and Impulse signals?
7. Write the relation between Ramp and impulse signals?
8. Write the relation between Ramp and Step signals?
9. Define Standerd signals?
10. Give examples of Standerd signals?

EXERCISE QUESTIONS
1. Generate rectangular pulse function by using MATLAB.
2.

Write a matlab program to get the above output where t0 = 2


3. Write a program to get the result in signal r(t) = u(t) 2*u(t+1)
4. Write a program to get the following output t = -1: -5

5.

Department of Electronics and Communication Engineering Page 38


Write mat lab program to get the above output X(t) = 1; (0<t<2)
= 10;(2<t<15) Note: Add ramp and unit

Department of Electronics and Communication Engineering Page 39


6. Write a matlab program to generate a sine wave with amplitude = 3, frequency 20Hz.
7. Write a matlab program to generate a cos wave with amplitude = 3, frequency 20Hz.
8. Write a matlab program to generate a triangular wave with amplitude = 8, frequency 10Hz.
9. Write a matlab program to generate a square wave with amplitude = 2, frequency 10kHz.
10. Write a matlab program to generate the signum function.
11. Write a matlab program to generate exponential growing signal.
12. Write a matlab program to generate exponential decaying signal.
13. Write a matlab program to generate a triangular wave with amplitude = 6,frequency 1Hz.
14. Write a matlab program to generate a square wave with amplitude = 5, frequency 5kHz.
15. Write a matlab program to generate a sawtooth wave with amplitude = 8, frequency5Khz.
16. Write a matlab program to generate a sine wave with amplitude = 5, frequency 5Hz.
17. Write a matlab program to generate a cos wave with amplitude = 4, frequency 10Hz.
18. Write a matlab program to generate a triangular wave with amplitude = 5, frequency 4Hz.
19. Write a matlab program to generate a square wave with amplitude = 1, frequency 20kHz.
20. Write a matlab program to generate the signum function.
21. Wr ite a matlab program to generate a square wave with amplitude = 4, frequency 5kHz.
22. Write a matlab program to generate a triangular wave with amplitude = 6, frequency 6Hz.
23. Write a matlab program to generate a triangular wave with amplitude = 8,frequency 2Hz.
24. Write a matlab program to generate a square wave with amplitude = 7, frequency 5kHz.
25. Write a matlab program to generate a sawtooth wave with amplitude =10, frequency 10Khz.
26. Write a matlab program to generate the signum function in frquency domain?.
27. Write a matlab program to generate exponential growing signal in time domain?.
28. Write a matlab program to generate exponential decaying signal in time domain?.
29. Write a matlab program to generate a triangular wave with amplitude = 4,frequency 6Hz.
30. Write a matlab program to generate a square wave with amplitude = 8, frequency 4kHz.

Real Time Applications:


Industrial control and automation (Control the velocity or position of an object) Examples:
Controlling the position of a valve or shaft of a motor
Mechanical Translational Systems Mechanical Rotational Systems.

Department of Electronics and Communication Engineering Page 40


EXPERMENT NO:3

AIM:-

Department of Electronics and Communication Engineering Page 41


OPERATIONS ON SIGNALS & SEQUENCES
To performs operations on signals and sequences such as addition, multiplication, scaling, shifting,
folding, computation of energy and average power.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-

Basic Operation on Signals:


Time shifting: y(t)=x(t-T)The effect that a time shift has on the appearance of a signal If T is a
positive number, the time shifted signal, x (t -T ) gets shifted to the right, otherwise it gets shifted left.

Signal Shifting and Delay:

Shifting : y(n)={x(n-k)} ; m=n-k; y=x;


Time reversal: Y(t)=y(-t) Time reversal _ips the signal about t = 0 as seen in Figure 1.

Signal Addition and Substraction :


Addition: any two signals can be added to form a third signal, z (t) = x (t) + y (t)

Department of Electronics and Communication Engineering Page 42


Signal Amplification/Attuation :

Multiplication/Divition :
of two signals, their product is also a signal. z (t) = x (t) y (t)

folding:
y(n)={x(-n)} ; y=fliplr(x); n=-fliplr(n);

PROCEDURE:-

Department of Electronics and Communication Engineering Page 43


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:-
%Addition and multiplication of two signals% clc;
clear all; close all; t=0:0.001:2;
s1=6*sin(2*pi*5*t); subplot(4,1,1);
plot(t,s1,'g');
xlabel('time'); ylabel('amplitude');

Department of Electronics and Communication Engineering Page 44


title('first signal'); s2=8*sin(2*pi*5*t); subplot(4,1,2);
plot(t,s2,'r');
xlabel('time'); ylabel('amplitude'); title('second signal'); s3=s1+s2; subplot(4,1,3);
plot(t,s3,'g');
xlabel('time'); ylabel('amplitude'); title('sum of two signals'); s4=s1.*s2;
subplot(4,1,4);
plot(t,s4,'g');
xlabel('time'); ylabel('amplitude');
title('multiplication of two signals');
%Amplitude scaling for signals% clc;
clear all; close all; t=0:0.001:2;
s1=6*sin(2*pi*5*t); subplot(3,1,1);
plot(t,s1,'g');
xlabel('time'); ylabel('amplitude'); title('sinusoidal signal'); s2=3*s1; subplot(3,1,2);
plot(t,s2,'r');
xlabel('time'); ylabel('amplitude'); title('amplified signal'); s3=s1/3; subplot(3,1,3);
plot(t,s3,'g');
xlabel('time'); ylabel('amplitude'); title('attenuated signal');

Department of Electronics and Communication Engineering Page 45


%Time scaling for signals%

clc; clear all; close all;


t=0:0.001:2;
s1=6*sin(2*pi*5*t); subplot(3,1,1);
plot(t,s1,'g');
xlabel('time'); ylabel('amplitude'); title('sinusoidal signal'); t1=3*t;
subplot(3,1,2);
plot(t1,s1,'r');
xlabel('time'); ylabel('amplitude'); title('compressed signal'); t2=t/3;
subplot(3,1,3);
plot(t2,s1,'g');
xlabel('time'); ylabel('amplitude'); title('enlarged signal');
%Time shifting of a signal% clc;
clear all; close all; t=0:0.001:3;
s1=6*sin(2*pi*5*t); subplot(3,1,1);
plot(t,s1,'g');
xlabel('time'); ylabel('amplitude'); title('sinusoidal signal'); t1=t+10;
subplot(3,1,2);
plot(t1,s1,'r');
xlabel('time'); ylabel('amplitude');
title('right shift of the signal'); t2=t-10;
subplot(3,1,3);
plot(t2,s1,'g');

Department of Electronics and Communication Engineering Page 46


xlabel('time'); ylabel('amplitude');
title('left shift of the signal');
%Time folding of a signal% clc;
clear all; close all; t=0:0.001:2;
s=sin(2*pi*5*t); m=length(s); n=[-m:m];
y=[0,zeros(1,m),s]; subplot(2,1,1);
plot(n,y,'g');
xlabel('time'); ylabel('amplitude'); title('original signal'); y1=[fliplr(s),0,zeros(1,m)]; subplot(2,1,2);
plot(n,y1,'r');
xlabel('time'); ylabel('amplitude'); title('folded signal');

Department of Electronics and Communication Engineering Page 47


OUTPUT:-
Addition and multiplication of two signals

10
0
-10

Department of Electronics and Communication Engineering Page 48


first signal

10
0
-10

Department of Electronics and Communication Engineering Page 49


0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
time second signal

20
0
-20
0

50
0
0

Department of Electronics and Communication Engineering Page 50


0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
time
sum of two signals

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time multiplication of two signals

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time

Department of Electronics and Communication Engineering Page 51


Amplitude scaling for signals

10

-10
0

20

-20
0

0
-2
0

Department of Electronics and Communication Engineering Page 52


sinusoidal signal

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time amplified signal

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time attenuated signal

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


time

Department of Electronics and Communication Engineering Page 53


Time scaling for signals

sinusoidal signal
10
amplitude

-10
0

10
amplitude

Department of Electronics and Communication Engineering Page 54


0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
time compressed signal
-10
10
amplitude

Department of Electronics and Communication Engineering Page 55


0 1 2 3 4 5 6
time enlarged signal

0
-10
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7

time

Department of Electronics and Communication Engineering Page 56


Time shifting of a signal

10

-10
0

10

Department of Electronics and Communication Engineering Page 57


sinusoidal signal

0.5 1 1.5 2 2.5 3


time
right shift of the signal

-10
10 10.5 11 11.5 12 12.5 13
time
left shift of the signal
10

-10
-10 -9.5 -9 -8.5 -8 -7.5 -7
time

Department of Electronics and Communication Engineering Page 58


Time folding of a signal

original signal
1

0.5

-0.5

-1
-2500 -2000 -1500 -1000 -500 0 500 1000 1500 2000 2500
time folded signal
1

0.5

-0.5

-1
-2500 -2000 -1500 -1000 -500 0 500 1000 1500 2000 2500
time

RESULT:-
In this experiment the various oprations on signals have been Performed Using MATLAB have been
demonstrated.

VIVA QUESTIONS:-
1. Define Symetric and Anti-Symmetric Signals?
2. Define Continuous and Discrete Time Signals?
3. What are the Different types of representation of discrete time signals?
4. What are the Different types of Operation performed on signals?
Department of Electronics and Communication Engineering Page 59
5. What is System?
6. Explain Even Signals?
7. Explain Odd signals?
8. Define Periodic signals?
9. Define Aperiodic signals?
10. Differentiate Energy and Power signals with examples?

Department of Electronics and Communication Engineering Page 60


EXERCISE PROGRAMS
1. Write a MATLAB program to generate amplitude scaling of a sequence.
2. Write a MATLAB program to subtract two sinusoidal signals.
3. Write a MATLAB program to subtract and multiply twosinusoidal signals.
4. Write a MATLAB program to right shift the signal to 5 times of the original signal.
5. Write a MATLAB program to left shift the signal to 8 times of the original signal.
6. Write a MATLAB program to add two different signals with 2 <t<5
7. Write a MATLAB program to shift a positive time line signal to negative timeline signal.
8. Write a MATLAB program to subtract co-sinusoidal signals.
9. Write a MATLAB program to subtract two sinusoidal signals
10. Write a MATLAB program to division and multiply two co-sinusoidal signals.
11. Write a MATLAB program to generate time scaling of a sequence.
12. Write a MATLAB program to generate time shifting of a sequence.
13. Write a MATLAB program to generate time folding of a sequence.
14. Write a MATLAB program to generate amplitude scaling of a sequence with amplitude 5.
15. Write a MATLAB program to generate time scaling of a sequence with time 2sec.
16. Write a MATLAB program to add two different signals with 4 <t<8
17. Write a MATLAB program to shift a negative time line signal to positive timeline signal.
18. Write a MATLAB program to subtract sinusoidal signals.
19. Write a MATLAB program to subtract and divide two sinusoidal signals
20. Write a MATLAB program to add and multiply two co-sinusoidal signals.
21. Write a MATLAB program to generate time scaling of a signal.
22. Write a MATLAB program to generate time shifting of a signal.
23. Write a MATLAB program to generate time folding of a signal.
24. Write a MATLAB program to generate amplitude scaling of a sequence with amplitude 10.
25. Write a MATLAB program to generate time scaling of a sequence with time 5sec.
26. Write a MATLAB program to substract two different signals with 2 <t<5
27. Write a MATLAB program to compress a positive time line signal to negative timeline signal.
28. Write a MATLAB program to positive shift in delay of co-sinusoidal signals.
29. Write a MATLAB program to subtract two signals.
30. Write a MATLAB program to multiply two co-sinusoidal signals of different amplitude
levels.

Department of Electronics and Communication Engineering Page 61


Real Time Applications:
Stream processing Block processing Vector processing
Digital Signal Processing Applications.

Department of Electronics and Communication Engineering Page 62


EXPERMENT NO: 4
FINDING EVEN AND ODD & REAL AND IMAGINARY PARTS OF SEQUENCES

AIM: -
Program for finding even and odd parts of sequences Using MATLAB Software& Program for finding
real and imaginary parts of sequences Using MATLAB Software

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-
Even and Odd Signal
One of characteristics of signal is symmetry that may be useful for signal analysis. Even signals are
symmetric around vertical axis, and Odd signals are symmetric about origin. Even Signal: A signal is
referred to as an even if it is identical to its time-reversed counterparts; x(t) = x(-t).
Odd Signal: A signal is odd if x(t) = -x(-t).
An odd signal must be 0 at t=0, in other words, odd signal passes the origin.
Using the definition of even and odd signal, any signal may be decomposed into a sum of its even
part, xe(t), and its odd part, xo(t), as follows:

x(t)=xe(t)+xo(t);
x(t)=1/2{x(t)+x(-t)} +1/2{x(t)-x(-t)} where
xe(t)=1/2{x(t)+x(-t)} &xo(t)=1/2{x(t)-x(-t)}
It is an important fact because it is relative concept of Fourier series. In Fourier series, a periodic
signal can be broken into a sum of sine and cosine signals. Notice that sine function is odd signal and
cosine function is even signal
ENERGY AND POWER SIGNAL:

A signal can be categorized into energy signal or power


signal: An energy signal has a finite energy, 0 < E < . In other words, energy signals have values
only in the limited time duration. For example, a signal having only one square pulse is energy signal.
A signal that decays exponentially has finite energy, so, it is also an energy signal. The power of an
Department of Electronics and Communication Engineering Page 63
energy signal is 0, because of dividing finite energy by infinite time (or length).

Department of Electronics and Communication Engineering Page 64


If x(t) is a real-valued signal with Fourier transform X(f), and u(f) is the Heaviside step function, then
the function:

contains only the non-negative frequency components of X(f). And the operation is reversible, due to
the Hermitian property of X(f):

X(f)* denotes the complex conjugate of X(f) .


Department of Electronics and Communication Engineering Page 65
The inverse Fourier transform of Xa(f) is the analytic signal:

where x^(t) is the Hilbert transform of x(t) and J is the imaginary unit.

PROCEDURE:-

Department of Electronics and Communication Engineering Page 66


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:-
%Even,odd,real,imaginary parts of a sequences% clc;
clear all;
close all;
h=input('enter [Link] samples'); m=(h-1)/2;
n=-m:m;
x=input('enter sample values'); subplot(4,1,1);
stem(n,x,'g');
xlabel('time'); ylabel('amplitude'); title('original sequence'); xmir=fliplr(x); subplot(4,1,2);
stem(n,xmir,'r');
xlabel('time'); ylabel('amplitude'); title('folded sequence');

Department of Electronics and Communication Engineering Page 67


%even part of sequence%
xeven=(x+xmir)/2; subplot(4,1,3);
stem(n,xeven,'r');
xlabel('time'); ylabel('amplitude'); title('even part of sequence');

%odd part of sequence%

xodd=(x-xmir)/2; subplot(4,1,4);
stem(n,xodd,'g');
xlabel('time'); ylabel('amplitude'); title('odd part of sequence');
%Real&Imaginary parts of a sequences% clc;
clear all; close all;
y=input('enter complex numbers'); yreal=real(y);
disp('real values of y'); yreal
yimag=imag(y); disp('imaginary values of y'); yimag

Department of Electronics and Communication Engineering Page 68


OUTPUT:-
Even,odd,real,imaginary parts of a sequences enter [Link] samples5
enter sample values[1 2 3 4 5]

original sequence
5
0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
time folded sequence
5
0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
time
even part of sequence
4
2
0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
time
odd part of sequence
2
0
-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
time

Real&Imaginary parts of a sequences

enter complex numbers[1+6i 2-5i 3 4+3i 5i] real values of y


yreal = 1 2 3 4 0
imaginary values of y yimag =
6 -5 0 3 5

RESULT:-
In this experiment even and odd parts of various signals and energy and power of signals have been
calculated Using MATLAB.

Department of Electronics and Communication Engineering Page 69


VIVA QUESTIONS

1. What is the formula to find odd part of signal?


2. What is Even Signal?
3. What is Odd Signal?
4. What is the formula to find even part of signal?
5. What is the difference b/w stem&plot?
6. What is Energy Signals?
7. What is Power signals?
8. Define Systems?
9. How to determine time period of Periodic signals?
10. Define Frequency of signals?

EXERCISE PROGRAM
1. Write a MATLAB program to find even part of a signal by considering 10 input samples.
2. Write a MATLAB program to find odd part of a signal by considering atleast 7 samples.
3. Write a MATLAB program to add even an odd part of a signal and see how matlab reacts for the
above program.
4. Write a matlab program to get the out put as [-5, 3, 0, 8] as imaginary values and [2 4 6 8 0] as
real values.
5. Write a MATLAB program to subtract even an odd part of a signal and see how matlab reacts for
the above program.
6. Write a MATLAB program to find real & imaginary values of complex numbers[1+6i 2-5i 3 4+3i
5i].
7. Write a MATLAB program to find real & imaginary values of complex numbers[2+6i 7+5i 3
9+3i 5i].
8. Write a MATLAB program to find real & imaginary values of complex numbers[7+6i 2-5i 3 8+3i
7i].
9. Write a MATLAB program to find even & odd part of the sequence [5 6 3 2 3 4 7].
10. Write a MATLAB program to find even & odd part of the sequence [7 5 8 6 7].
11. Write a MATLAB program to find even part of a signal by considering 8 input samples.
12. Write a MATLAB program to find odd part of a signal by considering 10 samples.
Department of Electronics and Communication Engineering Page 70
13. Write a MATLAB program to multiply even and odd part of a signal and see how matlab
reacts for the above program.
14. Write a matlab program to get the output as [2, 5, -1, 6] imaginary values and [4, 2, 8, 0] as real
values.
15. Write a MATLAB program to divide even an odd part of a signal and see how matlab reacts for
the above program.
16. Write a MATLAB program to find real & imaginary values of complex numbers [2+4i 1-6i 4+2i
8i].
17. Write a MATLAB program to find real & imaginary values of complex numbers [4+8i 6+4i 2
6+4i 6i].

Department of Electronics and Communication Engineering Page 71


18. Write a MATLAB program to find real & imaginary values of complex numbers[4+4i 2-5i 4
6+4i 6i].
19. Write a MATLAB program to find even & odd part of the sequence [4 9 8 4 3 2 1].
20. Write a MATLAB program to find even & odd part of the sequence [5 7 6 7 8].
21. Write a MATLAB program to find even & odd part of the sequence [2 3 6 3 4 3 7].
22. Write a MATLAB program to find even & odd part of the sequence [5 4 6 8 6].
23. Write a MATLAB program to find even part of a signal by considering 6 input samples.
24. Write a MATLAB program to find odd part of a signal by considering 9 samples.
25. Write a matlab program to get the output as [2, 4, -6, 8] imaginary values and [1, 5, 9, 3] as real
values.
26. Write a MATLAB program to find even & odd part of the sequence [4 6 3 2 6 3 4 7].
10. Write a MATLAB program to find even & odd part of the sequence [7 5 8 6 4 2 1 7].
11. Write a MATLAB program to find even part of a signal by considering 10 input samples.
12. Write a MATLAB program to find odd part of a signal by considering 10 input samples.
13. Write a MATLAB program to multiply even and odd part of a signal.

Real Time Applications:

Synthesis and manipulation: E.g. speech synthesis, music synthesis, graphics. Analysis:
Seismic data, atmospheric data, stock market analysis.
Medical Applications.

Department of Electronics and Communication Engineering Page 72


EXPERMENT NO:5 LINEAR CONVOLUTION
AIM: -
To find the output with linear convolution operation Using MATLAB Software.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-

Linear Convolution involves the following operations.


1. Folding
2. Multiplication
3. Addition
4. Shifting
These operations can be represented by a Mathematical Expression as follows:

x[n]= Input signal Samples


h[ n-k]= Impulse response co-efficient. y[ n]= Convolution output.
n = No. of Input samples
h = No. of Impulse response co-efficient. Example : X(n)={1 2 -1 0 1}, h(n)={ 1,2,3,-1}.

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

Department of Electronics and Communication Engineering Page 73


PROGRAM:-
%Convolution of two signals% clc;
clear all;
close all; t=0:0.001:10;
x=sin(t); h=square(t); subplot(3,1,1);
plot(t,x,'g');
xlabel('time'); ylabel('amplitude'); title('sinusoidal signal'); subplot(3,1,2);
plot(t,h,'r');
xlabel('time'); ylabel('amplitude'); title('square function'); y=conv(x,h);
subplot(3,1,3); plot(y); xlabel('time'); ylabel('amplitude');
title('convolution signal');
%Convolution of two sequences% clc;
clear all; close all;
L=input('enter the length of 1st sequence'); M=input('enter the length of 2nd sequence'); x=input('enter
the first sequence:x(n)='); h=input('enter the second sequence:y(n)='); N=0:(L+M-1);
y=conv(x,h);
subplot(3,1,1);
stem(x,'g'); xlabel('discrete time'); ylabel('x(n)'); title('1st sequence'); subplot(3,1,2);
stem(h,'r'); xlabel('discrete time');

Department of Electronics and Communication Engineering Page 74


ylabel('h(n)'); title('second sequence'); subplot(3,1,3);
stem(y); xlabel('discrete time'); ylabel('y(n)');
title('convolution of two sequences');

OUTPUT:-
Convolution of two signals

sinusoidal signal
1

0
-1
0 1 2 3 4 5 6 7 8 9 10
time
square function
1

0
-1
0

4
x 10

Department of Electronics and Communication Engineering Page 75


1 2 3 4 5 6
time
convolution signal

Department of Electronics and Communication Engineering Page 76


7 8 9 10
1

-1
0 0.5 1 1.5 2 2.5
time

Department of Electronics and Communication Engineering Page 77


4

x 10

Department of Electronics and Communication Engineering Page 78


Convolution of two sequences
enter the length of 1st sequence4 enter the length of 2nd sequence4 enter the first sequence:x(n)=[1 2
3 4]
enter the second sequence:y(n)=[1 2 3 4]

1st sequence
4

2
0
1 1.5 2 2.5 3 3.5 4
discrete time second sequence
4

2
0
1 1.5 2 2.5 3 3.5 4
discrete time convolution of two sequences
40

20
0
1 2 3 4 5 6 7
discrete time

RESULT:-
In this experiment convolution of various signals have been performed Using MATLAB.

Department of Electronics and Communication Engineering Page 79


VIVA QUESTIONS:-
1. Define Convolution?
2. Define Properties of Convolution?
3. What is the Difference Between Convolution& Correlation?
4. What are Dirchlet Conditions of Fourier Series?
5. What is Half Wave Symmetry?
6. Define Linear Convolution?
7. Define Properties of Convolution in time domain?
8. What is the Difference Between Linear Convolution& Circular Correlation?
9. What are Dirchlet Conditions for Fourier Transform?
10. What is Full Wave Symmetry?

EXERCISE PROGRAMS
1. Write the MATLAB program to perform convolution between the following sequences X(n)=[1 -1
4 ], h(n) = [ -1 2 -3 1].
2. Write a mat lab program to perform the convolution between sinusoidal and ramp function and
see how mat lab reacts to it.
3. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
4. Write a MATLAB program to perform convolution between sinusoidal and ramp signal and see
how mat lab reacts to it.
5. Write a MATLAB program to perform the convolution between X (n) = [1 2 3 5] and y (n) = [- 1
2] and see how matlab reacts to it.
6. Write a MATLAB program to perform the convolution between X (n) = [1 -3 5] and y (n) = [1 2
3 4] and see how matlab reacts to it.
7. Write a MATLAB program to perform the convolution between X (n) = [1 0 1 1] and y (n) = [1 0
0 0 0] and see how matlab reacts to it.
8. Write a MATLAB program to perform the convolution between X (n) = [1 1 1 1 0 0 0 0] and y
(n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
9. Write a MATLAB program to perform the convolution between X (n) = [1 1 0 0] and y (n) = [1 1
1 1] and see how matlab reacts to it.
10. Write a MATLAB program to perform the convolution between X (n) = [6 7 8 9 10] and y (n)
= [5 4 3 2 1] and see how matlab reacts to it.
Department of Electronics and Communication Engineering Page 80
11. Write the MATLAB program to perform convolution between the following sequences X(n)=[2 -2
3 2], h(n) = [-2 4 -5 2].
12. Write a mat lab program to perform the convolution between step and ramp function and see
how mat lab reacts to it.
13. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
14. Write a MATLAB program to perform convolution between sinusoidal and square signal and see
how mat lab reacts to it.
15. Write a MATLAB program to perform the convolution between X (n) = [2 3 4 5] and y (n) = [-2
4] and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page 81


16. Write a MATLAB program to perform the convolution between X (n) = [3 -4 6] and y (n) = [2 6
8 6] and see how matlab reacts to it.
17. Write a MATLAB program to perform the convolution between X (n) = [3 1 2 0] and y (n) = [2
4 3 4 5] and see how matlab reacts to it.
18. Write a MATLAB program to perform the convolution between X (n) = [2 2 1 0 2 1 1 0] and
y (n) = [1 1 1 2 1 0 1 0] and see how matlab reacts to it.
19. Write a MATLAB program to perform the convolution between X (n) = [2 1 2 1] and y (n) = [1 2
1 2] and see how matlab reacts to it.
20. Write a MATLAB program to perform the convolution between X (n) = [5 6 9 8 7] and y (n)
= [1 2 3 2 1] and see how matlab reacts to it.
21. Write the MATLAB program to perform convolution between the following sequences X(n)=[4 -6
5 1], h(n) = [-1 3 -4 3].
22. Write a mat lab program to perform the convolution between ramp and step function and see
how mat lab reacts to it.
23. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
24. Write a MATLAB program to perform convolution between sinusoidal and step signal and see
how mat lab reacts to it.
25. Write a MATLAB program to perform the convolution between X (n) = [1 5 6 5] and y (n) = [-3
6] and see how matlab reacts to it.
26. Write a MATLAB program to perform the Circular Convolution between X (n) = [1 0 1 1 0]
and y (n) = [1 0 0 0 0 1] and see how matlab reacts to it.
27. Write a MATLAB program to perform the Circular Convolution between X (n) = [1 1 1 1 0 0
0 0] and y (n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
28. Write a MATLAB program to perform the Circular Convolution between X (n) = [1 1 0 0] and y
(n) = [1 1 1 1] and see how matlab reacts to it.
29. Write a MATLAB program to perform the Circular Convolution between X (n) = [6 7 8 9 10]
and y (n) = [5 4 3 2 1] and see how matlab reacts to it.
30. Write the MATLAB program to perform Circular Convolution between the following sequences
X(n)=[2 -2 3 2], h(n) = [-2 4 -5 2].

Department of Electronics and Communication Engineering Page 82


Real Time Applications:
The convolution is to determine the response y[n] of a system of a known impulse response h[n]
for a given input signal x[n] to obtain y[n].
Digital Image Processing Applications such as Compression and Restoration.

Department of Electronics and Communication Engineering Page 83


EXPERMENT NO: 6
AUTO CORRELATION AND CROSS CORRELATION BETWEEN
SIGNALS AND SEQUENCES

AIM: -
To compute auto correlation and cross correlation between signals and Sequences.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-
In Signal processing,When the autocorrelation function is normalized by mean and variance, it is
sometimes referred to as the autocorrelation [Link] a signal f(t), the continuous
autocorrelationRff(T) is most often defined as the continuous cross-correlation integral of f(t)with
itself, at lag T

The discrete autocorrelation Rat lag j for a discrete signal x(n) is

In signal processing, cross-correlation is a measure of similarity of two waveforms as a function of a


time-lag applied to one of them. This is also known as a sliding dot product or sliding inner- product.
It is commonly used for searching a long signal for a shorter, known feature. It has applications in
pattern recognition, single particle analysis, electron tomographic averaging, cryptanalysis, and
neurophysiology.

For continuous functions f and g, the cross-correlation is defined as:

Department of Electronics and Communication Engineering Page 84


where f* denotes the complex conjugate of f and t is the time lag.

Similarly, for discrete functions, the cross-correlation is defined as:

PROCEDURE:-

Department of Electronics and Communication Engineering Page 85


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:-
%Auto correlation for a signal% clc;
clear all;
close all; t=0:0.001:1;
x=cos(2*pi*3*t); a=xcorr(x); subplot(2,1,1);
plot(t,x,'g');
xlabel('time'); ylabel('amplitude'); title('input signal'); subplot(2,1,2);
plot(a,'r');
xlabel('time'); ylabel('amplitude');
title('auto correlation signal');

Department of Electronics and Communication Engineering Page 86


%cross correlation for a signal%

clc; clear all; close all;


t=0:0.001:1;
x=cos(2*pi*3*t); y=cos(2*pi*5*t); a=xcorr(x,y);
subplot(3,1,1);
plot(t,x,'g');
xlabel('time'); ylabel('amplitude'); title('1st signal'); subplot(3,1,2);
plot(t,y,'r');
xlabel('time'); ylabel('amplitude'); title('2nd signal'); subplot(3,1,3);
plot(a,'r');
xlabel('time'); ylabel('amplitude');
title('cross correlation signal');\
%Auto correlation for a sequence% clc;
clear all; close all;
x=input('enter sample values') a=xcorr(x);
subplot(2,1,1);
stem(x,'g');
xlabel('time'); ylabel('amplitude'); title('input sequence'); subplot(2,1,2);
stem(a,'r');
xlabel('time'); ylabel('amplitude');
title('auto correlation sequence');

Department of Electronics and Communication Engineering Page 87


%cross correlation for asequence%

clc; clear all; close all;


x=input('enter first sequence'); y=input('enter second sequence'); a=xcorr(x,y);
subplot(3,1,1);
stem(x,'g');
xlabel('time'); ylabel('amplitude'); title('1st sequence'); subplot(3,1,2);
stem(y,'r');
xlabel('time'); ylabel('amplitude'); title('2nd sequence'); subplot(3,1,3);
stem(a,'r');
xlabel('time'); ylabel('amplitude');
title('cross correlation sequence');

OUTPUT:-
Auto correlation for a signal

0.5

-0.5

-1

1000

Department of Electronics and Communication Engineering Page 88


input signal

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1


time
auto correlation signal

500

-500

Department of Electronics and Communication Engineering Page 89


0 500 1000 1500 2000 2500
time

Department of Electronics and Communication Engineering Page 90


cross correlation for a signal

-1
0

-1
0

100

-100
0

Department of Electronics and Communication Engineering Page 91


1st signal

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1


time 2nd signal

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1


time
cross correlation signal

500 1000 1500 2000 2500


time

Auto correlation for a sequence

enter sample values[1 2 3 4] x =


1 2 3 4

Department of Electronics and Communication Engineering Page 92


input sequence
4

0
1 1.5 2 2.5 3 3.5 4
time
auto correlation sequence
30

20

10

0
1 2 3 4 5 6 7
time

cross correlation for asequence

enter first sequence[1 2 3 4]


enter second sequence[1 2 3 4]

1st sequence
4

0
1 1.5 2 2.5 3 3.5 4
time
2nd sequence
4

Department of Electronics and Communication Engineering Page 93


0
1 1.5 2 2.5 3 3.5 4
time
cross correlation sequence
40

20

0
1 2 3 4 5 6 7
time

Department of Electronics and Communication Engineering Page 94


RESULT:-
In this experiment correlation of various signals have been performed Using MATLAB.

VIVA QUESTIONS:-
1. Define Correlation?
2. Define Auto-Correlation?
3. Define Cross-Correlation?
4. What is the importance of correlation?
5. What is the difference b/w correlation and convolution?
6. Explain two Properties of Auto-Correlation?
7. Explain two Properties of Cross-Correlation?
8. What is the difference b/w Auto-correlation and Cross-Correlation?
9. Define ESD?
10. Define PSD?

EXERCISE PROGRAMS

1. Write a MATLAB program to compute auto correlation between signals and Sequences.
x=cos(2*pi*10*t),y=cos(2*pi*15*t).
2. Write a MATLAB program to compute cross correlation between signals and Sequences.
x=cos(2*pi*7*t),y=cos(2*pi*14*t).
3. Write a MATLAB program to compute the cross correleation between signals and Sequences.
x=cos(2*pi*10*t),y=cos(2*pi*15*t) by increasing the amplitude of the signal by 3 times and verify
how matlab reacts to it.
4. Write a MATLAB program to compute the auto correleation between signals and Sequences.
x=cos(2*pi*15*t),y=cos(2*pi*10*t) by increasing the amplitude of the signal by 2 times and verify
how matlab reacts to it.
5. Write a MATLAB program to compute auto correlation between x =sin(2*pi*5*t) , y =
sin(2*pi*10*t). and see how matlab reacts to it.
6. Write a MATLAB program to compute cross correlation between x =sin(2*pi*5*t) , y =
cos(2*pi*10*t). and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page 95


7. Write a MATLAB program to compute cross correlation between two signals
x=9*cos(2*pi*7*t),y=5*cos(2*pi*14*t).

Department of Electronics and Communication Engineering Page 96


8. Write a MATLAB program to compute cross correlation between two Sequences [1 2 3 4
5]&[9 8 7 6 5].
9. Write a MATLAB program to compute auto correlation between two signals
x=9*cos(2*pi*7*t),y=5*cos(2*pi*14*t).
10. Write a MATLAB program to compute auto correlation between two Sequences [2 4 3 4 5]
& [7 9 4 6 3].
11. Write a MATLAB program to compute auto correlation between signals and Sequences.
x=cos(2*pi*20*t),y=cos(2*pi*10*t).
12. Write a MATLAB program to compute cross correlation between signals and Sequences.
x=cos(4*pi*8*t),y=cos(4*pi*10*t).

13. Write a MATLAB program to compute the cross correleation between signals and Sequences.
x=cos(2*pi*20*t),y=cos(2*pi*10*t) by increasing the amplitude of the signal by 2 times and verify
how matlab reacts to it.
14. Write a MATLAB program to compute the auto correleation between signals and Sequences.
x=cos(2*pi*5*t),y=cos(2*pi*20*t) by increasing the amplitude of the signal by 4 times and verify
how matlab reacts to it.
15. Write a MATLAB program to compute auto correlation between x =sin(2*pi*5*t) , y =
sin(4*pi*20*t). and see how matlab reacts to it.
16. Write a MATLAB program to compute cross correlation between x = sin(3*pi*5*t) , y =
cos(4*pi*5*t). and see how matlab reacts to it.
17. Write a MATLAB program to compute cross correlation between two signals
x=4*cos(2*pi*5*t),y=6*cos(2*pi*10*t).
18. Write a MATLAB program to compute cross correlation between two Sequences [2 6 4 8 5]
& [8 9 6 7 5].
19. Write a MATLAB program to compute auto correlation between two signals
x=5*cos(2*pi*10*t),y=5*cos(2*pi*10*t).
20. Write a MATLAB program to compute auto correlation between two Sequences [1 1 4 4 5]
& [9 9 7 5 5].
21. Write a MATLAB program to compute auto correlation between signals and Sequences.
x=cos(3*pi*10*t),y=cos(4*pi*5*t).

Department of Electronics and Communication Engineering Page 97


22. Write a MATLAB program to compute cross correlation between signals and Sequences.
x=cos(6*pi*6*t),y=cos(4*pi*5*t).
23. Write a MATLAB program to compute the cross correleation between signals and Sequences.
x=cos(2*pi*10*t),y=cos(2*pi*5*t) by increasing the amplitude of the signal by 3 times and verify
how matlab reacts to it.
24. Write a MATLAB program to compute the auto correleation between signals and Sequences.
x=cos(4*pi*5*t),y=cos(2*pi*5*t) by increasing the amplitude of the signal by 4 times and verify how
matlab reacts to it.
25. Write a MATLAB program to compute auto correlation between x =sin(4*pi*5*t) , y =
sin(4*pi*10*t). and see how matlab reacts to it.
26. Write a MATLAB program to compute auto correlation between x =sin(4*pi*2*t) , y =
sin(4*pi*20*t). and see how matlab reacts to it.
27. Write a MATLAB program to compute cross correlation between x = sin(3*pi*2*t) , y =
cos(5*pi*5*t). and see how matlab reacts to it.
28. Write a MATLAB program to compute auto correlation between two signals
x=4*cos(2*pi*10*t),y=6*cos(6*pi*10*t).
29. Write a MATLAB program to compute cross correlation between two Sequences [2 6 4 8 5]
& [8 9 6 7 5].
30. Write a MATLAB program to compute auto correlation between two signals
x=5*cos(8*pi*10*t),y=6*cos(7*pi*10*t).

Real Time Applications:

Correlation is used to extract second (and higher) order statistics from any random signal.
Explains Energy and Power of Continuous and discrete systems.

Department of Electronics and Communication Engineering Page 98


EXPERMENT NO:7
VERIFICATION OF LINEARITY AND TIME INVARIANCE PROPERTIES OF A GIVEN
CONTINUOUS /DISCRETE SYSTEM.

AIM: -

To compute linearity and time invariance properties of a given continuous /discrete System.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-

LINEARITY PROPERTY

Department of Electronics and Communication Engineering Page 99


LINEAR TIME INVARIENT SYSTEMS(LTI)

PROCEDURE:-

Department of Electronics and Communication Engineering Page


100
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

Department of Electronics and Communication Engineering Page


101
PROGRAM:-

%Program1:% clc;
clear all; close all;
n=0:40; a=2; b=1;
x1=cos(2*pi*0.1*n); x2=cos(2*pi*0.4*n); x=a*x1+b*x2; y=n.*x;
y1=n.*x1; y2=n.*x2; yt=a*y1+b*y2; d=y-yt; d=round(d)
if d
disp('Given system is not satisfy linearity property'); else
disp('Given system is satisfy linearity property'); end
subplot(3,1,1), stem(n,y); grid;
subplot(3,1,2), stem(n,yt); grid;
subplot(3,1,3), stem(n,d); grid;
%Program2:% clc;
clear all;
close all;
n=0:40; a=2; b=-3;
x1=cos(2*pi*0.1*n); x2=cos(2*pi*0.4*n); x=a*x1+b*x2; y=x.^2;
y1=x1.^2; y2=x2.^2; yt=a*y1+b*y2; d=y-yt;

Department of Electronics and Communication Engineering Page


102
d=round(d); if d
disp('Given system is not satisfy linearity property'); else
disp('Given system is satisfy linearity property'); end
subplot(3,1,1), stem(n,y); grid;
subplot(3,1,2), stem(n,yt); grid;
subplot(3,1,3), stem(n,d); grid;
%Program3:% clc;
close all; clear all; n=0:40; D=10;
x=3*cos(2*pi*0.1*n)-2*cos(2*pi*0.4*n); xd=[zeros(1,D) x];
y=n.*xd(n+D); n1=n+D;
yd=n1.*x; d=y-yd;
if d
disp('Given system is not satisfy time shifting property'); else
disp('Given system is satisfy time shifting property'); end
subplot(3,1,1),stem(y),grid;
subplot(3,1,2),stem(yd),grid;
subplot(3,1,3),stem(d),grid;

Department of Electronics and Communication Engineering Page


103
OUTPUT:-

Program1:

Department of Electronics and Communication Engineering Page


104
Program2:

Department of Electronics and Communication Engineering Page


105
Program3:

Department of Electronics and Communication Engineering Page


106
VIVA QUESTIONS:-
1. Define Systems?
2. What is LTI Systems?
3. Describe LTV Systems?
4. What is the importance of Linear Systems?
5. What is the difference b/w Linear and Non-Linear Systems?
6. Explain two Properties of LTI Systems?
7. Explain two Properties of LTV Systems?
8. What is the Superposition Principal?
9. What is Difference between CT and DT systems?
10. Define Causality of LTI Systems?

EXSERCISE QUESTIONS

1. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not.
2. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not
3. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the linearity property or not
4. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.
5. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not
6. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the time invariance property or not.
7. Write a MATLAB program to verify the time variance prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the time invariance property or not.
8. Write a MATLAB program to verify the non linearity prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the linearity property or not
9. Write a MATLAB program to verify the time variance prpoerty of the following sequency x1=

Department of Electronics and Communication Engineering Page


107
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.

Department of Electronics and Communication Engineering Page


108
10. Write a MATLAB program to verify the non linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not.
11. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not.
12. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not
13. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the linearity property or not
14. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.
15. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not
16. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the time invariance property or not.
17. Write a MATLAB program to verify the time variance prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the time invariance property or not.
18. Write a MATLAB program to verify the non linearity prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the linearity property or not
19. Write a MATLAB program to verify the time variance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.
20. Write a MATLAB program to verify the non linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not.
21. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not.
22. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the linearity property or not
23. Write a MATLAB program to verify the linearity prpoerty of the following sequency x1=
sin(2*pi*0.1*n); cos(2*pi*0.3*n), and chech whether it satisfies the linearity property or not
24. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.

Department of Electronics and Communication Engineering Page


109
25. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.
26. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*1*n); x2= sin(2*pi*12*n), and chech whether it satisfies the time invariance property or not
27. Write a MATLAB program to verify the time invariance prpoerty of the following sequency x1=
sin(2*pi*0.1*n); 2*cos(2*pi*0.5*n), and chech whether it satisfies the time invariance property or
not.
28. Write a MATLAB program to verify the time variance prpoerty of the following sequency x1=
cos(2*pi*0.1*n); cos(2*pi*0.4*n), and chech whether it satisfies the time invariance property or not.
29. Write a MATLAB program to verify the non linearity prpoerty of the following sequency x1=
sin(2*pi*0.1*n); sin(2*pi*0.3*n), and chech whether it satisfies the linearity property or not
30. Write a MATLAB program to verify the time variance prpoerty of the following sequency x1=6*
sin(2*pi*10*n); x2= sin(2*pi*2*n), and chech whether it satisfies the time invariance property or not.

Real Time Applications:


Wave Propagation such as sound and electromagnetic waves.
Electrical circuits composed of resistors, capacitors and inductors. Robotics
Applications.

Department of Electronics and Communication Engineering Page


110
EXPERMENT NO:8
COMPUTATION OF UNIT SAMPLE, UNIT STEP AND SINUSOIDAL RESPONSE OF THE
GIVEN LTI SYSTEM AND VERIFYING ITS PHYSICAL REALIZABILITY AND
STABILITY PROPERTIES.
AIM: -
To Unit Step And Sinusoidal Response Of The Given LTI System And Verifying Its Physical
Realizability And Stability Properties.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-
A discrete time system performs an operation on an input signal based on predefined criteria to
produce a modified output signal. The input signal x(n) is the system excitation, and y(n) is the system
response. The transform operation is shown as,

If the input to the system is unit impulse i.e. x(n) = (n) then the output of the system is known as
impulse response denoted by h(n) where,

h(n) = T[ (n)]

we know that any arbitrary sequence x(n) can be represented as a weighted sum of discrete impulses.

Department of Electronics and Communication Engineering Page


111
Now the system response is given by,

Department of Electronics and Communication Engineering Page


112
For linear system (1) reduces to

PROCEDURE:-

Department of Electronics and Communication Engineering Page


113
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

Department of Electronics and Communication Engineering Page


114
PROGRAM:-

%calculate and plot the impulse response and step response% clc;
clear all; close all; b=[1]; a=[1,-1,.9];
x=impseq(0,-20,120); n = [-20:120];
h=filter(b,a,x); subplot(3,1,1);stem(n,h); title('impulse response'); xlabel('n');ylabel('h(n)');
=stepseq(0,-20,120); s=filter(b,a,x);
s=filter(b,a,x);
subplot(3,1,2);
stem(n,s);
title('step response'); xlabel('n');ylabel('s(n)') t=0:0.1:2*pi; x1=sin(t);

%impseq(0,-20,120);

n = [-20:120];
h=filter(b,a,x1); subplot(3,1,3);stem(h); title('sin response'); xlabel('n');ylabel('h(n)'); figure;
zplane(b,a);

Department of Electronics and Communication Engineering Page


115
OUTPUT:-

plot the impulse response and step response

Department of Electronics and Communication Engineering Page


116
RESULT:-
In this experiment computation of unit sample, unit step and
sinusoidal response of the given lti system and verifying its physical realizability andstability
properties Using MATLAB.

VIVA QUESTIONS:-
1. What operations can be performed on signals and sequence?
2. Define causality?
3. Define scaling property and give its importance?
4. Define shifting property and give its importance?
5. Define folding property and give its importance?
6. Define stability?
7. Give the importance of Causality?
8. Give the importance of Stability?
9. Define Impulse Response?
Department of Electronics and Communication Engineering Page
117
10. Define Step Response?

Department of Electronics and Communication Engineering Page


118
EXERCISE PROGRAM:-
1. Write a MATLAB program for generating u(n)-u(n-1).
2. Write a MATLAB program for generating delayed unit step response
3. Write a MATLAB program for generating delayed impulse response
4. Write a MATLAB program for generating u(n)+u(n-1) and verify how matlab reacts to it.
5. write a MATLAB program to find the energy & power of the signal x(t)=10sin(10t).
6. write a MATLAB program to find the even & odd of the signal x(t)=e^2t.
7. write a MATLAB program to find the even & odd of the signal x(t)=sin(t).
8. write a MATLAB program to find the even & odd of the signal x(t)=cos(t).
9. write a MATLAB program to find the energy & power of the signal x(t)=sin(t).
10. write a MATLAB program to find the energy & power of the signal x(t)=e^2t.
11. Write a MATLAB program for generating u(n-2)-u(n-1).
12. Write a MATLAB program for generating delayed step response with magnitude 2
13. Write a MATLAB program for generating delayed impulse response with magnitude 2.
14. Write a MATLAB program for generating u(n+1)+u(n-1) and verify how matlab reacts to it.
15. Write a MATLAB program to find the energy & power of the signal x(t)=20sin(5t).
16. Write a MATLAB program to find the even & odd of the signal x(t)=e^3t.
17. Write a MATLAB program to find the even & odd of the signal x(t)=sin(t)+cos(t).
18. Write a MATLAB program to find the even & odd of the signal x(t)=cos(t)-sin(t).
19. Write a MATLAB program to find the energy & power of the signal x(t)=sin(t)-cos(t).
20. Write a MATLAB program to find the energy & power of the signal x(t)=e^4t.
21. Write a MATLAB program for generating u(n+2)-u(n-1).
22. Write a MATLAB program for generating delayed unit step response
23. Write a MATLAB program for generating delayed impulse response
24. Write a MATLAB program for generating u(n-3)+u(n-1) and verify how matlab reacts to it.
25. Write a MATLAB program to find the energy & power of the signal x(t)=5sin(20t).
26. Write a MATLAB program to find the energy & power of the signal x(t)=30sin(5t).
27. Write a MATLAB program to find the even & odd of the signal x(t)=e^4t.
28. Write a MATLAB program to find the even & odd of the signal x(t)=sin(t)-cos(t).
29. Write a MATLAB program to find the even & odd of the signal x(t)=cos(t)-2sin(t).
30. Write a MATLAB program to find the energy & power of the signal x(t)=sin(t)-3cos(t).

Department of Electronics and Communication Engineering Page


119
Real Time Applications:
Electronic Circuits such as amplifiers and filters.
Mechanical motion from the interaction of masses, springs and dashpots (dampers). LTI
systems

Department of Electronics and Communication Engineering Page


120
EXPERMENT NO:9
DEMONSTRATION OF GIBBS PHENOMENON

AIM: -
To demonstrate Gibbs Phenomenon using MATLAB.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-

Gibbs Phenomenon:
The peculiar manner in which the Fourier series of a piecewise continuously differentiable periodic
function behaves at a jump discontinuity: the nth partial sum of the Fourier series has large
oscillations near the jump, which might increase the maximum of the partial sum above that of the
function itself. The overshoot does not die out as the frequency increases, but approaches a finite
limit.
The Gibbs phenomenon involves both the fact that Fourier sums overshoot at a jump discontinuity,
and that this overshoot does not die out as the frequency increases.
The best known version of the Gibbs phenomenon is the overshoot that arises when a discontinuous
function is represented by a truncated set of Fourier expansion terms. The situation is similar if the
truncated Fourier expansion is instead obtained by means of interpolation on an equispaced grid.

PROCEDURE:-

Department of Electronics and Communication Engineering Page


121
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

Department of Electronics and Communication Engineering Page


122
PROGRAM:-
%Gibbs phenomenon% clc;
clear all;
close all; t=0:0.01:1;
N=input('enter no of harmonics'); x=square(2*pi*t);
plot(t,x); hold on; gp=0;
for n=1:2:N;
gp=gp+(4/(n*pi))*sin(2*pi*n*t); end;
plot(t,gp); hold off; xlabel('time');
ylabel('amplitude'); title('gibbs phenomenon');

OUTPUT:-
Gibbs phenomenon

enter no of harmonics5

1.5

Department of Electronics and Communication Engineering Page


123
gibbs phenomenon

0.5

-0.5

-1
-1.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

time

Department of Electronics and Communication Engineering Page


124
RESULT:-
In this experiment Gibbs phenomenon have been demonstrated Using MATLAB.

EXERCISE PROGRAM:-
1. Write the MATLAB program to perform convolution between the following sequences X(n)=[1 8 9
3 ], h(n) = [ 2 4 5 9].
2. Write a mat lab program to perform the convolution between sinusoidal and ramp function and
see how mat lab reacts to it.
3. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
4. Write a MATLAB program to perform convolution between sinusoidal and ramp signal and see
how mat lab reacts to it.
5. Write a MATLAB program to perform the convolution between X (n) = [8 5 6 9] and y (n) = [- 1
2] and see how matlab reacts to it.
6. Write a MATLAB program to perform the convolution between X (n) = [1 -3 4 5] and y (n) = [1 2
3 4] and see how matlab reacts to it.
7. Write a MATLAB program to perform the convolution between X (n) = [1 0 1 1] and y (n) = [1 0
0 0 0] and see how matlab reacts to it.
8. Write a MATLAB program to perform the convolution between X (n) = [1 1 1 1 0 0 0 0] and
y (n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
9. Write a MATLAB program to perform the convolution between X (n) = [1 1 0 0] and y (n) = [1 1
1 1] and see how matlab reacts to it.
10. Write a MATLAB program to perform the convolution between X (n) = [6 9 7 5 2] and y (n)
= [8 5 6 4 2] and see how matlab reacts to it.
11. Write the MATLAB program to perform convolution between the following sequences X(n)=[2 4 9
3], h(n) = [1 3 7 5].
12. Write a mat lab program to perform the convolution between step and ramp function and see
how mat lab reacts to it.
13. Write a MATLAB program to perform convolution between sinusoidal and step signal and see
how mat lab reacts to it.
14. Write a MATLAB program to perform convolution between impulse and ramp signal and see
how mat lab reacts to it.

Department of Electronics and Communication Engineering Page


125
15. Write a MATLAB program to perform the convolution between X (n) = [3 2 6 9] and y (n) = [-2
4] and see how matlab reacts to it.
16. Write a MATLAB program to perform the convolution between X (n) = [2 -4 2 5] and y (n)
= [4 2 3 4] and see how matlab reacts to it.
17. Write a MATLAB program to perform the convolution between X (n) = [2 1 0 1] and y (n) = [1
0 1 1] and see how matlab reacts to it.
18. Write a MATLAB program to perform the convolution between X (n) = [1 2 1 2 0 1 0 1] and
y (n) = [2 0 1 1 0 0 2 0] and see how matlab reacts to it.
19. Write a MATLAB program to perform the convolution between X (n) = [2 2 0 2] and y (n) = [1 1
2 2] and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page


126
20. Write a MATLAB program to perform the convolution between X (n) = [2 1 4 5 3] and y (n)
= [2 1 6 2 1] and see how matlab reacts to it.
21. Write the MATLAB program to perform convolution between the following sequences X(n)=[2 8 7
3], h(n) = [1 4 2 9].
22. Write a mat lab program to perform the convolution between sinusoidal and ramp function and
see how mat lab reacts to it.
23. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
24. Write a MATLAB program to perform convolution between sinusoidal and ramp signal and see
how mat lab reacts to it.
25. Write a MATLAB program to perform the convolution between X (n) = [4 5 2 1] and y (n) = [-2
1] and see how matlab reacts to it.
26. Write a MATLAB program to perform the correlation between X (n) = [1 1 1 1 0 0 0 0] and
y (n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
27. Write a MATLAB program to perform the correlation between X (n) = [1 1 0 0] and y (n) = [1 1
1 1] and see how matlab reacts to it.
28. Write a MATLAB program to perform the correlation between X (n) = [6 9 7 5 2] and y (n) = [8
5 6 4 2] and see how matlab reacts to it.
29. Write the MATLAB program to perform correlation between the following sequences X(n)=[2 4 9
3], h(n) = [1 3 7 5].
30. Write a mat lab program to perform the correlation between step and ramp function and see how
mat lab reacts to it.

VIVA QUESTIONS:-
1. Define Phenomenon?
2. What is the importance of
3. What is Static and Dynamic System?
4. What is Causal Signal?
5. What is Causality Condition of the Signal?
6. Define Noise?
7. What is the importance of FS?
8. What is the importance of FT?
9. Define LTV system?
Department of Electronics and Communication Engineering Page
127
10. Define LTI system?

Real Time Applications:

The Gibbs phenomenon, discovered by Henry Wilbraham and rediscovered by J. Willard Gibbs
(1899), is the peculiar manner in which the Fourier series ofa piecewise continuously
differentiable periodic function behaves at a jump discontinuity.
To Eliminate noise in Filters.

Department of Electronics and Communication Engineering Page


128
EXPERMENT NO: 10

FINDING THE FOURIER TRANSFORM OF A GIVEN SIGNAL AND PLOTTING ITS


MAGNITUDE AND PHASE SPECTRUM

AIM: -
To obtain Fourier Transform and Inverse Fourier Transform of a given signal / sequence and to plot its
Magnitude and Phase Spectra.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-

Fourier Transform Theorems:


We may use Fourier
a function which is zero outside of some interval [ L/2, L/2]. Then for any T L we may
T/2,T/2], where the "amount" of the wave by
in the given

By definition

Department of Electronics and Communication Engineering Page


129
The fast Fourier transform (FFT) is an efficient algorithm for computing the DFT of a sequence; it is
not a separate transform. It is particularly useful in areas such as signal and image processing, where
its uses range from filtering, convolution, and frequency analysis to power spectrum estimation

For length N input vector x, the DFT is a length N vector X, with elements

N
X(k) = sum x(n)*exp(-j*2*pi*(k-1)*(n-1)/N), 1 <= k <= N. n=1
The inverse DFT (computed by IFFT) is given by N
x(n) = (1/N) sum X(k)*exp( j*2*pi*(k-1)*(n-1)/N), 1 <= n <= N. k=1

PROCEDURE:-

Department of Electronics and Communication Engineering Page


130
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:-
%Fourier Transform% clc
clear all;
close all; syms t;
x=exp(-2*t)*heaviside(t); y=fourier(x);
disp('Fourier Transform of input signal'); y
z=ifourier(y);
disp('Inverse Fourier Transform of input signal'); z
mg=abs(y); subplot(2,1,1);

Department of Electronics and Communication Engineering Page


131
ezplot(mg); xlabel('time'); ylabel('amplitude');
title('magnitude spectrum of a input signal'); grid;
pha=atan(imag(y)/real(y)); subplot(2,1,2); ezplot(pha);
xlabel('time'); ylabel('amplitude');
title('phasespectrum of a input signal'); grid;

OUTPUT:-

Fourier Transform

Fourier Transform of input signal Y=


1/(2+w*i)
Inverse Fourier Transform of input signal Z=
Heaviside(x)/exp(2*x)

Department of Electronics and Communication Engineering Page


132
magnitude spectrum of a input signal

0.5

0.4
amplitude

0.3

0.2

-6 -4 -2 0 2 4 6
time phasespectrum of a input signal
1
amplitude

-1

-6 -4 -2 0 2 4 6
time

RESULT:-
In this experiment the fourier transform of a given signal and plotting
its magnitude and phase spectrum have been demonstrated using MATLAB.

VIVA QUESTIONS:-
1. Define Fourier Series?
2. What are the properties of Continuous-Time Fourier Series?
3. What is the Sufficient condition for the existence of F.T?
Department of Electronics and Communication Engineering Page
133
4. Define the F.T of a signal?
5. What is the difference b/w F.T&F.S?
6. Define Scaling Property of FT?
7. Explain Time Convolution Property of FT?
8. Explain Frequency Convolution Property of FT?
9. Explain the linearity property? [Link] the advantages of FT?

Department of Electronics and Communication Engineering Page


134
EXERCISE PROGRAMS
1. Write a MATLAB program to find the cross correlation using FFT.
2. Write a MATLAB program to find F.T of the causal signal x(t)=t
3. Write a MATLAB program to find F.T of the causal signal x(t)=e^-at
4. Write a MATLAB program to find F.T of the causal signal x(t)=e^at
5. Write a MATLAB program to find F.T of the causal signal x(t)=te^at
6. Write a MATLAB program to find F.T of the causal signal x(t)=te^-at
7. Write a MATLAB program to find F.T of the causal signal x(t)=cost
8. Write a MATLAB program to find F.T of the causal signal x(t)=sint
9. Write a MATLAB program to find F.T of the causal signal x(t)=e^atcos(t)
10. Write a MATLAB program to find F.T of the causal signal x(t)= e^atsin(t)
11. Write a MATLAB program to find the cross correlation using DFT.
12. Write a MATLAB program to find F.T of the causal signal x(t)=at
13. Write a MATLAB program to find F.T of the causal signal x(t)=10e^-at
14. Write a MATLAB program to find F.T of the signal x(t)=1
15. Write a MATLAB program to find F.T of the causal signal x(t)=impulse function
16. Write a MATLAB program to find F.T of the causal signal x(t)=Delta function
17. Write a MATLAB program to find F.T of the causal signal x(t)=cos(at)
18. Write a MATLAB program to find F.T of the causal signal x(t)=sin(at)
19. Write a MATLAB program to find F.T of the causal signal x(t)=e^atcos(at)
20. Write a MATLAB program to find F.T of the causal signal x(t)= e^atsin(at)
21. .Write a MATLAB program to find the auto correlation using FFT.
22. Write a MATLAB program to find F.T of the causal signal x(t)=5t
23. Write a MATLAB program to find F.T of the causal signal x(t)=5e^-at
24. Write a MATLAB program to find F.T of the causal signal x(t)=5e^at
25. Write a MATLAB program to find F.T of the causal signal x(t)=5te^at
26. Write a MATLAB program to find F.T of the causal signal x(t)=e^-2t
27. Write a MATLAB program to find F.T of the causal signal x(t)=e^5t
28. Write a MATLAB program to find F.T of the causal signal x(t)=te^4t
29. Write a MATLAB program to find F.T of the causal signal x(t)=te^-4t
30. Write a MATLAB program to find F.T of the causal signal x(t)=4cost

Department of Electronics and Communication Engineering Page


135
Real Time Applications:
Fourier transforms having following applications Analysis of differential equations
Fourier transform spectroscopy Quantum mechanics
Signal processing applications etc
.

Department of Electronics and Communication Engineering Page


136
EXPERMENT NO:11

LAPLACE TRANSFORM
AIM: -
To perform waveform synthesis using Laplace Transforms of a given signal

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-

Bilateral Laplace transform :


When one says "the Laplace transform" without qualification, the unilateral or one-sided transform is
normally intended. The Laplace transform can be alternatively defined as the bilateral Laplace
transform or two-sided Laplace transform by extending the limits of integration to be the entire real
axis. If that is done the common unilateral transform simply becomes a special case of the bilateral
transform where the definition of the function being transformed is multiplied by the Heaviside step
function.
The bilateral Laplace transform is defined as follows:

Inverse Laplace transform


The inverse Laplace transform is given by the following complex integral, which is known by various
names (the Bromwich integral, the Fourier-Mellin integral, and
Mellin's inverse formula):

Example :
Let y(t)=exp(t). We have

Department of Electronics and Communication Engineering Page


137
The integral converges if s>1. The functions exp(t) and 1/(s-1) are partner functions.
PROCEDURE:-
Open MATLAB Open new M-file Type the program
Save in current directory

Department of Electronics and Communication Engineering Page


138
PROGRAM:-
%Laplace Transform%

Department of Electronics and Communication Engineering Page


139
Compile and Run the program
For the output see command window\ Figure window

clc
clear all; close all; syms t;
x=exp(-2*t)*heaviside(t); y=laplace(x);
disp('Laplace Transform of input signal'); y
z=ilaplace(y);
disp('Inverse Laplace Transform of input signal'); z

OUTPUT:-
Laplace Transform

Laplace Transform of input signal Y=


1/(s+2)
Inverse Laplace Transform of input signal Z=
1/exp(2*t)

RESULT:-
Laplace and inverse laplace transforms were verified using MATLAB functions.
VIVA QUESTIONS:-
1. Define Laplace-Transform?
2. What is the Condition for Convergence of the L.T?
3. What is the Region of Convergence(ROC)?
4. State the Shifting property of L.T?
5. State convolution Property of L.T?
6. Define Scaling Property of L.T?
7. Explain Time Convolution Property of L.T?
8. Explain Frequency Convolution Property of L.T?
9. Explain the linearity property of L.T? [Link] the advantages of L.T?

Department of Electronics and Communication Engineering Page


140
EXERCISE PROGRAMS
1. Write a MATLAB program to find L.T of the causal signal x(t)=t^2
2. Write a MATLAB program to find L.T of the causal signal x(t)=t
3. Write a MATLAB program to find L.T of the causal signal x(t)=e^-at
4. Write a MATLAB program to find L.T of the causal signal x(t)=e^at
5. Write a MATLAB program to find L.T of the causal signal x(t)=te^at
6. Write a MATLAB program to find L.T of the causal signal x(t)=te^-at
7. Write a MATLAB program to find L.T of the causal signal x(t)=cost
8. Write a MATLAB program to find L.T of the causal signal x(t)=sint
9. Write a MATLAB program to find L.T of the causal signal x(t)=e^atcost
10. Write a MATLAB program to find L.T of the causal signalv x(t)= e^atsint.
11. Write a MATLAB program to find the cross correlation using DFT.
12. Write a MATLAB program to find L.T of the causal signal x(t)=at
13. Write a MATLAB program to find L.T of the causal signal x(t)=10e^-at
14. Write a MATLAB program to find L.T of the signal x(t)=1
15. Write a MATLAB program to find L.T of the causal signal x(t)=impulse function
16. Write a MATLAB program to find L.T of the causal signal x(t)=Delta function
17. Write a MATLAB program to find L.T of the causal signal x(t)=cos(at)
18. Write a MATLAB program to find L.T of the causal signal x(t)=sin(at)
19. Write a MATLAB program to find L.T of the causal signal x(t)=e^atcos(at)
20. Write a MATLAB program to find L.T of the causal signal x(t)= e^atsin(at)
21. .Write a MATLAB program to find the auto correlation using L.T.
22. Write a MATLAB program to find L.T of the causal signal x(t)=5t
23. Write a MATLAB program to find L.T of the causal signal x(t)=5e^-at
24. Write a MATLAB program to find L.T of the causal signal x(t)=5e^at
25. Write a MATLAB program to find L.T of the causal signal x(t)=5te^at
26. Write a MATLAB program to find L.T of the causal signal x(t)=e^4t
27. Write a MATLAB program to find L.T of the causal signal x(t)=te^5t
28. Write a MATLAB program to find L.T of the causal signal x(t)=te^-4t
29. Write a MATLAB program to find L.T of the causal signal x(t)=7cost
30. Write a MATLAB program to find L.T of the causal signal x(t)=5sint

Department of Electronics and Communication Engineering Page


141
Real Time Applications:
Laplace transforms having following applications Analysis of differential equations
Laplace transform spectroscopy Quantum mechanics
Signal processing applications etc

Department of Electronics and Communication Engineering Page


142
EXPERMENT NO:12
LOCATING THE ZEROS AND POLES AND PLOTTING THE POLE ZERO MAPS IN S-
PLANE AND Z-PLANE FOR THE GIVEN TRANSFER FUNCTION.

AIM: -
To locating the zeros and poles and plotting the pole zero maps in s-plane and z-plane for the given
transfer function.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-
A Transfer Function is the ratio of the output of a system to the input of a system,
in the Laplace domain considering its initial conditions to be zero. If we have an input function of
X(s), and an output function Y(s), we define the transfer function H(s) to be:

transfer function is the Laplace transform of a system s impulse response.

Given a continuous-time transfer function in the Laplace domain, H(s) or a discrete-time one in the Z-
domain, H(z), a zero is any value of s or z such that the transfer function is zero, and a pole is any
value of s or z such that the transfer function is infinite.

Zeros:1. The value(s) for z where the numerator of the transfer function equals zero
2. The complex frequencies that make the overall gain of the filter transfer function zero.
Poles: 1. The value(s) for z where the denominator of the transfer function equals zero
2. The complex frequencies that make the overall gain of the filter transfer function infinite.

Department of Electronics and Communication Engineering Page


143
Z-transforms
the Z-transform converts a discrete time-domain signal, which is a sequence of real or complex
numbers, into a complex frequency-domain [Link] Z-transform, like many other integral
transforms, can be defined as either a one-sided or two-sided transform.

Bilateral Z-transform
The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function X(z) defined as
Unilateral Z-transform

Alternatively, in cases where x[n] is defined only for n 0, the single-sided or unilateral Z-transform
is defined as

In signal processing, this definition is used when the signal is causal.

The roots of the equation P(z) = 0 correspond to the 'zeros' of X(z) The roots of the equation Q(z) = 0
correspond to the 'poles' of X(z)

PROCEDURE:-

Department of Electronics and Communication Engineering Page


144
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

Department of Electronics and Communication Engineering Page


145
PROGRAM:-

%locating poles of zero on s-plane% clc;


clear all; close all;
num=input('enter numerator co-efficients'); den=input('enter denominator co-efficients');
h=tf(num,den);
poles=roots(den); zeros=roots(num); sgrid;
pzmap(h); grid on;
title('locating poles of zeros on s-plane');
%locating poles &zeros on z-plane% clc;
clear all; close all;
num=input('enter numerator coefficient'); den=input('enter denominator coefficient'); p=roots(den);
z=roots(num); zplane(p,z); grid;
title('locating poler and zeros on s-plane');

Department of Electronics and Communication Engineering Page


146
OUTPUT:-
locating poles of zero on s-plane

enter numerator coefficient[1 2 3]


enter denominator coefficient[7 6 5]

1.4 1.5
0.5 0.36 0.27 0.19 0.12 0.06
1.2
0.66

0.8
1
0.6
0.88
0.4
0.2
0.5

0.2
0.4
0.88 0
0.6
0.8

0.66
1.2 -0.5
0.5 0.36 0.27 0.19 0.12 0.06
1.4

-1

-1.5
-1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0

Department of Electronics and Communication Engineering Page


147
locating poles &zeros on z-plane

enter numerator coefficient[1 2 3]


enter denominator coefficient[1 2 3]

Department of Electronics and Communication Engineering Page


148
1.5

0.5
Imaginary Part

-0.5

-1

-1.5

Department of Electronics and Communication Engineering Page


149
locating poler and zeros on s-plane

-1.5 -1 -0.5 0 0.5 1 1.5


Real Part

RESULT:-
In this experiment the zeros and poles and plotting the pole zero maps in s-plane and z-plane for the
given transfer function using MATLAB.
VIVA QUESTIONS:-
1. Study the details of ztrans() and iztrans() functions?
2. What are poles and zeros?
3. How you specify the stability based on poles and zeros?
4. Define S-plane and Z-plane?
5. What is the difference b/w S-plane and Z-plane?
6. Define Scaling Property of Z-plane?
7. Explain Time Convolution Property of Z-plane?
8. Explain Frequency Convolution Property of Z-plane
9. Explain the linearity property of Z-plane? [Link] the advantages of Z-plane?

Department of Electronics and Communication Engineering Page


150
EXERCISE PROGRAMS

1. Write a MATLAB program to find the impulse response of the following difference equation 3y(n)-
5y(n-1)+4y(n-2)=x(n)-2x(n-1).
2. Write a MATLAB program to find the impulse response of the following difference equation 6y(n)-
9y(n-1)-4y(n-2)=x(n)-5x(n-1).
3. Write a MATLAB program to find the impulse response of the following difference equation 8y(n)-
6y(n-1)+4y(n-2)=x(n)+2x(n-1).
4. Write a MATLAB program to find the impulse response of the following difference equation 3y(n)
+5y(n-1)+9y(n-2)=x(n)-9x(n-1).
5. Write a MATLAB program to find the impulse response of the following difference equation 6y(n)-
5y(n-1)+4y(n-2)=x(n)-2x(n-1).
6. Write a MATLAB program to find the impulse response of the following difference equation 7y(n)-
5y(n-1)+4y(n-2)=x(n)-9x(n-1).
7. Write a MATLAB program to find the impulse response of the following difference equation 3y(n)-
5y(n-1)+4y(n-2)=x(n)-6x(n-1).
8. Write a MATLAB program to find the impulse response of the following difference equation 5y(n)-
5y(n-1)+5y(n-2)=x(n)-2x(n-1).
9. Write a MATLAB program to find the impulse response of the following difference equation 3y(n)-6
y(n-1)+4y(n-2)=x(n)-7x(n-1).
10. Write a MATLAB program to find the impulse response of the following difference equation
2y(n)-5y(n-1)+4y(n-2)=x(n)-2x(n-1).
11. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)-5y(n-1)+4y(n-2)=5x(n)-6x(n-1).
12. Write a MATLAB program to find the impulse response of the following difference equation
6y(n)-8y(n-1)-4y(n-2)=7x(n)-5x(n-1).
13. Write a MATLAB program to find the impulse response of the following difference equation
8y(n)-8y(n-1)+9y(n-2)=x(n)+5x(n-1).
14. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)+9y(n-1)+9y(n-2)=9x(n)-5x(n-1).
15. Write a MATLAB program to find the impulse response of the following difference equation
6y(n)-5y(n-1)+4y(n-2)=7x(n)-2x(n-1).
16. Write a MATLAB program to find the impulse response of the following difference equation
Department of Electronics and Communication Engineering Page
151
7y(n)-5y(n-1)+4y(n-2)=x(n)-7x(n-1).
17. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)-5y(n-1)+4y(n-2)=x(n)-6x(n-1).
18. Write a MATLAB program to find the impulse response of the following difference equation
5y(n)-5y(n-1)+5y(n-2)=7x(n)-2x(n-1).
19. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)-6 y(n-1)+4y(n-2)=4x(n)-x(n-1).
20. Write a MATLAB program to find the impulse response of the following difference equation
2y(n)-5y(n-1)+4y(n-2)=x(n)-2x(n-1).
21. Write a MATLAB program to find the impulse response of the following difference equation

Department of Electronics and Communication Engineering Page


152
7y(n)-5y(n-1)+y(n-2)=x(n)-7x(n-1).
22. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)-5y(n-1)+4y(n-2)=x(n)-6x(n-1)+u(n)
23. Write a MATLAB program to find the impulse response of the following difference equation
5y(n)-5y(n-1)+5y(n-2)=7x(n)-2x(n-1)+u(n).
24. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)-6 y(n-1)+4y(n-2)=4x(n)-x(n-1)+u(n).
25. Write a MATLAB program to find the impulse response of the following difference equation
2y(n)-5y(n-1)+4y(n-2)=x(n)-2x(n-1)+u(n).
26. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)-5y(n-1)+4y(n-2)=4x(n)-12x(n-1).
27. Write a MATLAB program to find the impulse response of the following difference equation
6y(n)-9y(n-1)-4y(n-2)=6x(n)-15x(n-1).
28. Write a MATLAB program to find the impulse response of the following difference equation
8y(n)-6y(n-1)+4y(n-2)=8x(n)+2x(n-1).
29. Write a MATLAB program to find the impulse response of the following difference equation
3y(n)+5y(n-1)+9y(n-2)=5x(n)-9x(n-1).
30. Write a MATLAB program to find the impulse response of the following difference equation
6y(n)-5y(n-1)+4y(n-2)=x(n)-6x(n-1).

Real Time Applications:


Z- Transforms having following applications Analysis of differential equations
Z- transform spectroscopy Quantum mechanics
Signal processing applications etc
Conversion of analog signals to digital signals etc

Department of Electronics and Communication Engineering Page


153
EXPERMENT NO:13 GAUSSIAN NOISE
AIM: -
To Generate Gaussian Noise and to Compute its Mean, M.S. Values, Skew, kurtosis, PS and PDF.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-
Gaussian noise is statistical noise that has a probability density function (abbreviated pdf) of
the normal distribution (also known as Gaussian distribution). In other words, the values tha the noise
can take on are Gaussian-distributed. It is most commonly used as additive white noise to yield
additive white Gaussian noise (AWGN).Gaussian noise is properly defined as the noise with a
Gaussian amplitude [Link] nothing of the correlation of the noise in time or of the spectral
density of the [Link] Gaussian noise as 'white' describes the correlation of the noise. It is
necessary to use the term "white Gaussian noise" to be correct. Gaussian noise is sometimes
misunderstood tobe white Gaussian noise, but this is not the case.

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:-
%Gaussion noise%
clc; close all; clear all;
N=input('enter no of samples'); R1=rand(1,N);
M=mean(R1);

Department of Electronics and Communication Engineering Page


154
v=var(R1); x=psd(R1); subplot(2,2,1); plot(R1);
xlabel('sample numbers'); ylabel('amplitude');
title('normal distributed random signal'); subplot(2,2,2);
hist(R1);
xlabel('sample numbers'); ylabel('total');
title('histogram of a random signal'); subplot(2,2,[3,4]);
plot(x);
xlabel('sample numbers'); ylabel('amplitude');
title('psd of a normal random signal');

OUTPUT:-
Gaussion noise
enter no of samples50

Department of Electronics and Communication Engineering Page


155
normal distributed random signal
1

Department of Electronics and Communication Engineering Page


156
histogram of a random signal
8

6
amplitude

total
0.5 4

0
0 20 40 60
sample numbers

Department of Electronics and Communication Engineering Page


157
0
0 0.5 1
sample numbers
psd of a normal random signal
10

6
amplitude

2
0
0 5 10 15 20 25 30
sample numbers

RESULT:-
Additive White Gaussian noise was generated and its PSD and PDF were plotted and its Mean,
Standard Deviation, Kurtosis, Skew were Computed using MATLAB functions.

VIVA QUESTIONS:-
1. What is a noise and how many types of noises are there?
2. What is gaussion noise?
3. What is Auto-correlation ?
4. State energy theorem for a periodic signal?
5. What is Signum function?
6. How many types of correlation are there?
7. State Power theorem for a periodic signal?
8. What is Cross-correlation ?
9. Define ESD? Explain the relation between ESD and Auto-correlation ?
10. Define PSD? Explain the relation between PSD and Auto-correlation ?

Department of Electronics and Communication Engineering Page


158
EXERCISE PROGRAMS
1. Write a MATLAB program to plot the co-sinusoidal signal.
2. Write a MATLAB program to subtract two sinusoidal signals.
3. Write a MATLAB program to subtract and multiply two sinusoidal signals.
4. Write a MATLAB program to right shift the signal to 5 times of the original signal.
5. Write a MATLAB program to left shift the signal to 8 times of the original signal.
6. Write a MATLAB program to add two different signals with 2 <t<5
7. Write a MATLAB program to shift a positive time line signal to negative timeline signal.
8. Write a MATLAB program to subtract co-sinusoidal signals.
9. Write a MATLAB program to subtract two sinusoidal signals
10. Write a MATLAB program to division and multiply two co-sinusoidal signals.
11. Write a MATLAB program to generate time scaling of a sequence.
12. Write a MATLAB program to generate time shifting of a sequence.
13. Write a MATLAB program to generate time folding of a sequence.
14. Write a MATLAB program to generate amplitude scaling of a sequence with amplitude 5.
15. Write a MATLAB program to generate time scaling of a sequence with time 2sec.
16. Write a MATLAB program to add two different signals with 4 <t<8
17. Write a MATLAB program to shift a negative time line signal to positive timeline signal.
18. Write a MATLAB program to subtract sinusoidal signals.
19. Write a MATLAB program to subtract and divide two sinusoidal signals
20. Write a MATLAB program to add and multiply two co-sinusoidal signals.
21. Write a MATLAB program to generate time scaling of a signal.
22. Write a MATLAB program to generate time shifting of a signal.
23. Write a MATLAB program to generate time folding of a signal.
24. Write a MATLAB program to generate amplitude scaling of a sequence with amplitude 10.
25. Write a MATLAB program to generate time scaling of a sequence with time 5sec.
26. Write a MATLAB program to compute auto correlation between x =sin(4*pi*2*t) , y =
sin(4*pi*20*t). and see how matlab reacts to it.
27. Write a MATLAB program to compute cross correlation between x = sin(3*pi*2*t) , y =
cos(5*pi*5*t). and see how matlab reacts to it.
28. Write a MATLAB program to compute auto correlation between two signals
x=4*cos(2*pi*10*t),y=6*cos(6*pi*10*t).

Department of Electronics and Communication Engineering Page


159
29. Write a MATLAB program to compute cross correlation between two Sequences [2 6 4 8 5]
& [8 9 6 7 5].
30. Write a MATLAB program to compute auto correlation between two signals
x=5*cos(8*pi*10*t),y=6*cos(7*pi*10*t).
Real Time Applications:
Stream processing Vector processing
Digital processing applications

Department of Electronics and Communication Engineering Page


160
EXPERMENT NO:14 SAMPLING THEORM
AIM: -
To Demonstrate Sampling Theorem and aliasing effect using MATLAB.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-
Sampling Theorem:
The theorem shows that a band limited analog signal that has been sampled can be perfectly
reconstructed from an infinite sequence of samples if the sampling rate exceeds 2B samples per
second, where B is the highest frequency in the original signal.
If a signal contains a component at exactly B hertz, then samples spaced at exactly 1/(2B) seconds do
not completely determine the signal, Shannon's statement notwithstanding.

Proof: Let g(t) be a bandlimited signal whose bandwidth is fm (wm = 2 fm).

Figure 2: (a) Original signal g(t) (b) Spectrum G(w)


(t) is the sampling signal with fs = 1/T > 2fm.

Department of Electronics and Communication Engineering Page 161


Figure 3: (a) sampling signal (t) ) (b) Spectrum (w)

Let gs(t) be the sampled signal. Its Fourier Transform Gs(w) isgiven by

Department of Electronics and Communication Engineering Page 162


Figure 4: (a) sampled signal gs(t) (b) Spectrum Gs(w)

To recover the original signal G(w):


1. Filter with a Gate function, H2wm(w) of width 2wm Scale it by T.

Department of Electronics and Communication Engineering Page 163


Figure 5: Recovery of signal by filtering with a fiter of width 2wm

Department of Electronics and Communication Engineering Page 164


Aliasing
{ Aliasing is a phenomenon where the high frequency components of the sampled signal interfere
with each other because of inadequate sampling ws < 2wm.

Figure 6: Aliasing due to inadequate sampling

Aliasing leads to distortion in recovered signal. This is the


reason why sampling frequency should be atleast twice thebandwidth of the signal.

PROCEDURE:-

Department of Electronics and Communication Engineering Page 165


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

Department of Electronics and Communication Engineering Page 166


PROGRAM:-
%sampling theorem% clc;
clear all; close all; t=0:0.001:1; f=5;
x=cos(2*pi*f*t); plot(t,x);

%when fs>2fm%

fs1=3*f; ts1=1/fs1; n1=0:ts1:1;


xs1=cos(2*pi*f*n1); figure; plot(n1,xs1,'r');
hold on; plot(t,x); hold off;
%when fs=2fm%

fs2=2*f; ts2=1/fs2; n2=0:ts2:1;


xs2=cos(2*pi*f*n2); figure; plot(n2,xs2,'r');
hold on; plot(t,x); hold off;
%when fs<2fm%

fs3=1.5*f; ts3=1/fs3; n3=0:ts3:1;


xs3=cos(2*pi*f*n3); figure; plot(n3,xs3,'r');
hold on; plot(t,x); hold off;

Department of Electronics and Communication Engineering Page 167


OUTPUT:-
sampling theorem

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

when fs>2fm

0.8

0.6

0.4

0.2

-0.2

Department of Electronics and Communication Engineering Page 168


-0.4

-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Department of Electronics and Communication Engineering Page 169


when fs=2fm

0.8

0.6

0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

when fs<2fm

0.8

0.6

0.4

0.2

-0.2

-0.4

Department of Electronics and Communication Engineering Page 170


-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Department of Electronics and Communication Engineering Page 171


RESULT:-
In this experiment the sampling theorem have been verified using MATLAB.

VIVA QUESTIONS:-

1. State energy theorem for a periodic signal?


2. Define sampling Theorem?
3. What is Aliasing Effect?
4. what is Under sampling?
5. What is Over sampling?
6. Give the importance of Natural Sampling?
7. Give the importance of Flat-top Sampling?
8. Give the importance of ideal Sampling?
9. What is Anti-Aliasing Effect?
10. Define Stability of LTI system?

EXERCISE PROGRAM:-

1. Write a MATLAB program to find the effect of up sampling in frequency domain.


2. Write a matlab program to get the above output where t0 = 2
3. Write a MATLAB program to find the effect of up sampling in frequency domain for 20khz.
4. Write a program to get the following output t = -1: -5
5. Write mat lab program to get the above output X(t) = 1; (0<t<2)
= 10;(2<t<15) Note: Add ramp and unit
6. Write a matlab program to generate a sine wave with amplitude = 3, frequency 20Hz.
7. Write a matlab program to generate a cos wave with amplitude = 3, frequency 20Hz.
8. Write a matlab program to generate a triangular wave with amplitude = 8, frequency 10Hz.
9. Write a matlab program to generate a square wave with amplitude = 2, frequency 10kHz.
10. Write a matlab program to generate the signum function.

Department of Electronics and Communication Engineering Page 172


11. Write a matlab program to generate exponential growing signal.
12. Write a matlab program to generate exponential decaying signal.
13. Write a matlab program to generate a triangular wave with amplitude = 6,frequency 1Hz.
14. Write a matlab program to generate a square wave with amplitude = 5, frequency 5kHz.
15. Write a matlab program to generate a sawtooth wave with amplitude = 8, frequency5Khz.
16. Write a matlab program to generate a sine wave with amplitude = 5, frequency 5Hz.
17. Write a matlab program to generate a cos wave with amplitude = 4, frequency 10Hz.
18. Write a matlab program to generate a triangular wave with amplitude = 5, frequency 4Hz.

Department of Electronics and Communication Engineering Page 173


19. Write a matlab program to generate a square wave with amplitude = 1, frequency 20kHz.
20. Write a matlab program to generate the signum function.
21. Write a matlab program to generate a square wave with amplitude = 4, frequency 5kHz.
22. Write a matlab program to generate a triangular wave with amplitude = 6, frequency 6Hz.
23. Write a matlab program to generate a triangular wave with amplitude = 8,frequency 2Hz.
24. Write a matlab program to generate a square wave with amplitude = 7, frequency 5kHz.
25. Write a matlab program to generate a sawtooth wave with amplitude =10, frequency 10Khz.
26. Write a matlab program to generate the step function.
27. Write a matlab program to generate exponential growing signal of amplitude =5.
28. Write a matlab program to generate exponential decaying signal of amplitude =7..
29. Write a matlab program to generate a triangular wave with amplitude = 7,frequency 1Hz.
30. Write a matlab program to generate a square wave with amplitude = 7, frequency 10kHz.

Real Time Applications:


Industrial control and automation (Control the velocity or position of an object)
Examples: Controlling the position of a valve or shaft of a motor
Examples: Digital processing applications TV reception
RADAR SONAR

Department of Electronics and Communication Engineering Page 174


EXPERMENT NO:15

REMOVAL OF NOISE BY AUTO CORRELATION/CROSS CORRELATION


AIM: -

removal of noise by auto correlation/cross correlation.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-

Detection of a periodic signal masked by random noise is of greate importance .The noise signal
encountered in practice is a signal with random amplitude variations. A signal is uncorrelated with
any periodic signal. If s(t) is a periodic signal and n(t) is a noise signal then

T/2 1/T
Lim S(t)n(t-T) dt=0 for all T T -T/2

Qsn(T)= cross correlation function of s(t) and n(t) Then Qsn(T)=0 Detection by Auto-Correlation:
S(t)=Periodic Signal mixed with a noise signal n(t).Then f(t) is [s(t ) + n(t) ] Let Qff(T) =Auto
Correlation Function of f(t)
Qss(t) = Auto Correlation Function of S(t) Qnn(T) = Auto Correlation Function of n(t)

T/2
Qff(T)= Lim 1/T f(t)f(t-T) dt T-> -T/2
T/2
= Lim 1/T [s(t)+n(t)][s(t-T)+n(t-T)] dt T-- -T/2
=Qss(T)+Qnn(T)+Qsn(T)+Qns(T)

Department of Electronics and Communication Engineering Page 175


The periodic signal s(t) and noise signal n(t) are uncorrelated Qsn(t)=Qns(t)=0 ;Then Qff(t)=Qss(t)
+Qnn(t)
The Auto correlation function of a periodic signal is periodic of the same frequency and the Auto
correlation function of a non periodic signal is tends to zero for large value of T since s(t) is a periodic
signal and n(t) is non periodic signal so Qss(T) is a periodic where
as aQnn(T) becomes small for large values of T Therefore for sufficiently large values of T Qff(T) is
equal to Qss(T).

Detection by Cross Correlation:


f(t)=s(t)+n(t)
Locally generated signal with same frequencyas that of S(t) T/2
Qfc (t) = Lim 1/T [s(t)+n(t)] [ c(t-T)] dt T-- -T/2
= Qsc(T)+Qnc(T)
C(t) is periodic function and uncorrelated with the random noise signal n(t). Hence Qnc(T0=0)
Therefore Qfc(T)=Qsc(T)

PROCEDURE:-

Department of Electronics and Communication Engineering Page 176


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

Department of Electronics and Communication Engineering Page 177


PROGRAM:-
%auto correlation% clc;
clear all; close all; t=0:0.1:pi*4;
s=sin(t); k=2;
subplot(6,1,1) plot(s); title('signal s'); xlabel('t');
ylabel('amplitude'); n = randn([1 126]); f=s+n; subplot(6,1,2) plot(f);
title('signal f=s+n'); xlabel('t'); ylabel('amplitude'); as=xcorr(s,s); subplot(6,1,3) plot(as);
title('auto correlation of s'); xlabel('t'); ylabel('amplitude'); an=xcorr(n,n); subplot(6,1,4)
plot(an);
title('auto correlation of n'); xlabel('t'); ylabel('amplitude'); cff=xcorr(f,f); subplot(6,1,5)
plot(cff);
title('auto correlation of f'); xlabel('t'); ylabel('amplitude'); hh=as+an;
subplot(6,1,6) plot(hh);
title('addition of as+an'); xlabel('t'); ylabel('amplitude');

Department of Electronics and Communication Engineering Page 178


%CROSS CORRELATION %

clc; clear all; close all;


t=0:0.1:pi*4;
s=sin(t); k=2;
%sk=sin(t+k); subplot(7,1,1) plot(s); title('signal s');
xlabel('t');ylabel('amplitude'); c=cos(t);
subplot(7,1,2) plot(c); title('signal c'); xlabel('t');
ylabel('amplitude'); n = randn([1 126]); f=s+n; subplot(7,1,3) plot(f);
title('signal f=s+n'); xlabel('t'); ylabel('amplitude'); asc=xcorr(s,c); subplot(7,1,4) plot(asc);
title('auto correlation of s and c'); xlabel('t');ylabel('amplitude'); anc=xcorr(n,c);
subplot(7,1,5) plot(anc);
title('auto correlation of n and c'); xlabel('t');ylabel('amplitude'); cfc=xcorr(f,c);
subplot(7,1,6) plot(cfc);
title('auto correlation of f and c'); xlabel('t');ylabel('amplitude'); hh=asc+anc;
subplot(7,1,7) plot(hh);
title('addition of asc+anc'); xlabel('t');ylabel('amplitude');

Department of Electronics and Communication Engineering Page 179


OUTPUT:-

auto correlation

Department of Electronics and Communication Engineering Page 180


CROSS CORRELATION

Department of Electronics and Communication Engineering Page 181


Department of Electronics and Communication Engineering Page 182
RESULT:-
In this experiment the removal of noise by autocorrelation/cross correlation have been verified using
MATLAB.

VIVA QUESTIONS:-
1. What is Causal Signal?
2. What are the Different types of Systems?
3. What is Linear System?
4. What is Signum function?
5. What is Static and Dynamic System?
6. Define Linear Convolution?
7. Define Properties of Convolution in time domain?
8. What is the Difference Between Linear Convolution& Circular Correlation?
9. What are Dirchlet Conditions for Fourier Transform?
10. What is Full Wave Symmetry?

EXERCISE PROGRAMS

1. Write a MATLAB program to find the cross correlation using FFT.


2. Write a mat lab program to perform the cross correlation between sinusoidal and ramp
function and see how mat lab reacts to it.
3. Write a MATLAB program to perform cross correlation between square and step signal and see
how mat lab reacts to it.
4. Write a MATLAB program to perform cross correlation between sinusoidal and ramp signal and
see how mat lab reacts to it.
5. Write a MATLAB program to perform the cross correlation between X (n) = [1 2 3 5] and y
(n) = [- 1 2] and see how matlab reacts to it.
6. Write a MATLAB program to perform the cross correlation between X (n) = [1 -3 5] and y
(n) = [1 2 3 4] and see how matlab reacts to it.
7. Write a MATLAB program to perform the cross correlation between X (n) = [1 0 1 1] and y
(n) = [1 0 0 0 0] and see how matlab reacts to it.
Department of Electronics and Communication Engineering Page 183
8. Write a MATLAB program to perform the cross correlation between X (n) = [1 1 1 1 0 0 0 0]
and y (n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
9. Write a MATLAB program to perform the cross correlation between X (n) = [1 1 0 0] and y (n)
= [1 1 1 1] and see how matlab reacts to it.
10. Write a MATLAB program to perform the cross correlation between X (n) = [6 7 8 9 10] and y
(n) = [5 4 3 2 1] and see how matlab reacts to it.
11. Write the MATLAB program to perform cross correlation between the following sequences
X(n)=[2 -2 3 2, h(n) = [-2 4 -5 2].

Department of Electronics and Communication Engineering Page 184


12. Write a mat lab program to perform the convolution between step and ramp function and see
how mat lab reacts to it.
13. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
14. Write a MATLAB program to perform convolution between sinusoidal and square signal and see
how mat lab reacts to it.
15. Write a MATLAB program to perform the convolution between X (n) = [2 3 4 5] and y (n) = [-2
4] and see how matlab reacts to it.
16. Write a MATLAB program to perform the convolution between X (n) = [3 -4 6] and y (n) = [2 6
8 6] and see how matlab reacts to it.
17. Write a MATLAB program to perform the convolution between X (n) = [3 1 2 0] and y (n) = [2
4 3 4 5] and see how matlab reacts to it.
18. Write a MATLAB program to perform the convolution between X (n) = [2 2 1 0 2 1 1 0] and
y (n) = [1 1 1 2 1 0 1 0] and see how matlab reacts to it.
19. Write a MATLAB program to perform the convolution between X (n) = [2 1 2 1] and y (n) = [1 2
1 2] and see how matlab reacts to it.
20. Write a MATLAB program to perform the convolution between X (n) = [5 6 9 8 7] and y (n)
= [1 2 3 2 1] and see how matlab reacts to it.
21. Write the MATLAB program to perform cross correlation between the following sequences
X(n)=[4 -6 5 1], h(n) = [-1 3 -4 3].
22. Write a mat lab program to perform the cross correlation between ramp and step function and
see how mat lab reacts to it.
23. Write a MATLAB program to perform cross correlation between square and step signal and see
how mat lab reacts to it.
24. Write a MATLAB program to perform cross correlation between sinusoidal and step signal and
see how mat lab reacts to it.
25. Write a MATLAB program to perform the convolution between X (n) = [1 5 6 5] and y (n) = [-3
6] and see how matlab reacts to it.
26. Write a MATLAB program to plot the co-sinusoidal signal.
27. Write a MATLAB program to subtract two sinusoidal signals.
28. Write a MATLAB program to subtract and multiply two sinusoidal signals.
29. Write a MATLAB program to right shift the signal to 5 times of the original signal.
30. Write a MATLAB program to left shift the signal to 8 times of the original signal.
Department of Electronics and Communication Engineering Page 185
Real Time Applications:
The cross correlation is to determine the response y[n] of a system of a known impulse
response h[n] for a given input signal x[n] to obtain y[n].
Digital signal processing applications

Department of Electronics and Communication Engineering Page 186


EXPERMENT NO:16
EXTRACTION OF PERIODIC SIGNAL MASKED BY NOISE USING CORRELATION

AIM: -
To generate a periodic sequence, corrupt it with zero mean White noise and extract the
sequence using periodic circular cross correlation.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.

THEORY:-
Removal of noise by Filtering is not the solution because noise contains power at all
frequencies. Hence we use correlation techniques.

The theorem is useful for analyzing linear time-invariant systems, LTI systems, when the inputs and
outputs are not square integrable, so their Fourier transforms do not exist. A corollary is that the
Fourier transform of the autocorrelation function of the output of an LTI system is equal to the
product of the Fourier transform of the autocorrelation function of the input of the system times the
squared magnitude of the Fourier transform of the system impulse response. This works even when
the Fourier transforms of the input and output signals do not exist because these signals are not square
integrable, so the system inputs and outputs cannot be directly related by the Fourier transform of the
impulse response. Since the Fourier transform of the autocorrelation function of a signal is the power
spectrum of the signal, this corollary is equivalent to saying that the power spectrum of the output is
equal to the power spectrum of the input times the power transfer function. This corollary is used in
the parametric method for power spectrum estimation.

PROCEDURE:-

Department of Electronics and Communication Engineering Page 187


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

Department of Electronics and Communication Engineering Page 188


PROGRAM:-
clc; clear all; close all; n=256;
k1=0:n-1;
x=cos(32*pi*k1/n)+sin(48*pi*k1/n); plot(k1,x);
%Module to find period of input signal k=2;
xm=zeros(k,1); ym=zeros(k,1); hold on;
for i=1:k
[xm(i) ym(i)]=ginput(1);
plot(xm(i), ym(i),'r*'); end;
period=abs(xm(2)-xm(1)); rounded_p=round(period); m=rounded p;
% Adding noise and plotting noisy signal y=x+randn(1,n);
figure; plot(k1,y);
% To generate impulse train with the period as that of input signal% d=zeros(1,n);
for i=1:n
if (rem(i-1,m)==0) d(i)=1;
end; end;
% correlating noisy signal and impulse train cir=cxcorr1(y,d);
%plotting the original and reconstructed signal m1=0:n/4;
figure plot(m1,x(m1+1),'r',m1,m*cir(m1+1));

Department of Electronics and Communication Engineering Page 189


OUTPUT:-

Department of Electronics and Communication Engineering Page 190


RESULT:-
Using Cross- correlation the periodic signal from noise was estimated using MATLAB.

Department of Electronics and Communication Engineering Page 191


VIVA QUESTIONS:-
1. State the relationship between PSD and ACF?
2. What is the integration of ramp signal?
3. Difference between vectors and signals?
4. What is the important of dot product over cross product in signals?
5. Define Hilbert transforms?
6. What is Hilbert transform of Sin(t)?
7. What is Hilbert transform of Cos(t)?
[Link] is difference between Hilbert transforms and Fourier Transforms?
9. What is difference between Hilbert transforms and Laplace Transforms?
10. Explain LTI and LTV systems?

EXERCISE PROGRAM:-
1. Simulate a matlab program on autocorrelation and PSD if x = [1 2 3 4 5 ].
2. Write a mat lab program to perform the cross correlation between sinusoidal and ramp
function and see how mat lab reacts to it.
3. Write a MATLAB program to perform cross correlation between square and step signal and see
how mat lab reacts to it.
4. Write a MATLAB program to perform cross correlation between sinusoidal and ramp signal and
see how mat lab reacts to it.
5. Write a MATLAB program to perform the cross correlation between X (n) = [1 2 3 5] and y
(n) = [- 1 2] and see how matlab reacts to it.
6. Write a MATLAB program to perform the cross correlation between X (n) = [1 -3 5] and y
(n) = [1 2 3 4] and see how matlab reacts to it.
7. Write a MATLAB program to perform the cross correlation between X (n) = [1 0 1 1] and y
(n) = [1 0 0 0 0] and see how matlab reacts to it.
8. Write a MATLAB program to perform the cross correlation between X (n) = [1 1 1 1 0 0 0 0]
and y (n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
9. Write a MATLAB program to perform the cross correlation between X (n) = [1 1 0 0] and y (n)
= [1 1 1 1] and see how matlab reacts to it.
10. Write a MATLAB program to perform the cross correlation between X (n) = [6 7 8 9 10] and y
(n) = [5 4 3 2 1] and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page 192


11. Write the MATLAB program to perform cross correlation between the following sequences
X(n)=[2 -2 3 2, h(n) = [-2 4 -5 2].
12. Write a mat lab program to perform the convolution between step and ramp function and see
how mat lab reacts to it.
13. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
14. Write a MATLAB program to perform convolution between sinusoidal and square signal and see
how mat lab reacts to it.
15. Write a MATLAB program to perform the convolution between X (n) = [2 3 4 5] and y (n) = [-2
4] and see how matlab reacts to it.
16. Write a MATLAB program to perform the convolution between X (n) = [3 -4 6] and y (n) = [2 6
8 6] and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page 193


17. Write a MATLAB program to perform the convolution between X (n) = [3 1 2 0] and y (n) = [2
4 3 4 5] and see how matlab reacts to it.
18. Write a MATLAB program to perform the convolution between X (n) = [2 2 1 0 2 1 1 0] and
y (n) = [1 1 1 2 1 0 1 0] and see how matlab reacts to it.
19. Write a MATLAB program to perform the convolution between X (n) = [2 1 2 1] and y (n) = [1 2
1 2] and see how matlab reacts to it.
20. Write a MATLAB program to perform the convolution between X (n) = [5 6 9 8 7] and y (n)
= [1 2 3 2 1] and see how matlab reacts to it.
21. Write the MATLAB program to perform cross correlation between the following sequences
X(n)=[4 -6 5 1], h(n) = [-1 3 -4 3].
22. Write a mat lab program to perform the cross correlation between ramp and step function and
see how mat lab reacts to it.
23. Write a MATLAB program to perform cross correlation between square and step signal and see
how mat lab reacts to it.
24. Write a MATLAB program to perform cross correlation between sinusoidal and step signal and
see how mat lab reacts to it.
25. Write a MATLAB program to perform the convolution between X (n) = [1 5 6 5] and y (n) = [-3
6] and see how matlab reacts to it.
26. Write a MATLAB program to find Hilbert transforms of the causal signal x(t)=t^2
27. Write a MATLAB program to find Hilbert transforms of the causal signal x(t)=t
28. Write a MATLAB program to find Hilbert transforms of the causal signal x(t)=e^-at
29. Write a MATLAB program to find Hilbert transforms of the causal signal x(t)=e^at
30. Write a MATLAB program to find Hilbert transforms of the causal signal x(t)=te^at

Real Time Applications:


The cross correlation is to determine the response y[n] of a system of a known impulse response h[n]
for a given input signal x[n] to obtain y[n].
Digital signal processing applications Tv reception.

Department of Electronics and Communication Engineering Page 194


EXPERMENT NO:17 VERIFICATION OF WIENER KHINCHIN
RELATION
AIM: -
Verification of wiener khinchine relation.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-

The Wiener Khinchin theorem (also known as the Wiener Khintchine theorem and sometimes as the
Wiener Khinchin Einstein theorem or the Khinchin Kolmogorov theorem) states that the power
spectral density of a wide-sense-stationary random process is the Fourier transform of the
corresponding autocorrelation function.
Continuous case:

Where

is the autocorrelation function defined in terms of statistical expectation, and where is the power
spectral density of the function . Note that the autocorrelation function is defined in terms of the
expected value of a product, and that the Fourier transform of does not exist in general, because
stationary random functions are not square integrable.
The asterisk denotes complex conjugate, and can be omitted if the random process is realvalued.

Discrete case:

Department of Electronics and Communication Engineering Page 195


where

and where is the power spectral density of the function with discrete values . Being a sampled and
discrete-time sequence, the spectral density is periodic in the frequency domain.

PROCEDURE:-

Department of Electronics and Communication Engineering Page 196


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:-
% wiener khinchine relation% Clc;
clear all; t=0:0.1:2*pi; x=sin(2*t); subplot(3,2,1); plot(x); au=xcorr(x,x); subplot(3,2,2); plot(au);
v=fft(au); subplot(3,2,3);
plot(abs(v)); fw=fft(x); subplot(3,2,4); plot(fw); fw2=(abs(fw)).^2;
subplot(3,2,5); plot(fw2);

Department of Electronics and Communication Engineering Page 197


OUTPUT:-

wiener khinchine relation

Department of Electronics and Communication Engineering Page 198


RESULT:-
Calculation of Auto-correlation function using Weiner-Khinchin theorm was verified using MATLAB.

VIVA QUESTIONS:-

1. What is mean wiener khinchine relation?


2. Define fourier transform and its inverse?
3. What is the difference b/w convolution and correlation?
4. What is the importance of power spectrum?
5. What is the importance of correlation?
6. Write the relation between Step and Impulse signals?
7. Write the relation between Ramp and impulse signals?
8. Write the relation between Ramp and Step signals?
9. Define Standerd signals?
10. Give examples of Standerd signals?

EXERCISE PROGRAMS

signal.

Department of Electronics and Communication Engineering Page 199


1. Write a MATLAB program to illustrate the effect of anti-aliasing filter.
2. Write a MATLAB program to subtract two sinusoidal signals.
3. Write a MATLAB program to subtract and multiply twosinusoidal signals.
4. Write a MATLAB program to right shift the signal to 5 times of the original signal.
5. Write a MATLAB program to left shift the signal to 8 times of the original signal.
6. Write a MATLAB program to add two different signals with 2 <t<5
7. Write a MATLAB program to shift a positive time line signal to negative timeline

8. Write a MATLAB program to subtract co-sinusoidal signals.


9. Write a MATLAB program to subtract two sinusoidal signals
10. Write a MATLAB program to division and multiply two co-sinusoidal signals.
11. Write a MATLAB program to generate time scaling of a sequence.
12. Write a MATLAB program to generate time shifting of a sequence.
13. Write a MATLAB program to generate time folding of a sequence.
14. Write a MATLAB program to generate amplitude scaling of a sequence with
amplitude 5.
15. Write a MATLAB program to generate time scaling of a sequence with time 2sec.
16. Write a MATLAB program to add two different signals with 4 <t<8
17. Write a MATLAB program to shift a negative time line signal to positive timeline
signal.
18. Write a MATLAB program to subtract sinusoidal signals.

Department of Electronics and Communication Engineering Page 200


19. Write a MATLAB program to subtract and divide two sinusoidal signals
20. Write a MATLAB program to add and multiply two co-sinusoidal signals.
21. Write a MATLAB program to generate time scaling of a signal.
22. Write a MATLAB program to generate time shifting of a signal.
23. Write a MATLAB program to generate time folding of a signal.
24. Write a MATLAB program to generate amplitude scaling of a sequence with amplitude
10.
25. Write a MATLAB program to generate time scaling of a sequence with time 5sec.
26. Find the addition of null matrix and unity matrix of order 4x4.
27. Write a MATLAB program to find rank of the matrix A= [6 4 9 3 5; 6 2 4 8 5; 6 3 1 7 9].
28. Write a MATLAB program to find Eigen of the matrix A= [2 5 0 3 4; 5 4 3 7 8; 9 1 6 5
4].
29. Write a MATLAB program to find inverse of the matrix A= [1 5 9 8 5;4 3 5 8 4; 5 6 3 5
0]
30. Write a MATLAB program to find determinant of the matrix A= [1 6 9 8 5; 9 3 5 6 4; 1 6
3 5 6].

Real Time Applications:


Stream processing applications Block processing applications Vector processing applications Signal
processing applications

Department of Electronics and Communication Engineering Page 201


EXPERMENT NO:18

CHECKING A RANDOM PROCESS FOR STATIONARITY IN WIDE SENSE. AIM: -


Checking a random process for stationarity in wide sense.

SOFTWARE REQURIED:-
1. MATLAB R2010a.
2. Windows XP SP2.
THEORY:-

A stationary process (or strict(ly) stationary process or strong(ly) stationary process) is a stochastic
process whose joint probability distribution does not change when shifted in time or space. As a
result, parameters such as the mean and variance, if they exist, also do not change over time or
position..Weak or wide-sense stationary A weaker form of stationary commonly employed in signal
processing is known as weak-sense stationary, wide-sense stationarity (WSS) or covariance
stationarity. WSS random processes only require that 1st and 2nd moments do not vary with respect to
time.

and autocorrelation function

The first property implies that the mean function m x(t) must be constant. The second property implies
that the correlation function depends only on the difference between t1 and t2 and only needs to be
indexed by one variable rather than two variables. Thus, instead of writing,
Rx(t1-t2,0)we usually abbreviate the notation and write

This also implies that the auto covariance depends only on _ = t1 t2, since

Stationary and Non Stationary Random Process:


A random X(t) is stationary if its statistical properties are unchanged by a time shift in the time origin.
Department of Electronics and Communication Engineering Page 202
When the auto-Correlation function Rx(t, t+T ) of the random X(t) varies with time difference T and
the mean value of the random variable X(t1) is independent of the choicet1,then X(t) is said to be
stationary in the wide sense or wide-sense stationary . So a continuous- Time random process X(t)
which is WSS has the following properties

Department of Electronics and Communication Engineering Page 203


1)

2) The Autocorrelation function is written as a function of T that is RX(t, t+T)=Rx(T)

If the statistical properties like mean value or moments depends on time then the random process is
said to be non-stationary.

When dealing with two random process X(t) and Y(t), we say that they are jointly wide-sense
stationary if each process is stationary in the wide-sense.

Rxy(t,t+T)=E[X(t)Y(t+T)]=Rxy(T).

PROCEDURE:-

Department of Electronics and Communication Engineering Page 204


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
y = randn([1 40]) my=round(mean(y)); z=randn([1 40]) mz=round(mean(z)); vy=round(var(y));
vz=round(var(z));
t = sym('t','real'); h0=3;
x=y.*sin(h0*t)+z.*cos(h0*t); mx=round(mean(x));
k=2;
xk=y.*sin(h0*(t+k))+z.*cos(h0*(t+k)); x1=sin(h0*t)*sin(h0*(t+k)); x2=cos(h0*t)*cos(h0*(t+k));
c=vy*x1+vz*x1;

Department of Electronics and Communication Engineering Page 205


OUTPUT:
%if we solve "c=2*sin(3*t)*sin(3*t+6)" we get c=2cos(6)
%which is a costant does not depent on variable 't'
% so it is wide sence stationary.

RESULT:-
Checking a random process for stationarity in wide sense by using MATLAB .

VIVA QUESTIONS:-
1. what is the condition for WSS random process?
2. Define random variable with examples?
3. Define random process with examples?
4. Difference between ACF and CCF?
5. what are the different noises?
6. Explain two Properties of Auto-Correlation?
7. Explain two Properties of Cross-Correlation?
8. What is the difference b/w Auto-correlation and Cross-Correlation?
9. Define ESD?
10. Define PSD?

EXERCISE PROGRAMS

1. Write a program to simulate relation


2. Write a mat lab program to perform the cross correlation between sinusoidal and ramp
function and see how mat lab reacts to it.
3. Write a MATLAB program to perform cross correlation between square and step signal and see
how mat lab reacts to it.
4. Write a MATLAB program to perform cross correlation between sinusoidal and ramp signal and
see how mat lab reacts to it.
5. Write a MATLAB program to perform the cross correlation between X (n) = [1 2 3 5] and y
(n) = [- 1 2] and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page 206


6. Write a MATLAB program to perform the cross correlation between X (n) = [1 -3 5] and y
(n) = [1 2 3 4] and see how matlab reacts to it.
7. Write a MATLAB program to perform the cross correlation between X (n) = [1 0 1 1] and y
(n) = [1 0 0 0 0] and see how matlab reacts to it.
8. Write a MATLAB program to perform the cross correlation between X (n) = [1 1 1 1 0 0 0 0]
and y (n) = [1 0 1 0 1 0 1 0] and see how matlab reacts to it.
9. Write a MATLAB program to perform the cross correlation between X (n) = [1 1 0 0] and y (n)
= [1 1 1 1] and see how matlab reacts to it.
10. Write a MATLAB program to perform the cross correlation between X (n) = [6 7 8 9 10] and y
(n) = [5 4 3 2 1] and see how matlab reacts to it.

Department of Electronics and Communication Engineering Page 207


11. Write the MATLAB program to perform cross correlation between the following sequences
X(n)=[2 -2 3 2, h(n) = [-2 4 -5 2].
12. Write a mat lab program to perform the convolution between step and ramp function and see
how mat lab reacts to it.
13. Write a MATLAB program to perform convolution between square and step signal and see how
mat lab reacts to it.
14. Write a MATLAB program to perform convolution between sinusoidal and square signal and see
how mat lab reacts to it.
15. Write a MATLAB program to perform the convolution between X (n) = [2 3 4 5] and y (n) = [-2
4] and see how matlab reacts to it.
16. Write a MATLAB program to perform the convolution between X (n) = [3 -4 6] and y (n) = [2 6
8 6] and see how matlab reacts to it.
17. Write a MATLAB program to perform the convolution between X (n) = [3 1 2 0] and y (n) = [2
4 3 4 5] and see how matlab reacts to it.
18. Write a MATLAB program to perform the convolution between X (n) = [2 2 1 0 2 1 1 0] and
y (n) = [1 1 1 2 1 0 1 0] and see how matlab reacts to it.
19. Write a MATLAB program to perform the convolution between X (n) = [2 1 2 1] and y (n) = [1 2
1 2] and see how matlab reacts to it.
20. Write a MATLAB program to perform the convolution between X (n) = [5 6 9 8 7] and y (n)
= [1 2 3 2 1] and see how matlab reacts to it.
21. Write the MATLAB program to perform cross correlation between the following sequences
X(n)=[4 -6 5 1], h(n) = [-1 3 -4 3].
22. Write a mat lab program to perform the cross correlation between ramp and step function and
see how mat lab reacts to it.
23. Write a MATLAB program to perform cross correlation between square and step signal and see
how mat lab reacts to it.
24. Write a MATLAB program to perform cross correlation between sinusoidal and step signal and
see how mat lab reacts to it.
25. Write a MATLAB program to perform the convolution between X (n) = [1 5 6 5] and y (n) = [-3
6] and see how matlab reacts to it.
26. Write a MATLAB program to illustrate the effect of anti-aliasing filter.
27. Write a MATLAB program to subtract two sinusoidal signals.

Department of Electronics and Communication Engineering Page 208


28. Write a MATLAB program to subtract and multiply two sinusoidal signals.
29. Write a MATLAB program to right shift the signal to 2 times of the original signal.
30. Write a MATLAB program to left shift the signal to 5 times of the original signal.

Real Time Applications:


theorem for energy signals theorem for power signals Digital signal processing
applications

Department of Electronics and Communication Engineering Page 209

You might also like