MATLAB Realization of FFT/IFFT w/o Direct Function

Fast Fourier Transform (FFT) is an efficient technique to implement Discrete Fourier Transform (DFT). FFT is used to observe the frequency domain characteristics of a signal or an image. Similarly Inverse FFT (IFFT) is used to convert a frequency domain signal to its time domain. Thus FFT and IFFT are very important functions in the field of signal or image processing. FFT or IFFT can be realized in MATLAB tool easily by their direct functions. This functions does well in simulating any signal processing situations. But if anyone attempts to implement the FFT or IFFT function in hardware like FPGA, then direct functions hardly conveys any information. In case of hardware implementation, results after every stage of FFT block must be verified. Thus in this article, MATLAB Realization of FFT/IFFT w/o Direct Function is presented. The MATLAB code for realizing FFT/IFFT is shown below

clear all;
close all;

BsR = xlsread('F:\GPR_xilinx\Test Data\Bscan_real.xlsx');%%% BsR is a matrix of real values
BsI = xlsread('F:\GPR_xilinx\Test Data\Bscan_imag.xlsx');%%% BSI is a matrix of imaginary Values

a = BsR(:,1);
b = BsI(:,1);
N = 1024;
C = a + j*b;

X = C;
for j = 1:10
    for n = 1:2^(j-1)
        for i = 1:N/(2^j)
ps = X(2*(n-1)*N/(2^j)+i,:) + X((2*n-1)*N/(2^j)+i,:);
ng = X(2*(n-1)*N/(2^j)+i,:) - X((2*n-1)*N/(2^j)+i,:);
W = exp((-1i*2*pi*2^(j-1)*(i-1))/N);   %%% This is for FFT
X((2*(n-1))*N/(2^j)+i,:) = ps;
X((2*n-1)*N/(2^j)+i,:) = ng * W;
        end
    end
end
X1 = real(X);
Y = N*ifft(C);
Z = fft(C);   
(Visited 167 times, 1 visits today)

Leave a Comment

Your email address will not be published.