Frequency analysis of discrete time signals is usually performed on digital signal processor, which may be general purpose digital computer or specially designed digital hardware. To perform frequency analysis on discrete time signal, we convert the time domain sequence to an equivalent frequency domain representation. We know that such representation is given by The Fourier transform X(ejw) of the sequence x(n). However, X(ejw) is a continuous function of frequency and therefore, It is not a computationally convenient representation of the sequence. DFT is a powerful computational tool for performing frequency analysis of discrete time signals. The N-point DFT of discrete time sequence x(n) is denoted by X(k) and is defined as.
x(n)= n)
Program:
clc;
close all;
clear all;
xn=input(‘Enter the sequence x(n)’);
ln=length(xn); %find the length of the sequence
xk=zeros(1,ln); %let’s initialize an array of the same size as that of input sequence
ixk=zeros(1,ln); let’s initialize an array of the same size as that of input sequence
%DFT of the sequence
for k=0:ln-1
for n=0:ln-1
xk(k+1)=xk(k+1)+(xn(n+1)*exp((i)*2*pi*k*n/ln));
end
end
%Plotting input sequence
t=0:ln-1;
subplot(221);
stem(t,xn);
ylabel (‘Amplitude’);
xlabel (‘Time Index’);
title(‘Input Sequence’);
magnitude=abs(xk); % In order to find the magnitudes for the individual DFT points
% plot the magnitude response
t=0:ln-1;
subplot(222);
stem(t,magnitude);
ylabel (‘Amplitude’);
xlabel (‘K’);
title(‘Magnitude Response’);
phase=angle(xk); % In order to find the phases of individual DFT points % plot the magnitude
t=0:ln-1;
subplot(223);
stem(t,phase);
ylabel (‘Phase’);
xlabel (‘K’);
title (‘Phase Response’);
%IDFT of the sequence
for n=0:ln-1
for k=0:ln-1
ixk(n+1)=ixk(n+1)+(xk(k+1)*exp(i*2*pi*k*n/ln));
end
end
ixk=ixk./ln;
%code block to plot the input sequence
t=0:ln-1;
subplot(224);
stem(t,ixk);
ylabel (‘Amplitude’);
xlabel (‘Time Index’);
title (‘IDFT sequence’);
User Problem Scenario: The Red Light "Panic" You press the power button on your Samsung…
Introduction: I Know the Feeling "We’ve all been there. You sit down to watch your…
User Problem Scenario: The "Diagnosis Loop" Paradox Imagine you notice your apps are slow. You…
🎓 Technical Module: Memory Maintenance Logic Module: WV-OS-307 Verified 2026 👨🏫 Instructor: Vangari Divya (M.Tech)…
Introduction: The Setup Paradox "There is a specific moment of frustration for every Samsung Smart…
Introduction: Lab Diary & Experience "When your Samsung TV screen begins to flicker or show…