0% found this document useful (0 votes)
12 views49 pages

DSP Manual Final

Uploaded by

baazsaikat
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)
12 views49 pages

DSP Manual Final

Uploaded by

baazsaikat
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/ 49

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

ENGINEERING

DIGITAL SIGNAL PROCESSING LABORATORY[BEC502]


(PRACTICAL COMPONENT OF IPCC)
SEMESTER – 5 [ODD SEM]
2022 SCHEME

Prepared By,
Mrs. MAMATHA M
Assistant Professor
Dept. of ECE.
DSP LAB [BEC502]

VISION

To become a distinguished department by imparting quality technical education, innovation


and research to cater technological resources for industry and societal growth.

MISSION
 Nurture excellence in the field of Electronics and Communication Engineering to meet the needs
of the industry.

 Facilitate students by promoting multidisciplinary skill development, type certification courses


suitable for industry, innovation and research.

 Foster overall personality of the students and faculties by providing behavioural, professional
attitude and ethical values through state of art in Science and Technology.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 1


DSP LAB [BEC502]

Program Outcomes (POs)


At the end of the B.E program, students are expected to have developed the following outcomes.
PO1 Engineering Apply the knowledge of mathematics, science, engineering
Knowledge fundamentals, and an engineering specialization to the solution of
complex engineering problems.
PO2 Problem analysis Identify, formulate, research literature, and analyze complex
engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering
sciences.
PO3 Design/developm Design solutions for complex engineering problems and design
ent of solutions system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
PO4 Conduct Use research-based knowledge and research methods including
investigations of design of experiments, analysis and interpretation of data, and
complex synthesis of the information to provide valid conclusions.
problems
PO5 Modern Tool Create, select, and apply appropriate techniques, resources, and
Usage modern engineering and IT tools including prediction and modelling
to complex engineering activities with an understanding of the
limitations.
PO6 The Engineer Apply reasoning informed by the contextual knowledge to assess
and Society societal, health, safety, legal, and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
PO7 Environment Understand the impact of the professional engineering solutions in
and societal and environmental contexts, and demonstrate the knowledge
Sustainability of need for sustainable development.
PO8 Ethics Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO9 Individual and Function effectively as an individual, and as a member or leader in
Team Work diverse teams, and in multidisciplinary settings.
PO10 Communication Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able
to comprehend and write effective reports and design documentation,
make effective presentations, and give and receive clear instructions.
PO11 Project Demonstrate knowledge and understanding of the engineering and
Management management principles and apply these to one‘s own work, as a
and Finance member and leader in a team, to manage projects and in
multidisciplinary environments
PO12 Life-long Recognize the need for, and have the preparation and ability to
learning engage in independent and life-long learning in the broadest context
of technological change

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 2


DSP LAB [BEC502]

Do’s:

1. Students must bring observation/Manual book along with pen, pencil and eraser etc.

2. Students must handle the hardware kit and other components carefully as they are expensive

3. Before entering to lab, must prepare for viva for which they are going to conduct experiment.

4. Before switching on the hardware kit, the connections must be shown to one of the lab’s in-charge

faculty members or instructors.

5. After the completion of the experiment should return the components to the lab instructors.

6. Strictly follow the procedures for conduction of experiments.

7. Any breakdown/failure of equipment must be reported to the technical staff immediately.

8. Uniform and ID card are must.

9. Maintain silence inside the laboratory

10.Keep your belongings in designated area.

11.Wear shock–proof footwear while entering into the circuit lab

12.Chairs and stools should be kept under the workbenches when not in use.

13.Sit upright on chairs or stools, keeping feet on the floor.

14.Every student should know the location and operating procedures of all Safety equipment

including First Aid Kit and Fire extinguisher.

DONT’S:

1. Don’t eat food, drink beverages or chew gum in the laboratory.

2. Don’t touch any live terminals.

3. Don’t spread unwanted connecting wires on the table.

4. Don’t play with the instruments laid on work bench.

5. Don’t transfer equipment to other workbench or other labs without permission.

6. Don’t change connection when supply is on.

7. Don’t leave the experiment table unattended when the experimental setup supply is on.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 3


DSP LAB [BEC502]

LAB RUBRICS FOR 25 MARKS

Sl. DESCRIPTION MARKS SCALED


No. MARKS
1. CONTINUOUS EVALUATION 35

 Observation write-up & punctuality 5


 Conduction of experiment and output 15 15
 Viva voce 5
 Record write-up 10

2. INTERNAL TEST 50 10

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 4


DSP LAB [BEC502]

Table of Contents
Bloom’s
SL PAGE
EXPERIMENTS Taxonomy
NO. NO.
(RBT)Levels
Program to generate the following discrete time signals. a) Unit sample L2, L3, L4
1 sequence, b) Unit step sequence, c) Exponential sequence, d) Sinusoidal 6
sequence, e) Random sequence
Program to perform the following operations on signals. a) Signal addition, L2, L3, L4
2 9
b) Signal multiplication, c) Scaling, d) Shifting, e) Folding
Program to perform convolution of two given sequences (without using L2, L3, L4
3 14
built-in function) and display the signals.
Consider a causal system y(n) = 0.9y(n-1)+x(n). a) Determine H(z) L2, L3, L4
4 and sketch its pole zero plot. b) Plot |H(ejω)| and ∠ H(ejω) c)Determine 16
the impulse response h(n).
Computation of N point DFT of a given sequence (without using built-in L2, L3, L4
5 18
function) and to plot the magnitude and phase spectrum.
Using the DFT and IDFT, compute the following for any two given L2, L3, L4
6 20
sequences a) Circular convolution b) Linear convolution
Verification of Linearity property, circular time shift property &circular L2, L3, L4
7 22
frequency shift property of DFT.
Develop decimation in time radix-2 FFT algorithm without using built- L2, L3, L4
8 26
in functions
Design and implementation of digital low pass FIR filter using awindow to L2, L3, L4
9 28
meet the given specifications
Design and implementation of digital high pass FIR filter using a L2, L3, L4
10 30
window to meet the given specifications
Design and implementation of digital IIR Butterworth low pass filter to L2, L3, L4
11 32
meet the given specifications.
Design and implementation of digital IIR Butterworth high pass filter to L2, L3, L4
12 35
meet the given specifications
Additional Programs
MATLAB code to perform cross correlation of given sequence
13 38

MATLAB code to perform auto correlation of given sequence


14 39

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 5


DSP LAB [BEC502]

EXPERIMENT 1

Aim: Program to generate the following discrete time signals. a) Unit sample sequence, b)
Unit step sequence, c) Exponential sequence, d) Sinusoidal sequence, e) Random sequence.

Theory:
 Signal is a time varying physical phenomenon which is intended to convey information.
Signal is a function of one or more independent variables, which contain some
information.
Example: voice signal, video signal, signals on telephone wires etc.
 System is a device or combination of devices, which can operate on signals and produces
corresponding response. Input to a system is called as excitation and output from it is
called as response. For one or more inputs, the system can have one or more outputs.

a) Unit sample sequence

% Parameters
n = -10:10; % Range of n
x = zeros(size(n)); % Initialize sequence

% Unit Sample Sequence


x(n == 0) = 1;

% Plot
stem(n, x);
title('Unit Sample Sequence');
xlabel('n');
ylabel('x[n]');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 6


DSP LAB [BEC502]

b) Unit step sequence

% Parameters
n = -10:10; % Range of n
x = double(n >= 0); % Unit Step Sequence

% Plot
stem(n, x);
title('Unit Step Sequence');
xlabel('n');
ylabel('x[n]');

c) Exponential sequence

% Parameters
n = -10:10; % Range of n
a = 0.9; % Base of the exponential
x = a.^n; % Exponential Sequence

% Plot
stem(n, x);
title('Exponential Sequence');
xlabel('n');
ylabel('x[n]');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 7


DSP LAB [BEC502]

d) Sinusoidal sequence
% Parameters
n = -10:10; % Range of n
omega = pi/4; % Angular Frequency
x = sin(omega * n); % Sinusoidal Sequence

% Plot
stem(n, x);
title('Sinusoidal Sequence');
xlabel('n');
ylabel('x[n]');

e) Random sequence

% Parameters
n = -10:10; % Range of n
x = rand(size(n)); % Random Sequence
% Plot
stem(n, x);
title('Random Sequence');
xlabel('n');
ylabel('x[n]');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 8


DSP LAB [BEC502]

EXPERIMENT 2

Aim: Program to perform the following operations on signals. a) Signal addition, b) Signal
multiplication, c) Scaling, d) Shifting, e) Folding

Theory:

Addition:
Let x1[n] and x2[n] denote a pair of discrete time signals. The signal y[n] obtained by the addition
of x1[n] + x2[n] is defined as

y(n) = x1[n] + x2[n]


Example: audio mixer

Multiplication:
Let x1[n] and x2[n] denote a pair of discrete-time signals. The signal y[n] resulting from the
multiplication of the x1(n) and x2[n] is defined by

y[n] =x 1 [n].x 2 [n]


Time Scaling:
Let y(t) is a compressed version of x(t) The signal y(t) obtained by scaling the independent
variable, time t, by a factor k is defined by

y(t) = x(kt)

 if k > 1 the signal y(t) is a compressed version of x(t)

 if, on the other hand, 0 < k < 1 the signal y(t) is an expanded (stretched) version of x(t)

Time Shift:
A signal may be shifted in time by replacing the independent variable n by n-k, where k is
an integer. If k is a positive integer, the time shift results in a delay of the signal by k units of time.
If k is a negative integer, the time shift results in an advance of the signal by |k| units in time.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 9


DSP LAB [BEC502]

a) Signal addition

% MATLAB program for signal addition

% Define time axis


t = -5:0.01:5;

% Define two example signals (you can modify these signals as needed)
signal1 = sin(t); % Sine wave signal
signal2 = cos(t); % Step signal

% Perform signal addition


added_signal = signal1 + signal2;

% Plot the signals


figure;

% Plot Signal 1
subplot(3, 1, 1);
plot(t, signal1);
title('Signal 1 (Sine Wave)');
xlabel('Time');
ylabel('Amplitude');
grid on;

% Plot Signal 2
subplot(3, 1, 2);
plot(t, signal2);
title('Signal 2 (Cosine Wave)');
xlabel('Time');
ylabel('Amplitude');
grid on;

% Plot Added Signal


subplot(3, 1, 3);
plot(t, added_signal, 'r');
title('Added Signal (Signal 1 + Signal 2)');
xlabel('Time');
ylabel('Amplitude');
grid on;

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 10


DSP LAB [BEC502]

b) Signal multiplication

% MATLAB program for signal multiplication


% Define the time axis
t = -5:0.01:5; % Time from -5 to 5 with a step of 0.01
% Define two signals (modify as needed)
signal1 = sin(t); % Signal 1: Sine wave
signal2 = cos(t); % Signal 2: Cosine wave
% Perform signal multiplication
multiplied_signal = signal1 .* signal2; % Element-wise multiplication
% Plot the signals and their multiplication
figure;
% Plot Signal 1
subplot(3, 1, 1);
plot(t, signal1);
title('Signal 1: Sine Wave');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot Signal 2
subplot(3, 1, 2);
plot(t, signal2);
title('Signal 2: Cosine Wave');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Plot the Multiplied Signal
subplot(3, 1, 3);
plot(t, multiplied_signal, 'r');
title('Multiplied Signal: Signal 1 * Signal 2');
xlabel('Time');
ylabel('Amplitude');
grid on;

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 11


DSP LAB [BEC502]

c) Scaling

% Define signal
n = 0:10;
x = sin(n);
% Scaling factor
k = 2;
% Scale the signal
x_scaled = k * x;
% Plot results
figure;
subplot(2,1,1);
stem(n, x);
title('Original Signal x[n]');
xlabel('n');
ylabel('x[n]');
subplot(2,1,2);
stem(n, x_scaled);
title('Scaled Signal k * x[n]');
xlabel('n');
ylabel('k * x[n]');

d) Shifting
% Define signal
n = 0:10;
x = sin(n);
% Shifting
shift_amount = 3; % Number of samples to shift
n_shifted = n + shift_amount;
% Plot results
figure;
subplot(2,1,1);
stem(n, x);
title('Original Signal x[n]');
xlabel('n');
ylabel('x[n]');
subplot(2,1,2);
stem(n_shifted, x);
title('Shifted Signal x[n-shift_amount]');
xlabel('n');
ylabel('x[n - shift_amount]');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 12


DSP LAB [BEC502]

e) Folding
% Define signal
n = 0:10;
x = sin(n);
% Folding (time-reversal)
n_folded = -n; % Reverse the time axis
x_folded = fliplr(x); % Reverse the signal values
% Plot results
figure;
subplot(2,1,1);
stem(n, x);
title('Original Signal x[n]');
xlabel('n');
ylabel('x[n]');
subplot(2,1,2);
stem(n_folded, x_folded);
title('Folded Signal x[-n]');
xlabel('n');
ylabel('x[-n]');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 13


DSP LAB [BEC502]

EXPERIMENT 3

Aim: Program to perform convolution of two given sequences (without using built-in function) and
display the signals

Theory:
The convolution sum is a fundamental concept in signal processing and systems analysis,
particularly for discrete-time signals. It is used to determine the output of a Linear Time-Invariant
(LTI) system when the input and the system's impulse response are known.
1. Convolution Sum Definition
For two discrete-time signals, x[n] (input signal) and h[n] (impulse response of the system), the
convolution sum is given by:

Where:
 y[n] is the output signal.
 x[k] the input signal.
 h[n−k] is the shifted and flipped impulse response.

Without using conv function

clc;
clear; x=[1 2 3 4];
h=[1 2 3 4];
m=length(x);
n=length(h);
X=[x,zeros(1,n)];
H=[h,zeros(1,m)];
for i=1:n+m-1
Y(i)=0;
for j=1:m
if(i-j+1>0)
Y(i)=Y(i)+X(j)*H(i-j+1);
else
end
end
end
disp(Y)

OUTPUT:

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 14


DSP LAB [BEC502]

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 15


DSP LAB [BEC502]

EXPERIMENT 4

Aim: Consider a causal system y(n) = 0.9y(n-1)+x(n).


a) Determine H(z) and sketch its pole zero plot.
b) Plot |H(ejω)| and ∠ H(ejω)
c) Determine the impulse response h(n).

% Part (a): Transfer Function and Pole-Zero Plot


b = [1 0]; % Coefficients of numerator
a = [1 -0.9]; % Coefficients of denominator

% Plot Pole-Zero
figure;
zplane(b, a);
title('Pole-Zero Plot of H(z)');

% Part (b): Frequency Response


[H, w] = freqz(b, a, 'half', 1024); % Compute frequency response

% Magnitude Response |H(e^j?)|


figure;
plot(w/pi, abs(H));
title('Magnitude Response |H(e^{j\omega})|');
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Magnitude');

% Phase Response ?H(e^j?)


figure;
plot(w/pi, angle(H));
title('Phase Response ?H(e^{j\omega})');
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Phase (radians)');

% Part (c): Impulse Response


n = 0:20; % Time indices
h = 0.9.^n; % Impulse response

figure;
stem(n, h);
title('Impulse Response h(n)');
xlabel('n');
ylabel('h(n)');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 16


DSP LAB [BEC502]

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 17


DSP LAB [BEC502]

EXPERIMENT 5

Aim: Computation of N point DFT of a given sequence (without using built-in function) and to

plot the magnitude and phase spectrum

Theory: In mathematics, the discrete Fourier transform (DFT) converts a finite sequence of

equally-spaced samples of a function into a same-length sequence of equally-spaced samples of

the discrete-time Fourier transform (DTFT), which is a complex-valued function of frequency.

The interval at which the DTFT is sampled is the reciprocal of the duration of the input sequence.

An inverse DFT is a Fourier series, using the DTFT samples as coefficients

of complex sinusoids at the corresponding DTFT frequencies. It has the same sample-values as

the original input sequence. The DFT is therefore said to be a frequency domain representation of

the original input sequence. If the original sequence spans all the non-zero values of a function, its

DTFT is continuous (and periodic), and the DFT provides discrete samples of one cycle. If the

original sequence is one cycle of a periodic function, the DFT provides all the non-zero values of

one DTFT cycle.

Example

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 18


DSP LAB [BEC502]

% Define the input sequence (you can modify this as needed)


x = [1, 2, 3, 4]; % Example sequence
N = length(x); % Number of points in DFT (assuming N is the length of the
sequence)

% Initialize the DFT result array


X = zeros(1, N);

% Compute the DFT


for k = 1:N
for n = 1:N
X(k) = X(k) + x(n) * exp(-1j * 2 * pi * (k-1) * (n-1) / N);
end
end

% Calculate magnitude and phase


magnitude = abs(X);
phase = angle(X);

% Plot the magnitude spectrum


figure;
subplot(2, 1, 1);
stem(0:N-1, magnitude);
title('Magnitude Spectrum');
xlabel('Frequency Index');
ylabel('Magnitude');
grid on;

% Plot the phase spectrum


subplot(2, 1, 2);
stem(0:N-1, phase);
title('Phase Spectrum');
xlabel('Frequency Index');
ylabel('Phase (radians)');
grid on;

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 19


DSP LAB [BEC502]

EXPERIMENT 6

Aim: Using the DFT and IDFT, compute the following for any two given sequences

a) Circular convolution b) Linear convolution

a) Circular convolution
% Define the two sequences (Example sequences)
x1 = [1 2 3 4]; % First sequence
x2 = [4 3 2 1]; % Second sequence

% Ensure the sequences are of the same length by zero-padding


N = max(length(x1), length(x2));
x1 = [x1 zeros(1, N - length(x1))];
x2 = [x2 zeros(1, N - length(x2))];

% Compute the DFT of both sequences


X1 = fft(x1);
X2 = fft(x2);

% Element-wise multiplication of the DFTs


Y = X1 .* X2;

% Compute the IDFT to obtain the circular convolution


y_circular_conv = ifft(Y);

% Display the result


disp('Circular convolution using DFT and IDFT:');
disp(y_circular_conv);

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 20


DSP LAB [BEC502]

b) Linear convolution

% Define the two sequences (Example sequences)


x1 = [1 2 3]; % First sequence
x2 = [4 3 2 1]; % Second sequence

% Determine the length of the linear convolution


N = length(x1) + length(x2) - 1;

% Zero-pad both sequences to the length of the linear convolution


x1_padded = [x1 zeros(1, N - length(x1))];
x2_padded = [x2 zeros(1, N - length(x2))];

% Compute the DFT of both zero-padded sequences


X1 = fft(x1_padded);
X2 = fft(x2_padded);

% Element-wise multiplication of the DFTs


Y = X1 .* X2;

% Compute the IDFT to obtain the linear convolution


y_linear_conv = ifft(Y);

% Display the result


disp('Linear convolution using DFT and IDFT:');
disp(y_linear_conv);

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 21


DSP LAB [BEC502]

EXPERIMENT 7

Aim: Verification of Linearity property, circular time shift property & circular frequency shift
property of DFT.

Proof :

a) Linearity property

The linearity property of the discrete Fourier transform (DFT) states that: For any two sequences x
and y, and any two scalars a and b, the DFT of the sequence (ax + by) is equal to (aX) + (bY),
where X and Y are the DFTs of x and y, respectively. Mathematically, it can be expressed as:
DFT(ax + by) = aDFT(x) + bDFT(y) This property makes the DFT a useful tool for analyzing and
processing linear systems.

b) Circular Time Shift Property


The circular time shift property of the discrete Fourier transform (DFT) states that: For any
sequence x of length N, and an integer k such that 0 <= k < N, the DFT of the circularly shifted
sequence x_shift, where x_shift[n] = x[(n-k) mod N], is equal to the element-wise multiplication of
the DFT of x by a complex exponential sequence. Mathematically, it can be expressed as:
DFT(x_shift) = DFT(x) * exp(-j * 2 * π * k * n / N) where j is the imaginary unit, π is the
mathematical constant pi, and * represents elementwise multiplication. This property makes the
DFT a useful tool for analyzing and processing signals that have undergone circular time shifts.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 22


DSP LAB [BEC502]

c) Circular frequency shift property


The circular frequency shift property of the discrete Fourier transform (DFT) states that: For any
sequence x of length N, and an integer k such that 0 <= k < N, the inverse DFT (IDFT) of the
element-wise multiplication of the DFT of x by a complex exponential sequence, is equal to the
circularly shifted sequence x_shift, where x_shift[n] = x[(n+k) mod N]. Mathematically, it can be
expressed as: IDFT(DFT(x) * exp(j * 2 * π * k * n / N)) = x_shift where j is the imaginary unit, π is
the mathematical constant pi, and * represents element-wise multiplication. This property makes the
DFT a useful tool for analyzing and processing signals that have undergone circular frequency
shifts.

Properties of DFT:

i) Linearity:

dft(ax(n)+by(n))=a dft(x(n))+b dft(y(n))


clc
close all
N = 4;
x =[1 4 5 7]
g = [3 6 4 2]
a=2;
b=3;
LHS= fft(a*x+b*g)
RHS= a*fft(x)+b*fft(g)

Result:

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 23


DSP LAB [BEC502]

Circular Time Shift Property


% Circular Time Shift Property
clc;
x = [1, 2, 3, 4, 5];
% Apply a circular time shift to the signal
y = circshift(x, 2);

N = length(x);
X = fft(x);
Y = fft(y);
for k=0:N-1
phase = exp(-1i*2*pi*k*2/N);
% Calculate the expression
result = X(k+1) * phase;

% Display each part separately


disp(result);
disp(Y(k+1));
end

Output:

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 24


DSP LAB [BEC502]

Circular Frequency Shift Property

%Circular Frequency Shift Property


clc
x = [1, 2, 3, 4, 5];
y = (abs(fft(x)));
shift=3;
d1=[0 0 0 0 0]
N = length(x);
for k=0:N-1
phase = exp(-1i*2*pi*k*shift/N);
d1(k+1)= x(k+1).*phase
end
disp('LHS');
disp(abs(fft(d1)));

disp('RHS');
disp (y);

Output:
"LHS"
2.6286556 4.253254 15. 4.253254 2.6286556
"RHS"
15. 4.253254 2.6286556 2.6286556 4.253254

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 25


DSP LAB [BEC502]

EXPERIMENT 8

Aim: Develop decimation in time radix-2 FFT algorithm without using built-in functions

Theory: In DFT radix -2 FFT the time domain sequence is decimated into 2-point sequences.
For each 2-point sequence,2 -point DFT can be computed. From the result of 2-point DFT the 4-
point DFT can be calculated. From the result of 4-point DFT the 8- point DFT can be calculated.

Program:
%Code for Radix two FFT
clc;
clear ;
clf;
X=[2 1 1 2]; % Input sequence
N=length(X);
A=2 ; % no of levels
x=zeros(1,4); % appending zeros
c=[0 2 1 3]
x(1)= X(1);
x(2)= X(3);
x(3)= X(2);
x(4)= X(4);
%disp(x)
j=sqrt(-1);
N=4; % N-Point DFT
w = cos(2*pi/N*[0:(N/2-1)])-j*sin(2*pi/N*[0:(N/2-1)]);
Y1=zeros(1,2);
Y1(1)=x(1)+x(2)
Y1(2)=x(1)-x(2)
Y2=zeros(1,2);
Y2(1)=x(3)+x(4)
Y2(2)=x(3)-x(4) %disp(Y1)
%disp(Y2)
Z=zeros(1,4);
Z(1)=Y1(1)+Y2(1)
Z(2)=Y1(2)+Y2(2).*w(2)
Z(3)=Y1(1)-Y2(1)
Z(4)=Y1(2)-Y2(2).*w(2)
fprintf('Radix 2 FFT without using inbuilt function:\n');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 26


DSP LAB [BEC502]

disp(Z);
% DFT using in built function
p=fft(X);
fprintf('FFT using inbuilt function:\n');
disp(p);

OUTPUT

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 27


DSP LAB [BEC502]

EXPERIMENT 9

Aim: Design and implementation of digital low pass FIR filter using a window to meet the given
specifications

Theory:

Characteristics of FIR filters


 Impulse response has finite duration (N cycles)
 Linear Phase, Constant Group Delay (N must be odd)
 No Analog Equivalent.
 Unconditionally Stable
 Can be adaptive
 Computationally Advantages when decimating output
 Easy to understand and design
Low pass FIR (Finite Impulse Response) filters are a type of digital filter used in signal processing.
The term "low pass" refers to the filter's ability to pass low-frequency signals while attenuating
(reducing the amplitude of) high-frequency signals. This makes them ideal for applications where it
is necessary to remove high-frequency noise or to focus on the low-frequency components of a signal.

Applications: Low pass FIR filters are used in various applications including:
 Audio Processing: To remove high-frequency noise from audio signals.
 Communication Systems: To filter out unwanted high-frequency components in received
signals.
 Image Processing: To smooth images by removing high-frequency noise.
 Data Analysis: To isolate low-frequency trends from high-frequency noise in time-series
data.

clc;
clear;
close all;

wp = input('Enter the pass band edge frequency (radians) = ');


ws = input('Enter the stop band edge frequency (radians) = ');
ks = input('Enter the stop band attenuation (dB) = ');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 28


DSP LAB [BEC502]

% Determine the filter order using empirical formulae


N = (2*pi*4) / (ws - wp);
N = ceil(N);

% Calculate cutoff frequency in normalized form


wc = (wp + (ws - wp)/2) / pi;

% Use Hamming window to design the filter


b = fir1(N, wc, 'low', hamming(N+1));

% Frequency response
[H, W] = freqz(b, 1, 1024);

% Plotting
figure;
plot(W/pi, 20*log10(abs(H)), 'r');
xlabel('Normalized Frequency (\times\pi rad/sample)');
ylabel('Magnitude (dB)');
title('Frequency Response for FIR Filter');
grid on;

OUTPUT:

Enter the pass band edge frequency (radians) = 0.3*pi


Enter the stop band edge frequency (radians) = 0.45*pi
Enter the stop band attenuation (dB) = 50

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 29


DSP LAB [BEC502]

EXPERIMENT 10

Aim: Design and implementation of digital High pass FIR filter using a window to meet the given
specifications

Theory:

High pass FIR (Finite Impulse Response) filters are designed to pass high-frequency signals
while attenuating low-frequency signals. They are widely used in various signal processing
applications to remove low-frequency noise or to focus on high-frequency components of a signal.

Applications:

High pass FIR filters are used in various applications including:

 Audio Processing: Removing low-frequency hum or rumble from audio signals.

 Communication Systems: Filtering out unwanted low-frequency components in received


signals.

 Image Processing: Enhancing edges by removing low-frequency components.

 Data Analysis: Isolating high-frequency variations from low-frequency trends in time-series


data.

% To Design a High Pass FIR Filter


clc;
clear;
close all;

wp = input('Enter the pass band edge frequency (radians) = ');


ws = input('Enter the stop band edge frequency (radians) = ');
ks = input('Enter the stop band attenuation (db) = ');

% Calculate cutoff frequency in normalized form


wc = (wp + (ws - wp) / 2) / pi;

% Filter order selection (adjust based on desired specs)


N = ceil((2 * pi * 4) / (ws - wp)); % empirical choice for simplicity

% Design the high-pass filter using Hamming window


b = fir1(N, wc, 'high', hamming(N + 1));

% Frequency response
[H, W] = freqz(b, 1, 1024);

% Plotting
figure;
plot(W / pi, 20 * log10(abs(H)), 'r');
xlabel('Normalized Digital Frequency (\times\pi rad/sample)');

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 30


DSP LAB [BEC502]

ylabel('Magnitude (dB)');
title('Frequency Response for FIR Filter');
grid on;

OUTPUT:

Enter the pass band edge frequency (radians) = 0.3*pi


Enter the stop band edge frequency (radians) = 0.45*pi
Enter the stop band attenuation (db) = 50

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 31


DSP LAB [BEC502]

EXPERIMENT 11

Aim: Design and implementation of digital low pass IIR filter using a window to meet the given
specifications

Theory:

Digital Infinite Impulse Response (IIR) filters are commonly used in signal processing to filter
out unwanted frequencies from a signal. Low pass IIR filters allow frequencies below a certain
cutoff frequency to pass through while attenuating higher frequencies. Unlike FIR filters, IIR filters
have an impulse response that lasts indefinitely due to their feedback components.

Characteristics:

 Feedback Mechanism: IIR filters use both past inputs and past outputs, which provides them
with an infinite impulse response.

 Efficient Filtering: IIR filters can achieve a desired filtering effect with fewer coefficients
compared to FIR filters.

 Potential for Instability: The feedback mechanism can lead to instability if the filter is not
properly designed.

 Non-linear Phase Response: Unlike FIR filters, IIR filters generally have a non-linear phase
response.

Applications:

 Audio Processing: Removing low-frequency noise from audio signals.

 Communication Systems: Filtering out unwanted low-frequency components in received


signals.

 Biomedical Engineering: Filtering out noise from ECG and other biomedical signals.

 Data Analysis: Removing low-frequency trends from time-series data to focus on high-
frequency variations.

Program:

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 32


DSP LAB [BEC502]

% Design and implementation of digital IIR Butterworth low pass filter


clc;
clear;
close all;
fp = 1000; % Pass band edge frequency (Hz)
fs = 1500; % Stop band edge frequency (Hz)
kp = -1; % Pass band attenuation (dB)
ks = -3; % Stop band attenuation (dB)
Fs = 8000; % Sampling rate (samples/sec)
d1 = 10^(kp/20);
d2 = 10^(ks/20);
d = sqrt((1/(d2^2)) - 1);
E = sqrt((1/(d1^2)) - 1);

% Digital Filter specifications (rad/samples)


wp = 2 * pi * fp / Fs;
ws = 2 * pi * fs / Fs;
disp(['Digital Pass band edge freq in rad/samples wp = ', num2str(wp)]);
disp(['Digital Stop band edge freq in rad/samples ws = ', num2str(ws)]);

% Pre-warping
op = 2 * Fs * tan(wp / 2);
os = 2 * Fs * tan(ws / 2);
disp(['Analog Pass Band Edge Freq in rad/sec op = ', num2str(op)]);
disp(['Analog Stop band Edge Freq in rad/sec os = ', num2str(os)]);

% Calculate the filter order and cutoff frequency


[N, oc] = buttord(op / (2 * pi), os / (2 * pi), abs(kp), abs(ks), 's');
disp(['IIR Filter order N = ', num2str(N)]);
disp(['Cutoff frequency in rad/seconds OC = ', num2str(oc * 2 * pi)]);
% Design Butterworth analog filter
[pols, gn] = butter(N, oc * 2 * pi, 's');
disp(['Gain of analog filter = ', num2str(gn)]);
disp('Poles of analog IIR Butterworth LPF:');
disp(pols);
% Convert analog filter to digital
[num, den] = bilinear(pols, gn, Fs);
Hz = tf(num, den, -1);
disp('Transfer function of Digital IIR Butterworth LPF H(z):');
disp(Hz);
% Frequency response
[Hw, w] = freqz(num, den, 256, Fs);
figure(1);
plot(w / pi, 20 * log10(abs(Hw)));
xlabel('Normalized Digital Frequency \omega -->');
ylabel('Magnitude in dB |H(\omega)|');
title('Magnitude Response of IIR LPF');
grid on;

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 33


DSP LAB [BEC502]

Output:

Digital Pass band edge freq in rad/samples wp = 0.7854


Digital Stop band edge freq in rad/samples ws = 1.1781
Analog Pass Band Edge Freq in rad/sec op = 6627.417
Analog Stop band Edge Freq in rad/sec os = 10690.8582
IIR Filter order N = 2
Cutoff frequency in rad/seconds OC = 10703.5583
Gain of analog filter = 1 15137.11733395 114566160.5908
Poles of analog IIR Butterworth LPF:
1.0e+08 *

0 0 1.1457

Transfer function of Digital IIR Butterworth LPF H(z):


tf with properties:

num: {[0.1870 0.3739 0.1870]}


den: {[1 -0.4616 0.2095]}
Variable: 'z'
ioDelay: 0
InputDelay: 0
OutputDelay: 0
Ts: -1
TimeUnit: 'seconds'
InputName: {''}
InputUnit: {''}
InputGroup: [1x1 struct]
OutputName: {''}
OutputUnit: {''}
OutputGroup: [1x1 struct]
Name: ''
Notes: {}
UserData: []

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 34


DSP LAB [BEC502]

EXPERIMENT 12

Aim: Design and implementation of digital high pass IIR filter using a window to meet the given
specifications

Theory: Digital Infinite Impulse Response (IIR) filters are used in signal processing to allow
frequencies above a certain cutoff frequency to pass through while attenuating lower frequencies.
High pass IIR filters are particularly useful for removing low-frequency noise or isolating high-
frequency components.

Applications:

 Audio Processing: Removing low-frequency hum or rumble from audio signals.

 Communication Systems: Filtering out unwanted low-frequency components in received


signals.

 Biomedical Engineering: Filtering out low-frequency noise from ECG and other
biomedical signals.

 Data Analysis: Isolating high-frequency variations in time-series data from low-frequency


trends.

Program:

% Design and implementation of digital IIR Butterworth high pass filter


clc;
clear;
close all;

% Specifications
fp = 1000; % Pass band edge frequency (Hz)
fs = 1500; % Stop band edge frequency (Hz)
kp = -1; % Pass band attenuation (dB)
ks = -3; % Stop band attenuation (dB)
Fs = 8000; % Sampling rate (samples/sec)
d1 = 10^(kp/20);
d2 = 10^(ks/20);
d = sqrt((1/(d2^2)) - 1);
E = sqrt((1/(d1^2)) - 1);

% Digital Filter specifications (rad/sample)


wp = 2*pi*fp/Fs;
ws = 2*pi*fs/Fs;
fprintf('Digital Pass band edge freq in rad/samples wp= %f\n', wp);
fprintf('Digital Stop band freq in rad/samples ws= %f\n', ws);

% Pre-warping
op = 2*Fs*tan(wp/2);
os = 2*Fs*tan(ws/2);
fprintf('Analog Pass Band Edge Freq in rad/sec op= %f\n', op);
fprintf('Analog Stop band Edge Freq in rad/sec os= %f\n', os);

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 35


DSP LAB [BEC502]

N = log10(d/E) / log10(os/op);
N = ceil(N); % Rounded to nearest integer
oc = op / ((E^2)^(1/(2*N)));
fprintf('IIR Filter order N = %d\n', N);
fprintf('Cutoff frequency in rad/seconds OC = %f\n', oc);

% Design Butterworth filter


[z, p, k] = butter(N, oc, 'high', 's');
fprintf('Gain of analog filter = %f\n', k);
fprintf('Poles of analog IIR Butterworth HPF:\n');
disp(p);

% Transfer function of Analog IIR Butterworth HPF


HS = zpk(z, p, k);
fprintf('Transfer function of Analog IIR Butterworth HPF H(S):\n');
disp(HS);

% Convert analog filter to digital using bilinear transform


[num, den] = bilinear(k * poly(z), poly(p), Fs);
Hz = tf(num, den, 1/Fs);
fprintf('Transfer function of Digital IIR Butterworth HPF H(z):\n');
disp(Hz);

% Frequency response
[Hw, w] = freqz(num, den, 256, Fs);
figure(1);
plot(w / pi, 20 * log10(abs(Hw)));
xlabel('Normalized Digital Frequency (\times\pi rad/sample)');
ylabel('Magnitude (dB)');
title('Magnitude Response of IIR HPF');
grid on;

OUTPUT:

Digital Pass band edge freq in rad/samples wp= 0.785398


Digital Stop band freq in rad/samples ws= 1.178097
Analog Pass Band Edge Freq in rad/sec op= 6627.416998
Analog Stop band Edge Freq in rad/sec os= 10690.858207
IIR Filter order N = 2
Cutoff frequency in rad/seconds OC = 9290.746885
Gain of analog filter = 1.000000
Poles of analog IIR Butterworth HPF:
1.0e+03 *
-6.5696 + 6.5696i
-6.5696 - 6.5696i

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 36


DSP LAB [BEC502]

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 37


DSP LAB [BEC502]

ADDITIONAL PROGRAMS

13.AIM: To write a MATLAB code to perform cross correlation of given two sequences

PROGRAM:

clc;
a=input('enter the input sequence');
b=input('enter the input sequence');
y=xcorr(a,b);
disp('the value of y are')
disp(y)
n=0:length(y)-1;
stem(n,y)
xlabel('time');
ylabel('amplitude');
title('cross correlation');

OUTPUT:
Enter the input sequence[1 2 3 4]
Enter the input sequence[4 3 2 1]
The value of y are
1.0000 4.0000 10.0000 20.0000 25.0000 24.0000 16.0000

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 38


DSP LAB [BEC502]

14. AIM: To write a MATLAB code to perform auto correlation of given sequence

PROGRAM:

clc;
a=input('enter the input sequence');
y=xcorr(a,a);
disp('the value of y are')
disp(y)
n=0:length(y)-1;
stem(n,y)
xlabel('time');
ylabel('amplitude');
title('auto correlation');

OUTPUT:
Enter the input sequence[1 2 3 4]
The value of y are
4.0000 11.0000 20.0000 30.0000 20.0000 11.0000 4.0000

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 39


DSP LAB [BEC502]

Digital Signal Processing LAB VIVA Questions

1) Mention basic blocks of DSP and DSP Applications

The fundamental building blocks of DSP are:


 Analog-to-Digital Converter (ADC)
 Digital Signal Processor
 Memory
 Input/Output Interfaces
 Digital-to-Analog Converter (DAC)
DSP Applications
1. Audio and Speech Processing:
o Applications: Noise reduction, echo cancellation, compression, and synthesis.
o Example: Digital hearing aids that filter out background noise.
2. Communications:
o Applications: Modulation, demodulation, error detection and correction, and signal
encryption.
o Example: Mobile phones using DSP for signal encoding and decoding.
3. Image and Video Processing:
o Applications: Compression, enhancement, noise reduction, and feature extraction.
o Example: JPEG compression algorithms that reduce image file sizes.
4. Medical Signal Processing:
o Applications: ECG analysis, MRI image processing, and ultrasound imaging.
o Example: Portable ECG monitors that analyze heart signals in real-time.
5. Radar and Sonar:
o Applications: Target detection, range estimation, and signal processing for
navigation.
o Example: Automotive radar systems for collision avoidance.
6. Control Systems:
o Applications: Signal filtering, real-time control, and adaptive systems.
o Example: Industrial robots using DSP for precise movement control.
7. Consumer Electronics:
o Applications: Audio equalizers, digital TVs, and video game consoles.
o Example: Digital cameras using DSP for image stabilization and enhancement.

2) Mention advantages and disadvantages of DSP

Advantages of Digital Signal Processing (DSP)


1. Precision and Accuracy:
DSP allows for higher precision and accuracy compared to analog processing. Digital signals
can be processed without the noise and distortion inherent in analog signals.
2. Flexibility:
DSP systems can be easily reprogrammed or reconfigured to handle different types of signals
and processing tasks. This adaptability makes DSP versatile and valuable across various
applications.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 40


DSP LAB [BEC502]

3. Reproducibility:
Digital systems provide consistent and repeatable results. Once a digital signal processing
algorithm is developed, it will yield the same output every time, given the same input.
4. Noise Immunity:
DSP is more immune to noise and interference compared to analog processing. Digital
systems can employ error detection and correction techniques to further improve reliability.
5. Storage and Transmission:
Digital signals can be easily stored and transmitted without degradation. This is crucial for
applications like audio and video recording, where maintaining quality is essential.
6. Complex Algorithms:
DSP can handle complex mathematical algorithms that are impractical or impossible to
implement in analog form. This enables advanced signal processing techniques such as fast
Fourier transforms (FFT), adaptive filtering, and more.
7. Integration and Miniaturization:
Digital circuits can be integrated into compact and efficient designs, making them suitable for
portable and embedded applications.

Disadvantages of Digital Signal Processing (DSP)


1. Complexity:
DSP systems are generally more complex to design and implement than analog systems. They
require a good understanding of digital electronics, signal processing algorithms, and software
development.
2. Latency:
Digital signal processing can introduce latency, especially in real-time applications. The
time required to sample, process, and output the signal can be a limiting factor in some
cases.
3. Power Consumption:
DSP systems typically consume more power than their analog counterparts. This can be a
drawback in battery-powered applications where power efficiency is critical.
4. Sampling and Quantization Errors:
Converting analog signals to digital form can introduce errors such as quantization noise and
aliasing. Careful design and filtering are required to minimize these effects.
5. Initial Cost:
The initial cost of developing and deploying DSP systems can be high. This includes the cost
of hardware, software, and development resources.
6. Data Rate Requirements:
High data rates are required to process signals with high-frequency content or wide
bandwidth. This can put a strain on the processing capabilities and storage requirements of
the system.
7. Technical Expertise:
Implementing DSP solutions requires specialized knowledge in digital signal processing
techniques and hardware design. This can limit accessibility for those without the necessary
expertise.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 41


DSP LAB [BEC502]

3) Discuss the effect of under sampling for the given signal

Effects of Under-Sampling
1. Aliasing:
 When a signal is under-sampled, higher frequency components are incorrectly mapped (or
aliased) to lower frequencies in the sampled signal. This causes different frequency
components of the original signal to overlap, making it impossible to distinguish between
them in the sampled data.
 Example: If a 1 kHz signal is sampled at 1.5 kHz, frequencies above 750 Hz (half the
sampling rate) will alias back into the 0-750 Hz range.
2. Distortion:
 Aliased signals create distortion in the reconstructed signal. This distortion manifests as
unwanted frequency components that were not present in the original signal, leading to a loss
of fidelity.
 Example: An audio signal with a high-frequency component above the Nyquist rate will
introduce a low-frequency noise in the reconstructed audio, degrading its quality.
3. Information Loss:
 Under-sampling leads to a loss of information because the sampling rate is not sufficient to
capture the high-frequency details of the original signal.
 Example: In image processing, under-sampling can result in moiré patterns and loss of fine
details, such as in high-resolution photographs.
4. Ambiguity:
 Once aliasing has occurred, it is very difficult, if not impossible, to recover the original signal
accurately because the aliased frequencies overlap in a manner that cannot be unambiguously
separated.
 Example: In radar systems, under-sampling can cause false targets or missing targets due to
ambiguous frequency information.

4) Discuss the effect of Nyquist sampling for the given signal

Effects of Nyquist Sampling


1. Accurate Signal Reconstruction:
 When a signal is sampled at or above the Nyquist rate, it can be accurately reconstructed from
its samples without any loss of information.
 Example: A signal with a maximum frequency of 1 kHz sampled at 2 kHz (or higher) can be
perfectly reconstructed.
2. Prevention of Aliasing:
 Sampling at the Nyquist rate ensures that each frequency component of the signal is uniquely
represented. This prevents the overlap of different frequency components that would
otherwise occur if the signal were under-sampled.
 Example: In audio processing, sampling an audio signal at a rate higher than twice its
maximum frequency component ensures no high-frequency components are mistakenly
interpreted as lower frequencies.
3. Efficient Use of Data:
 Sampling exactly at the Nyquist rate is the most data-efficient way to capture a signal without
losing information or introducing artifacts.
 Example: A 1 kHz signal sampled at 2 kHz uses half the data that would be used if sampled
at 4 kHz, yet it still allows perfect reconstruction.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 42


DSP LAB [BEC502]

4. Bandwidth Considerations:
 For practical systems, sampling at the Nyquist rate requires careful consideration of the
system's bandwidth. Anti-aliasing filters must be used to remove frequencies above the
Nyquist limit to prevent aliasing.
 Example: In communication systems, anti-aliasing filters are used to ensure that signals are
band-limited before sampling to comply with the Nyquist criterion.

5) Discuss the effect of oversampling for the given signal.

Oversampling involves sampling a signal at a rate significantly higher than the Nyquist rate (twice
the highest frequency component present in the signal). This technique is commonly used in digital
signal processing to improve the performance and quality of the reconstructed signal.

Effects of Oversampling
1. Reduced Quantization Noise:
 Oversampling helps spread quantization noise over a broader frequency range, which can then
be filtered out. This effectively reduces the noise level within the frequency band of interest.
 Example: In audio processing, oversampling can improve the signal-to-noise ratio (SNR) by
spreading quantization errors across a wider frequency range.
2. Improved Signal Resolution:
 By sampling at a higher rate, more samples are taken within the same time interval, leading
to better resolution and finer details in the captured signal.
 Example: In digital imaging, oversampling can result in higher resolution images with finer
details.
3. Simplified Anti-Aliasing Filters:
 With oversampling, the cutoff frequency of the anti-aliasing filter can be placed higher,
allowing the use of simpler and less steep filters, which are easier to design and implement.
 Example: In A/D conversion, an oversampling ADC can use a simpler analog filter to prevent
aliasing, as the subsequent digital filters can effectively handle any remaining high-frequency
components.
4. Ease of Digital Filtering:
 In the digital domain, oversampling allows for the use of more efficient digital filters that can
achieve better performance and precision.
 Example: In communication systems, oversampling can improve the performance of digital
filters used for channel equalization and noise reduction.
5. Downsampling and Noise Shaping:
 Oversampled signals can be downsampled (decimated) to the desired rate after digital
filtering, allowing for noise shaping and further noise reduction in specific frequency bands.
 Example: In delta-sigma modulation, oversampling and noise shaping techniques are used to
achieve high-resolution A/D conversion.

6) Define Linear Convolution

 Linear convolution is a mathematical operation that combines two discrete-time signals to


produce a third signal. This operation is fundamental in signal processing and systems analysis
as it describes how the shape of one signal is modified by another. It is used to determine the
output of a linear time-invariant (LTI) system when an input signal is applied to it.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 43


DSP LAB [BEC502]

 Mathematically: If x[n] and h[n] are two discrete-time signals, their linear convolution y[n]
is defined as:

Where * denotes the convolution operation

7) Define Circular convolution

 Circular convolution, also known as cyclic convolution or periodic convolution, is a


mathematical operation used to combine two discrete-time signals in a way that the resulting
signal is periodic. Unlike linear convolution, which considers the entire length of the signals,
circular convolution wraps around the signals to produce a periodic result. It is particularly
useful in the context of Discrete Fourier Transform (DFT) and signal processing applications
where signals are assumed to be periodic.

 Mathematical Formulation: If x[n] and h[n] are two discrete-time signals of length N, their
circular convolution y[n] is defined as:

Where ⊛ denotes the circular convolution operation, and mod N represents the modulo operation
with respect to N.

8) Explain how Circular convolution is performed using Linear Convolution

To perform circular convolution using linear convolution, you can follow a straightforward approach
involving zero-padding and then applying linear convolution. The steps ensure that the resultant
signal behaves as if circular convolution had been applied. Here’s how it’s done:

Steps to Perform Circular Convolution Using Linear Convolution


1. Zero-Pad the Signals:
 Zero-pad both sequences x[n] and h[n] to the length N, where N is the length of the desired
circular convolution result. Typically, N is taken as the sum of the lengths of x[n] and h[n]
minus one.
 If x[n] has a length of L and h[n] has a length of M, zero-pad each to length N=L+M−1
2. Perform Linear Convolution:
 Apply linear convolution to the zero-padded sequences using the standard convolution
operation.
3. Wrap Around the Result:
 Wrap around the result of the linear convolution to obtain the circular convolution of the
original sequences.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 44


DSP LAB [BEC502]

9) Define Autocorrelation of Signal

Autocorrelation is a mathematical operation that measures the similarity of a signal with a delayed
version of itself over varying time lags. It provides insight into the repeating patterns or periodic
structures within the signal and is widely used in signal processing and time-series analysis.

Mathematical Expression: For a discrete-time signal x[n], the autocorrelation function Rxx[k] at
lag k is defined as:

For finite-length signals, the sum is taken over the length of the signal:

Where:
 x[n] is the signal.
 k is the lag, representing the shift amount.
 N is the length of the signal.

10) Define Cross-correlation of two signal

 Cross-correlation is a measure of similarity between two signals as a function of the time-lag


applied to one of them. It is widely used in signal processing to find the time delay between
two signals, detect patterns, and analyze the relationship between them.

 Mathematical Expression: For two discrete-time signals x[n] and y[n], the cross-correlation
function Rxy[k] at lag k is defined as:

For finite-length signals, the sum is taken over the length of the signals:

Where:
 x[n] and y[n]are the two signals.
 k is the lag, representing the shift amount.
 N is the length of the signals.

11) Explain properties of Correlation.

1. Symmetry:

Rxx(−k)=Rxx(k)

The autocorrelation function is symmetric about zero lag. This means that the autocorrelation of xx
with a positive lag is the same as with the corresponding negative lag.

2. Maximum at Zero Lag:

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 45


DSP LAB [BEC502]

The autocorrelation function reaches its maximum value at zero lag, which represents the total
energy of the signal.

3. Non-Negative at Zero Lag:


Rxx(0)≥Rxx(k)
The autocorrelation function is always non-negative at zero lag, as it represents the sum of the
squares of the signal values.
4. Even Function: Autocorrelation is an even function, meaning it remains unchanged if the
signal is reversed in time.

12) Obtain the circular convolution of the following sequences x(n) = {1,2,1}; h(n) = {1, -2,2}

The formula for circular convolution is:

1. For y[0]:
y[0]=x[0]h[0]+x[1]h[2]+x[2]h[1]
y[0]=1⋅1+2⋅2+1⋅(−2)
y[0]=1+4−2
y[0]=3
2. For y[1]:
y[1]=x[0]h[1]+x[1]h[0]+x[2]h[2]
y[1]=1⋅(−2)+2⋅1+1⋅2y[1] = 1
y[1]=−2+2+2
y[1]=2
3. For y[2]:
y[2]=x[0]h[2]+x[1]h[1]+x[2]h[0]
y[2]=1⋅2+2⋅(−2)+1⋅1y[2] = 1
y[2]=2−4+1y[2] = 2 - 4 + 1
y[2]=−1
The circular convolution of the sequences x(n)={1,2,1} and h(n)={1,−2,2} is:
y(n)= {3,2,−1}

13) Define DFT and IDFT

Discrete Fourier Transform (DFT)

Definition: The Discrete Fourier Transform (DFT) is a mathematical technique used to transform a
sequence of complex or real numbers into another sequence of complex numbers. This transformed

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 46


DSP LAB [BEC502]

sequence represents the frequency domain of the original time-domain sequence. The DFT is used
extensively in digital signal processing, image processing, and other fields to analyze the frequency
content of signals.

Mathematical Expression: For a discrete-time signal x[n] of length N, the DFT is defined as:

Where:
 x[n] is the input sequence.
 X[k] is the DFT of x[n].
 j is the imaginary unit (j2= -1).
 N is the length of the sequence.

Inverse Discrete Fourier Transform (IDFT)

Definition: The Inverse Discrete Fourier Transform (IDFT) is the mathematical operation that
transforms a sequence of complex numbers from the frequency domain back to the time domain. The
IDFT is used to reconstruct the original time-domain sequence from its frequency-domain
representation.

Mathematical Expression: For a sequence X[k] of length N, the IDFT is defined as:

Where:
 X[k] is the input sequence in the frequency domain.
 x[n] is the IDFT of X[k].
 j is the imaginary unit (j2= -1).
 N is the length of the sequence.

14) How many multiplications and additions are required to compute N –point DFT using

radix – 2 FFT?

 The number of complex multiplications and additions required is: Nlog2N

15) What is zero padding? What are its uses?


Zero padding is a technique used in digital signal processing where additional zero-valued
samples are added to the end of a signal. This increases the length of the signal to a desired value,
typically a power of two, which can improve the efficiency of certain computational algorithms.

Uses of Zero Padding:

 Improving Frequency Resolution: Zero padding increases the number of samples in the
signal, which leads to a finer frequency resolution in the frequency domain. This helps in more
precisely identifying the frequency components of the signal.
Example: For a short signal, zero padding can make the DFT/FFT output more detailed,
allowing for better visualization of frequency content.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 47


DSP LAB [BEC502]

 Efficient Computation: Algorithms like the Fast Fourier Transform (FFT) are optimized for
input lengths that are powers of two. Zero padding a signal to the next power of two can make
the FFT computation more efficient.
Example: A signal of length 30 can be zero padded to 32 for efficient FFT computation.

 Circular Convolution: Zero padding is used to perform linear convolution using circular
convolution. By zero padding the signals to a length equal to the sum of their lengths minus
one, the circular convolution becomes equivalent to the linear convolution.
Example: In MATLAB, performing convolution using the FFT requires zero padding to
avoid aliasing.

 Interference Reduction: In applications like speech processing, zero padding can help
reduce edge effects and discontinuities at the boundaries of the signal segments, leading to
cleaner processing results.
Example: Zero padding is used before applying window functions to segments of speech
signals to reduce spectral leakage.

 Signal Extension: Zero padding can be used to extend signals to a desired length, making
them compatible with other signals or systems of a specific length.
Example: In data transmission, zero padding ensures that transmitted packets have a uniform
length.

Faculty In-charge: Mamatha Mallesh, Dept. of ECE, VKIT 48

You might also like