0% found this document useful (0 votes)
46 views36 pages

20ecl33 SS Lab Manual

Here are the plots generated by the MATLAB code: 1. A line plot of a sinusoidal function of x^2 from 0 to 5 in steps of 0.05 2. A line plot with two curves, one for sin(x^2) and another for cos(x^2) 3. A vertical bar plot of an exponential function from -2.9 to 2.9 in steps of 0.2 4. A stairstep plot of a sinusoidal function from 0 to 10 in steps of 0.25 5. A line plot with error bars of an erf function from -2 to 2 in steps of 0.1 6. A polar plot of a function

Uploaded by

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

20ecl33 SS Lab Manual

Here are the plots generated by the MATLAB code: 1. A line plot of a sinusoidal function of x^2 from 0 to 5 in steps of 0.05 2. A line plot with two curves, one for sin(x^2) and another for cos(x^2) 3. A vertical bar plot of an exponential function from -2.9 to 2.9 in steps of 0.2 4. A stairstep plot of a sinusoidal function from 0 to 10 in steps of 0.25 5. A line plot with error bars of an erf function from -2 to 2 in steps of 0.1 6. A polar plot of a function

Uploaded by

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

SIGNALS & SYSTEMS LAB 20 ECL33

DEPARTMENT OF ECE

BAPATLA ENGINEERING COLLEGE: BAPATLA


(AUTONOMOUS)

SIGNALS AND SYSTEMS LAB MANUAL


[CODE: 20ECL33]

Prepared by
Ms. N.NAGA SWATHI, Asst. Prof.

Mr. SD.IMRAN BASHA, Asst. Prof.

Mr.P.VENKATESH, Lab Assistant

ECE Dept. Bapatla Engineering College (Autonomous)


SIGNALS & SYSTEMS LAB 20 ECL33

II B.Tech.–III Semester
SIGNALS AND SYSTEMS LAB (20ECL33)
Lectures 0 Tutorial 0 Practical 3 Credits 1.5
Continuous Internal Assessment : 30 Semester End Examination : 70
(3 Hours)

COURSE OUTCOMES (CO):


Course
Outcome (CO) Course Outcome description
CO 1 Plot basic continuous time and discrete time signals.
CO 2 Analyze different operations on signals and sequences by
using MATLAB
CO 3 Analyze LTI systems by using convolution and correlation.

CO, PO AND PSO MAPPING:


P P
P P P P P P P P P P P P
S S
20ECL33 Signals& Systems Lab O O O O O O O O O O O O
O O
1 2 3 4 5 6 7 8 9 10 11 12
1 2
Plot basic continuous
CO 1 time and discrete time
signals. 3 - - - 2 - - - 3 - - - 1 2
Analyze different
operations on signals and
CO 2
sequences by using
MATLAB 2 3 - - 2 - - - 2 - - - 1 2
Analyze LTI systems by
CO 3 using convolution and
correlation. 2 3 - 2 2 - - - 2 - - - 1 2

ECE Dept. Bapatla Engineering College (Autonomous)


SIGNALS & SYSTEMS LAB 20 ECL33

LIST OF PROGRAMS
S. No. Name of the Program
1. Basic Operations on Matrices.

2. Program to show how to create a variety of 2-D plots in MATLAB

3. Generation of basic continuous time signals namely unit impulse, step, ramp, exponential and
Sinusoidal signals.

4. Generation of basic discrete time signals namely unit impulse step, ramp, exponential and
Sinusoidal signals.

5. Operations on Signals and Sequences such as Addition, Multiplication.

6 Finding the Even and Odd Parts of Signal.

7 Verification of linearity property of a given Continuous/discrete system.

8 Convolution between Signals and Sequences

9 Autocorrelation and Cross correlation between Signals and Sequences.

10 Sampling Theorem Verification.

ECE Dept. Bapatla Engineering College (Autonomous)


SIGNALS & SYSTEMS LAB 20 ECL33

Program 1: Basic Operations on Matrices

Aim: To perform basic operations on matrices such as addition, multiplication, transpose, length
of the matrix, size of the matrix, mean of the matrix, inverse of the matrix etc.

Software Required: MATLAB

Theory:

length(X) length(X) returns the length of vector X. It is equivalent to


max(size(X)) for non-empty arrays and 0 for empty ones.

transpose(a) transpose (a) is called for the syntax a.' when a is an object.
a.' computes the non-conjugate transpose of matrix a

+ Plus X + Y adds matrices X and Y. X and Y must have the same


dimensions unless one is a scalar (a 1-by-1 matrix).

C = plus(A,B) is called for the syntax 'A + B' when A or B is an object.

* X*Y is the matrix product of X and Y. Any scalar (a 1-by-1 matrix) may
Matrix multiply multiply anything. Otherwise, the number of columns of X must equal the
number of rows of Y.

C = mtimes(A,B) is called for the syntax 'A * B' when A or B is


an object.

.* X.*Y denotes element-by-element multiplication.

Array multiply. X and Y must have the same dimensions unless one is a scalar. A scalar can
be multiplied into anything.

C = times(A,B) is called for the syntax 'A .* B' when A or B is


an object.

Size D = size(X), for M-by-N matrix X, returns the two-element row vector.

mean mean(X) is the mean value of the elements in X.

For matrices, mean(X) is a row vector containing the mean value of each
column.

inv inv(X) is the inverse of the square matrix X.

1
SIGNALS & SYSTEMS LAB 20 ECL33

Matlab Program:

A=[1 2 3; 1 0 1; 2 1 4];

B=[1 1 3; 0 5 7; 2 7 4];

C=A+B; % Addition of two matrices

D=A*B % Multiplication of two matrices

E=A.*B % vector multiplication

F=transpose(A) % transpose of a matrix

G=length(B) % length of a matrix

[H I]=size(A) % size of the matrix

J=mean(A) % calculating mean of the matrix

colvec=[13;20;5] % creating a column vector

rowvec=[1 2 3] %Creating a row vector

sub_matrix=A(2:3,2:3) %Extracting sub matrix from matrix

col_vector=A(:,2) % extracting column vector from matrix row_vector=A(3,:) %

extracting row vector from matrix

K=inv(A) % inverse of the matrix

L=plus(A,B)

M=mtimes(A,B)

N=times(A,B)

O=A.’

P=max(size(B))

2
SIGNALS & SYSTEMS LAB 20 ECL33

OUTPUTS:

C=
2 3 6
1 5 8
4 8 8
D=
7 32 29
3 8 7
10 35 29
E=
1 2 9
0 0 7
4 7 16

F=
1 1 2
2 0 1
3 1 4

G=
3
H=
3

I= 3

J=
1.3333 1.0000 2.6667

colvec = 13
20
5

rowvec =
1 2 3

sub_matrix = 0 1
1 4

3
SIGNALS & SYSTEMS LAB 20 ECL33

col_vector = 2
0
1

row_vector = 2 1 4

K=
0.5000 2.5000 -1.0000
1.0000 1.0000 -1.0000
-0.5000 -1.5000 1.0000

L=
2 3 6
1 5 8
4 8 8

M=
7 32 29
3 8 7
10 35 29

N=
1 2 9
0 0 7
4 7 16

O=
1 1 2
2 0 1
3 1 4

P=
3

4
SIGNALS & SYSTEMS LAB 20 ECL33

Program 2: Program to show how to create a variety of 2-D plots in MATLAB

Aim: To understand the use of different functions used in MATLAB for


representing 2D Plots.

Software Required: MATLAB

Theory:

1 Line Plots: The plot function creates simple line plots of x and y values.

2 Stem Plots: The stem function draws a marker for each x and y value
with a vertical line connected to a common baseline.

3 Scatter Plots: The scatter function draws a scatter plot of x and y values.

4 Bar Plots: The bar function creates vertical bar charts. The barh function
creates horizontal bar charts.

5 Stairstep Plots: The stairs function creates a stairstep plot. It can create a
stairstep plot of Y values only or a stairstep plot of x and y values.

6 Errorbar Plots: The errorbar function draws a line plot of x and y values
and superimposes a vertical error bar on each observation. To specify the
size of the error bar, pass an additional input argument to
the errorbar function

7 Polar Plots: The polarplot function draws a polar plot of the angle values
in theta (in radians) versus the radius values in rho.

5
SIGNALS & SYSTEMS LAB 20 ECL33

Program:

S.No. Code Output


1 x = 0:0.05:5;
y = sin(x.^2);
figure
plot(x,y)

2 y1 = sin(x.^2);
y2 = cos(x.^2);
plot(x,y1,x,y2)

3 x = -2.9:0.2:2.9;
y = exp(-x.*x);
bar(x,y)

4 x = 0:0.25:10;
y = sin(x);
stairs(x,y)

6
SIGNALS & SYSTEMS LAB 20 ECL33

5 x = -2:0.1:2;
y = erf(x);
eb = rand(size(x))/7;
errorbar(x,y,eb)

6. theta = 0:0.01:2*pi; % angle


rho =
abs(sin(2*theta).*cos(2*theta));
% radius
polarplot(theta,rho)

7. x = 0:0.1:4;
y = sin(x.^2).*exp(-x);
stem(x,y)

8. load patients Height Weight


Systolic % load data
scatter(Height,Weight)
% scatter plot of Weight vs.
Height
xlabel('Height')
ylabel('Weight')

7
SIGNALS & SYSTEMS LAB 20 ECL33

Program 3: Generation of basic continuous time signals namely unit impulse, step,
ramp, exponential and Sinusoidal signals.

Aim: To generate basic continuous time signals namely unit impulse, step, ramp, exponential
and Sinusoidal signals.

Software Required: MATLAB

Theory:
A continuous-time signal is a signal that can be defined at every instant of time. A continuous-
time signal contains values for all real numbers along the X-axis.

Unit Impulse 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.

Unit Step

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

Ramp

The ramp function is a unary real function, easily computable as the mean of the
independent variable and its absolute value.

8
SIGNALS & SYSTEMS LAB 20 ECL33

Exponential Exponential signal is of two types. These two types of signals are real
signal exponential signal and complex exponential signal which are given below.

Real Exponential Signal:

A real exponential signal is defined as

Where both "A" and "σ" are real. Depending on the value of "σ" the signals will
be different. If "σ" is positive the signal x(t) is a growing exponential and if
"σ" is negative then the signal x(t) is a decaying exponential. For σ=0, signal
x(t) will be constant.

Complex exponential Signal:

The complex exponential signal is given by

Where "s" is a complex variable and it is defined as

A complex exponential signal cannot be plot in a two dimensional (2D) graph,


it should be plot in a three dimensional graph.
Sinusoidal A sine wave or sinusoid is a mathematical curve that describes a smooth
signal repetitive oscillation.

where:

• A = the amplitude, the peak deviation of the function from zero.


• f = the ordinary frequency, the number of oscillations (cycles) that occur
each second of time.
• ω = 2πf, the angular frequency, the rate of change of the function
argument in units of radians per second
• φ = the phase, specifies (in radians) where in its cycle the oscillation is
at t = 0.
9
SIGNALS & SYSTEMS LAB 20 ECL33

10
SIGNALS & SYSTEMS LAB 20 ECL33

MATLAB PROGRAM:

%(i)unit impulse signal


clc;
clear all;
close all;
n=-2:2;
d=[zeros(1,2),1,zeros(1,2)];
subplot(5,1,1);
stem(n,d);
xlabel('Time');
ylabel('Amplitude');
title('Unit impulse signal');

%(ii)unit step signal


L=input('Length of step signal, L=');
t=0:0.01:L;
u=t/t;
subplot(5,1,2);
plot(t,u);
xlabel('Time');
ylabel('Amplitude');
title('Unit step signal');

%(iii)unit ramp signal


L=input('Length of ramp signal, L=');
t=0:0.01:L;
subplot(5,1,3);
plot(t,t);
xlabel('Time');
ylabel('Amplitude');
title('Unit Ramp signal');

%(iv)exponential signal
L=input('Length of exponential signal, L=');
B=input('Amplitude of exponential signal, B=');
a=input('Value of a=');
t=0:0.01:L;
x=B*exp(a*t);
subplot(5,1,4);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Exponential signal');
11
SIGNALS & SYSTEMS LAB 20 ECL33

%(v)sinusoidal signal
L=input('Length of sinusoidal signal, L=');
T=input('Time period of sinusoidal signal, T=');
A=input('Amplitude of sinusoidal signal, A=');
phi=input('Initial phase of sinusoidal signal, phi(in radian)=');
t=0:0.01:L;
x=A*cos((2*pi*t/T)+phi);
subplot(5,1,5);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('sinusoidal signal');

12
SIGNALS & SYSTEMS LAB 20 ECL33

OUTPUT :

13
SIGNALS & SYSTEMS LAB 20 ECL33

Program 4: Generation of basic discrete time signals namely unit impulse, step, ramp,
exponential and Sinusoidal signals.

Aim: To generate basic discrete time signals namely unit impulse, step, ramp, exponential
and Sinusoidal signals.

Software Required: MATLAB

Theory:
Signals that are discrete in time but continuous in amplitude are referred to as discrete-time
signals.

Unit Impulse 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.

Unit Step
The unit step function, also known as the Heaviside function, is defined as

Ramp The ramp function is a unary real function, easily computable as the mean of the
independent variable and its absolute value.

14
SIGNALS & SYSTEMS LAB 20 ECL33

Exponential Exponential signal is represented by :


sequence

Sinusoidal A sine wave or sinusoid is a mathematical curve that describes a smooth


sequence repetitive oscillation.
[𝑛] = 𝐴 cos( 𝑤 𝑛 + ∅ )

where:
• A = the amplitude, the peak deviation of the function from zero.
• f = the ordinary frequency, the number of oscillations (cycles) that occur
each second of time.
• ω = 2πf, the angular frequency, the rate of change of the function
argument in units of radians per second
• Ф = the phase, specifies (in radians) where in its cycle the oscillation
is at t = 0.

15
SIGNALS & SYSTEMS LAB 20 ECL33

MATLAB PROGRAM:

%(i)unit impulse sequence


clc;
clear all;
close all;
n=-2:2;
d=[zeros(1,2),1,zeros(1,2)];
subplot(5,1,1);
stem(n,d);
xlabel('Time index');
ylabel('Amplitude');
title('Unit impulse sequence ');

%(ii)unit step sequence


L=input('Length of step sequence, L=');
n=0:L-1;
u=ones(1,L);
subplot(5,1,2);
stem(n,u);
xlabel('Time index');
ylabel('Amplitude');
title('Unit step sequence');

%(iii)unit ramp sequence


L=input('Length of ramp sequence, L=');
n=0:L-1;
subplot(5,1,3);
stem(n,n);
xlabel('Time index');
ylabel('Amplitude');
title('Unit Ramp sequence');

%(iv)exponential sequence
L=input('Length of exponential sequence, L=');
n=0:L-1;
B=input('Amplitude of exponential sequence, B=');
a=input('Value of a=');
e=exp(a*n);
x=B*e;
subplot(5,1,4);
stem(n,x);
xlabel('Time index');
ylabel('Amplitude');
16
SIGNALS & SYSTEMS LAB 20 ECL33

title('Exponential sequence ');

%(v)sinusoidal sequence
L=input('Length of sinusoidal sequence, L=');
N=input('Time period of sinusoidal sequence , N=');
A=input('Amplitude of sinusoidal sequence , A=');
phi=input('Initial phase of sinusoidal sequence, phi(in radian)=');
n=0:L-1;
x=A*cos((2*pi*n/N)+phi);
subplot(5,1,5);
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('sinusoidal sequence');
OUTPUT:

17
SIGNALS & SYSTEMS LAB 20 ECL33

Program 5: Operations on Signals and Sequences such as addition, Multiplication.

Aim: Matlab programs to explain the Operations on Signals and Sequences such
as Addition, Multiplication.

Software Required: MATLAB

Theory:

1. Addition: Addition can be carried out using the ‘ + ‘ symbol and plotting will give you
the result.

2. Subtraction: With the same program code as of addition replacing arithmetic


operator ‘ – ‘ we can perform subtraction in signals.

3. Multiplication: By using ‘ * ‘ ( asterisk) operator we can perform multiplication


of signals.

MATLAB PROGRAM:

clc;
clear all;
close all;

t=0:.01:1;

% generating two input signals


x1=sin(2*pi*4*t);
x2=sin(2*pi*8*t);
subplot(2,2,1);
plot(t,x1);
xlabel('time'); ylabel('amplitude');
title('signal1:sine wave of frequency 4Hz');
subplot(2,2,2);
plot(t,x2);
xlabel('time');
ylabel('amplitude');
title('signal2:sine wave of frequency 8Hz');

18
SIGNALS & SYSTEMS LAB 20 ECL33

% addition of signals
y1=x1+x2;
subplot(2,2,3);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('resultant signal:signal1+signal2');

% multiplication of signals
y2=x1.*x2;
subplot(2,2,4);
plot(t,y2);
xlabel('time');
ylabel('amplitude');
title('resultant signal:dot product of signal1 and signal2');

OUTPUT :

19
SIGNALS & SYSTEMS LAB 20 ECL33

Program 6: Finding the Even and Odd Parts of Signal

Aim: Matlab program to find the Even and Odd Parts of Signal.

Software Required: MATLAB

Theory:

A signal x(t) is said to be, even if, x(t)=x(−t) (1)


Odd if, x(t)=−x(−t) (2)
x(t)=−x(−t) (3)

Any signal x(t) can be written as the sum of an even signal and odd signal.
x(t)=xe(t)+xo(t) (4)
where, xe(t) is the even part and xo(t) is the odd part.

MATLAB PROGRAM:

clc;
close all;
clear all;

% Even and odd parts of a signal


t=0:.005:4*pi;
x=sin(t)+cos(t); % x(t)=sint(t)+cos(t)
subplot(2,2,1)
plot(t,x)
xlabel('t');
ylabel('amplitude')
title('input signal')
y=sin(-t)+cos(-t) % y=x(-t)
subplot(2,2,2)
plot(t,y)
xlabel('t');
ylabel('amplitude')
title('input signal with t=-t')
z=x+y
subplot(2,2,3)
plot(t,z/2)
xlabel('t');

20
SIGNALS & SYSTEMS LAB 20 ECL33

ylabel('amplitude')
title('even part of the signal')
p=x-y
subplot(2,2,4)
plot(t,p/2)
xlabel('t');
ylabel('amplitude');
title('odd part of the signal');

OUTPUT:

21
SIGNALS & SYSTEMS LAB 20 ECL33

Program 7: Verification of linearity property of a given Continuous /discrete system.

Aim: Matlab program to verify linearity property of a given Continuous /discrete system.

Software Required: MATLAB

Theory:
If a system is linear, this means that when an input to a given system is scaled by a
value, the output of the system is scaled by the same amount. A linear system also
obeys the principle of superposition. This means that if two inputs are added together
and passed through a linear system, the output will be the sum of the individual inputs'
outputs.

A time-invariant system has the property that a certain input will always give the
same output (up to timing), without regard to when the input was applied to the
system.

MATLAB PROGRAM:

% Verification of Linearity

clc;
clear all;
close all;

% entering two input sequences and impulse sequence


x1 = input (' type the samples of x1 ');
x2 = input (' type the samples of x2 ');
if(length(x1)~=length(x2))
disp('error: Lengths of x1 and x2 are different');
return;
end;
h = input (' type the samples of h ');

% length of output sequence


N = length(x1) + length(h) -1;
disp('length of the output signal will be ');
disp(N);

% entering scaling factors


a1 = input (' The scale factor a1 is ');
a2 = input (' The scale factor a2 is ');
x = a1 * x1 + a2 * x2;

22
SIGNALS & SYSTEMS LAB 20 ECL33

% response of x and x1
yo1 = conv(x,h);
y1 = conv(x1,h);

% scaled response of x1
y1s = a1 * y1;

% response of x2
y2 = conv(x2,h);

% scaled response of x2
y2s = a2 * y2;
yo2 = y1s + y2s;
disp ('Input signal x1 is ');
disp(x1);
disp ('Input signal x2 is ');
disp(x2);
disp ('Output Sequence yo1 is ');
disp(yo1);
disp ('Output Sequence yo2 is ');
disp(yo2);
if ( yo1 == yo2 )
disp(' yo1 = yo2. Hence the LTI system is LINEAR ')
end;

OUTPUT:

For Linearity the output will be displayed as Linear or Non Linear System.

23
SIGNALS & SYSTEMS LAB 20 ECL33

Program 8: Convolution between Signals and Sequences.

Aim: Matlab program to perform Convolution between Signals and Sequences.

Software Required: MATLAB

Theory:
Convolution is a mathematical operation on two functions (f and g) that produces a
third function expressing how the shape of one is modified by the other. The term convolution
refers to both the result function and to the process of computing it. It is defined as the integral
of the product of the two functions after one is reversed and shifted.

MATLAB PROGRAM:

clc;
close all;
clear all;
%program for convolution of two sequences
x=input('enter input sequence');
h=input('enter impulse response');
y=conv(x,h);
subplot(3,1,1);
stem(x);
xlabel('n');
ylabel('x(n)');
title('input signal')
subplot(3,1,2);
stem(h);
xlabel('n');
ylabel('h(n)');
title('impulse response')
subplot(3,1,3);
stem(y);
xlabel('n');
ylabel('y(n)');
title('linear convolution')
disp('The resultant signal is');
disp(y)

%program for signal convolution


t=0:0.1:10;
x1=sin(2*pi*t);
h1=cos(2*pi*t);

24
SIGNALS & SYSTEMS LAB 20 ECL33

y1=conv(x1,h1);
figure;
subplot(3,1,1);
plot(t,x1);
xlabel('t');
ylabel('x(t)');
title('input signal')
subplot(3,1,2);
plot(t,h1);
xlabel('t');
ylabel('h(t)');
title('impulse response')
subplot(3,1,3);
plot(y1);
xlabel('n');
ylabel('y(n)');
title('linear convolution');

OUTPUT:

25
SIGNALS & SYSTEMS LAB 20 ECL33

26
SIGNALS & SYSTEMS LAB 20 ECL33

Program 9:Autocorrelation and Cross correlation between Signals and Sequences.

Aim: Matlab programs to perform Autocorrelation and Cross correlation between Signals and
Sequences.

Software Required: MATLAB

Theory:

Cross-correlation is a measure of similarity of two series as a function of the displacement of one


relative to the other. 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 tomography, averaging, cryptanalysis, and
neurophysiology. The cross-correlation is similar in nature to the convolution of two
functions. In an autocorrelation, which is the cross-correlation of a signal with itself, there will
always be a peak at a lag of zero, and its size will be the signal energy.

Autocorrelation, also known as serial correlation, is the correlation of a signal with a delayed copy
of itself as a function of delay. Informally, it is the similarity between observations as a function of
the time lag between them. The analysis of autocorrelation is a mathematical tool for finding
repeating patterns, such as the presence of a periodic signal obscured by noise, or identifying the
missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in
signal processing for analyzing functions or series of values, such as time domain signals.

MATLAB PROGRAM:

clc;
close all;
clear all;
% two input sequences
x=input('enter input sequence');
h=input('enter the impulse suquence');
subplot(2,2,1);
stem(x);
xlabel('n');
ylabel('x(n)');
title('input sequence');
subplot(2,2,2);
stem(h);
xlabel('n');

27
SIGNALS & SYSTEMS LAB 20 ECL33

ylabel('h(n)');
title('impulse signal');

% cross correlation between two sequences


y=xcorr(x,h);
subplot(2,2,3);
stem(y);
xlabel('n');
ylabel('y(n)');
title(' cross correlation between two sequences ');

% auto correlation of input sequence


z=xcorr(x,x);
subplot(2,2,4);
stem(z);
xlabel('n');
ylabel('z(n)');
title('auto correlation of input sequence');

% cross correlation between two signals


% generating two input signals
t=0:0.2:10;
x1=3*exp(-2*t);
h1=exp(t);
figure;
subplot(2,2,1);
plot(t,x1);
xlabel('t');
ylabel('x1(t)');
title('input signal');
subplot(2,2,2);
plot(t,h1);
xlabel('t');
ylabel('h1(t)');
title('impulse signal');

% cross correlation
subplot(2,2,3);
z1=xcorr(x1,h1);
plot(z1);
xlabel('t');
ylabel('z1(t)');
title('cross correlation ');
28
SIGNALS & SYSTEMS LAB 20 ECL33

% auto correlation
subplot(2,2,4);
z2=xcorr(x1,x1);
plot(z2);
xlabel('t');
ylabel('z2(t)');
title('auto correlation ');

OUTPUT :

29
SIGNALS & SYSTEMS LAB 20 ECL33

30
SIGNALS & SYSTEMS LAB 20 ECL33
18ECL43 : SIGNALS AND SYSTEMS LAB MANUAL

Program 10: Sampling Theorem Verification.

Aim: Matlab program to verify Sampling Theorem.

Software Required: MATLAB

Theory:
A continuous time signal can be represented in its samples and can be recovered back
when sampling frequency fs is greater than or equal to the twice the highest frequency
component of message signal. i. e.
fs≥2fm.

Proof: Consider a continuous time signal x(t). The spectrum of x(t) is a band limited to
fm Hz i.e. the spectrum of x(t) is zero for |ω|>ωm.
Sampling of input signal x(t) can be obtained by multiplying x(t) with an impulse train
δ(t) of period Ts. The output of multiplier is a discrete signal called sampled signal
which is represented with y(t) in the following diagrams:

Here, you can observe that the sampled signal takes the period of impulse.

41
SIGNALS & SYSTEMS LAB 20 ECL33

MATLAB PROGRAM:

clc;
clear all;
close all;
t=-10:.01:10;
T=4;
fm=1/T;
x=cos(2*pi*fm*t);
subplot(2,2,1);
plot(t,x);
xlabel('time');
ylabel('x(t)');
title('continous time signal');
grid;
n1=-4:1:4;
fs1=1.6*fm;
fs2=2*fm;
fs3=8*fm;
x1=cos(2*pi*fm/fs1*n1);
subplot(2,2,2);
stem(n1,x1);
xlabel('time');
ylabel('x(n)');
title('discrete time signal with fs<2fm');
hold on;
subplot(2,2,2);
plot(n1,x1);
grid;
n2=-5:1:5;
x2=cos(2*pi*fm/fs2*n2);
subplot(2,2,3);
stem(n2,x2);
xlabel('time');
ylabel('x(n)');
title('discrete time signal with fs=2fm');
hold on;
subplot(2,2,3);
plot(n2,x2)
grid;
n3=-20:1:20;
x3=cos(2*pi*fm/fs3*n3);
subplot(2,2,4);

42
SIGNALS & SYSTEMS LAB 20 ECL33
18ECL43 : SIGNALS AND SYSTEMS LAB MANUAL

stem(n3,x3);
xlabel('time');
ylabel('x(n)');
title('discrete time signal with fs>2fm')
hold on;
subplot(2,2,4);
plot(n3,x3)
grid;

OUTPUT:

43

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy