DSP Lab Experiment-2
DSP Lab Experiment-2
EXPERIMENT-2: Analyze the signal and its properties in the frequency domain using the
MATLAB programming. Use the Discrete time Fourier transform (DTFT) and Discrete Fourier
Transform (DFT) for discrete signal analysis in frequency domain, and perform circular convolution
using DFT.
To find the DTFT of an arbitrary sequence and prove the convolution property using
programming.
THEORY: The discrete-time Fourier transform (DTFT) is the tool of choice for frequency domain
analysis of discrete-time signals and signal-processing systems.The discrete time Fourier transform
synthesis formula expresses a discrete time, aperiodic function as the infinite sum of continuous
frequency complex exponential.
X � = � � . �−���
�=−∞
The discrete time Fourier transform analysis formula takes the same discrete time domain signal and
represents the signal in the continuous frequency domain.
π
1
x n = X ω . ejωn
2π
−π
The DTFT of any signal is periodic with a period of 2� . DTFT gives much higher number of
frequency contents as compared to DFT which may be considered as sampled version of DTFT itself.
This is sometimes called acyclic convolution to distinguish it from the cyclic convolution used for
length sequences in the context of the DFT.
Where � and � denote the DTFTs of � and � respectively. That is, convolution in the time domain
corresponds to point-wise multiplication in the frequency domain.
MATLAB CODES:
*DTFT function:
function [X,n,w]=dtft_x(x)
n=0:length(x)-1;
w=-pi:2*pi/500:pi;
W=exp(-j*n'*w);
X=x*W;
MATLAB CODES:
*Function for DFT & IDFT:
function[X, n]=dft_x(x, N,a) % if a=1, finds DFT and if a=2 finds IDFT, default is finding DFT
lx=length(x);
n=0:N-1;
Wn=exp(-j*2*pi/N);
W=Wn.^(n'*n);
x=[x zeros(1,N-lx)];
if a~=2
X=x*W;
else
X=x*conj(W)/N;
end
*Codes for determining DFT and IDFT, & circular and linear convolution using DFT:
clc;
clear all;
x=input('enter the sequece');
lx=length(x);
N=input('enter the length of DFT:');
[X,k]=dft_x(x,N,1)
[x1,n]=dft_x(X,N,2)
subplot(411), stem(0:length(x)-1,x);xlabel('time: n');ylabel('input x(n)');title('plot of input signal');
subplot(412), stem(k,abs(X));xlabel('frequency index: k');ylabel('magnitude of X(k)');title('magnitude
plot of DFT of x');
subplot(413), stem(k,angle(X));xlabel('frequency index: k');ylabel('phase of X(k)');title('phase plot of
DFT of x');
subplot(414), stem(n,x1);xlabel('time: n');ylabel('IDFT of X(k)');title('plot ofIDFT of X(k)');
%%%%circular convolution
%%x1Ox2---->X1*X2
RESULTS:
The below figure displays an arbitrary signal �(�), its DFT � � and inverse DFT of � � . The IDFT
can be seen as same as � � .
The circular convolution of two signals can be found by using the convolution property of DFT which
says that the DFT of circular convolution of two signals is same is the point-wise multiplication of
individual DFTs of the two signals.
The linear convolution can be determined using circular convolution if the number of points in
circular convolution is kept as sum of the lengths of two sequences minus 1. The below figure
displays the results obtained using these fundamentals.
CONCLUSION: