0% found this document useful (0 votes)
78 views

Lab 10-Descrete Fourier Transform and Circular Convolution

The document discusses discrete Fourier transforms and circular convolution, providing objectives, time required, software needed and exercises to help understand the differences between various Fourier transforms, using the discrete Fourier transform to analyze sampled data, properties of the discrete Fourier transform, implementing circular convolution and shifting sequences in both time and frequency domains using MATLAB.

Uploaded by

Aleena Qureshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Lab 10-Descrete Fourier Transform and Circular Convolution

The document discusses discrete Fourier transforms and circular convolution, providing objectives, time required, software needed and exercises to help understand the differences between various Fourier transforms, using the discrete Fourier transform to analyze sampled data, properties of the discrete Fourier transform, implementing circular convolution and shifting sequences in both time and frequency domains using MATLAB.

Uploaded by

Aleena Qureshi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lab 10-Descrete Fourier Transform and Circular

Convolution

Lab Engineer: Muhammad Hammad

1 Objectives:
.
This Lab is about desecrate Fourier transform and circular convolution.

2 Time Required: 3 hrs


.
3 Programming Language: MATLAB
.
4 Software Required:
. (a). MATLAB 7 or above

Pre Lab
CIRCULAR CONVOLUTION
Remembering that convolution in the TD is multiplication in the FD (and vice-versa) for both
continuous and discrete infinite length sequences, we would like to see what happens for periodic,
finite duration sequences.
In circular or periodic convolution, we can look at the N point sequences as being distributed on a
circle due to the periodicity. Now we do the same thing (line up, multiply and add, then shift), but
with concentric circles. Let ‘s convolves x1(n)= (1,2,3) and x2(n)= (4,5,6). One sequence is
distributed clockwise and the other counterclockwise and the shift of the inner circle is clockwise.
So y(n) is obtained in a manner reminiscent of convolution with the modifications that x1(m) and
x2(m-n) are periodic in m with period N (this makes the ―circular‖ part) and consequently so is
their ―product‖ (periodic in m with period N and circular). Also remember that the summation is
carried out over only ONE period.

DISCRETE FOURIER TRANSFORM


Fourier analysis is extremely useful for data analysis, as it breaks down a signal into
constituent sinusoids of different frequencies. For sampled vector data Fourier analysis is
performed using the Discrete Fourier Transform (DFT).

The Discrete Fourier transform computes the values of the Z-transform for evenly spaced
points around the circle for a given sequence.

If the sequence to be represented is of finite duration i.e. it has only a finite number of non-
zero values, the transform used is Discrete Fourier transform.

It finds its application in Digital Signal processing including Linear filtering, Correlation
analysis and Spectrum analysis.

Consider a complex series x [n] with N samples of the form Where

x is a complex number Further, assume that the series outside the range 0,
N-1 is extended N-periodic, that is, xk = xk+N for all k. The FT of this series is denoted as X (k)
and has N samples. The forward transform is defined as

1 N −1 − j2  n k N
X(k) = 
N n =0
x ( n) e , for k = 0...N − 1

The inverse transform is defined as

Although the functions here are described as complex series, setting the imaginary part to
0 can represent real valued series. In general, the transform into the frequency domain will be a
complex valued function, that is, with magnitude and phase.

Excercise1: What is the difference in CTFT, DTFT, DFT and FFT. For what purpose FFT is
used. How Z transform is related to DFT.

IN LAB

ALGORITHM/PROCEDURE:
Discrete Fourier Transform
1. Click on the MATLAB icon on the desktop (or go to Start - All Programs and click on
MATLAB) to get into the Command Window
2. Type ‘edit’ in the MATLAB prompt ‘>>’ that appears in the Command window.
3. Write the program in the ‘Edit’ window and save it as ‘m-file’
4. Run the program
5. Enter the input in the command window
6. The result is displayed in the Command window and the graphical output is displayed in
the Figure Window
Library Functions:
• exp: Exponential Function.
exp (X) is the exponential of the elements of X, e to the power X. For complex Z=X+i*Y, exp
(Z) = exp(X)*(COS(Y) +i*SIN(Y)).

• disp: Display array.


disp (X) is called for the object X when the semicolon is not used to terminate a statement.

• max: Maximum elements of an array


C = max (A, B) returns an array of the same size as A and B with the largest elements taken from
A or B.

• fft: Discrete Fourier transform.


fft(x) is the discrete Fourier transform (DFT) of vector x. For the matrices, the FFT operation is
applied to each column. For N-Dimensional arrays, the FFT operation operates on the first non-
singleton dimension.
Circular Convolution
1. Enter the sequences (input x[n] and the impulse response h[n])
2. Make the length of the sequences equal by padding zeros to the smaller length sequence.
3. Perform the circular convolution between x[k] and h[k]and obtain y[n].
4. Find the FFT of x[n] & h[n].Obtain X and H
5. Multiply X and H to obtain Y
6. Find the IFFT of Y to obtain y’[n]
7. Compute error in time domain e=y[n]-y’[n]
8. Plot the Results

Exercise 2: Write a program as described above to perform Circular convolution of sequence


x=[1,2,4,5,3] and h =[2,3,5].

Exercise 3: Perform Linear Convolution using Circular Convolution.


DFT Properties

Two important concepts used in the application of the DFT are the circular-shift of a sequence and
the circular convolution of two sequences of the same length

Exercise 4: Write a Function for circular shifting a sequence in time domain, x[n-nd]. Take the
signal x and nd as input from user.
Exercise 5: Write function cshift which can circularly flip and then shift the input sequence as
above.

Source Code(DFT):
clc;
clear all;
close all;
%Get the sequence from user
disp('The sequence from the user:');
xn=input('Enter the input sequence x(n):');

% To find the length of the sequence


N=length(xn);

%To initilise an array of same size as that of input sequence


Xk=zeros(1,N);
iXk=zeros(1,N);

%code block to find the DFT of the sequence


Code the formula yourself for the sequence
%code block to plot the input sequence
t=0:N-1;
subplot(3,2,1);
stem(t,xn);
ylabel ('Amplitude');
xlabel ('Time Index');
title ('Input Sequence');

%code block to plot the X(k)


disp('The discrete fourier transform of x(n):');
disp(Xk);
t=0:N-1;
subplot(3,2,2);
stem(t,Xk);
ylabel ('Amplitude');
xlabel ('Time Index');
title ('X(k)');

% To find the magnitudes of individual DFT points


magnitude=abs(Xk);

%code block to plot the magnitude response


disp('The magnitude response of X(k):');
disp(magnitude);
t=0:N-1;
subplot(3,2,3);
stem(t,magnitude);
ylabel ('Amplitude');
xlabel ('K');
title ('Magnitude Response');

%To find the phases of individual DFT points


phase=angle(Xk);

%code block to plot the phase response


disp('The phase response of X(k):');
disp(phase);
t=0:N-1;
subplot(3,2,4);
stem(t,phase);
ylabel ('Phase');
xlabel ('K');
title ('Phase Response');

% Code block to find the IDFT of the sequence


Code the formula yourself for the sequence

%code block to plot the output sequence


t=0:N-1;
subplot(3,2,5);
stem(t,xn);
ylabel ('Amplitude');
xlabel ('Time Index');
title ('IDFT sequence');

%code block to plot the FFT of input sequence using inbuilt function
Code the formula yourself for the sequence

Command Window :

OUTPUT:
POST LAB

Exercise 6: Write a generic program for Circular convolution using discrete convolution. Do not
use any built in Convolution functions.

You might also like