DSP 4
DSP 4
Experiment - 4
Aim:
Write a simulation program to implement 8-point DIT-FFT algorithm and verify the same using
inbuilt simulation command. Plot the magnitude and phase response.
Theory:
A fast Fourier transform (FFT) is algorithm that computes the Discrete Fourier Transform (DFT) of
a sequence, or its inverse (IDFT). Fourier analysis converts a signal from its original domain (often
time or space) to a representation in the frequency domain and vice versa. The DFT is obtained by
decomposing sequence of values into components of different frequencies.
Decimation is the process of breaking down something into its constituent parts. Decimation in time
involves breaking down a signal in the time domain into smaller signals, each of which is easier to
handle. DIT (Decimation in time) algorithm is a way of implementing the Fast Fourier Transform
(FFT), thus reducing the total number of computations used by the DFT algorithms and making the
process faster and device-friendly.
MATLAB CODE:
clc;
clear all;
close all;
t = 0:7;
y = cos(t*pi./2);
n = length(y);
p = nextpow2(n);
disp(p);
z = zeros(1,2^p-n);
x = [y z];
disp(x);
x1 = bitrevorder(x);
disp(x1)
n = length(x1);
s = log2(n)
w = exp(-2*1j*pi/n).^(0:(n/2)-1);
for i = 1:s
m = i;
for k = 1:2^m:n
for l = 0:2^(m-1)-1
a = x1(k+l);
b = x1(k+l+2^(m-1))*w(l*n/(2^m)+1);
x1(k+l)=a+b;
x1(k+l+2^(m-1)) = a-b;
end
end
end
x2 = fft(x);
subplot(3,2,1);
stem(t,y,'LineWidth',2.5);
title("Input Signal");
axis([-1 8 -2 2]);
grid on;
subplot(3,2,2)
stem(t,angle(y),'LineWidth',2.5);
title("Input Phase plot");
axis([-1 8 -5 5]);
grid on;
subplot(3,2,5);
stem(t,abs(x1),'LineWidth',2.5);
title('Magnitude plot');
xlabel('Frequency');
ylabel('Amplitude');
axis([-1 8 -5 5]);
grid on;
subplot(3,2,6);
stem(t,angle(x2),'LineWidth',2.5);
title('Phase plot');
xlabel('Frequency');
ylabel('Amplitude');
axis([-1 8 -5 5]);
grid on;
subplot(3,2,3);
stem(t,x1,'LineWidth',2.5);
title('DIT-FFT Without Using Inbuilt function');
xlabel('Frequency');
ylabel('Amplitude');
axis([-1 8 -5 5]);
grid on;
subplot(3,2,4);
stem(t,x2,'LineWidth',2.5);
title('DIT-FFT Using Inbuilt function');
xlabel('Frequency');
ylabel('Amplitude');
axis([-1 8 -5 5]);
grid on;
Output
Conclusions:
Sign