Skip to content

hnkr/DSP-FFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Fourier Transform - Radix-2

  • Complex FFT
  • Radix-2 Decimation in Time algorithm

Requirements

  • Ubuntu OS
  • gcc

Build & Run

  • Build:
    • gcc fft_radix2.c main.c -o fft_radix2 -lm
  • Run:
    • ./fft_radix2

Working Principle

  • It uses hardcoded sample_buf as the input / source to the FFT calculation.By default, all the imaginary part of samples are zero which is also called as real-fft.
  • You only need to change the values of "buf" in main.c and the value of "SAMPLE_BUF_SIZE" in fft_radix2.h to update sample count.
  • It does not do padding automatically so you should pay attention to send an input source whose length is power-of-two.

When it starts running, firstly it writes the input source / samples and the results after calculation completed.
******************************** FFT Calculation, radix-2 DIT ********************************

Input - Samples:

0:10.000000 0.000000i
1:20.000000 0.000000i
2:30.000000 0.000000i
3:40.000000 0.000000i
4:50.000000 0.000000i
5:60.000000 0.000000i
6:70.000000 0.000000i
7:80.000000 0.000000i
8:90.000000 0.000000i
9:100.000000 0.000000i
10:110.000000 0.000000i
11:120.000000 0.000000i
12:130.000000 0.000000i
13:140.000000 0.000000i
14:150.000000 0.000000i
15:160.000000 0.000000i

FFT Results:

0:1360.000000 0.000000i
1:-80.000000 402.187159i
2:-80.000000 193.137085i
3:-80.000000 119.728461i
4:-80.000000 80.000000i
5:-80.000000 53.454291i
6:-80.000000 33.137085i
7:-80.000000 15.912989i
8:-80.000000 0.000000i
9:-80.000000 -15.912989i
10:-80.000000 -33.137085i
11:-80.000000 -53.454291i
12:-80.000000 -80.000000i
13:-80.000000 -119.728461i
14:-80.000000 -193.137085i
15:-80.000000 -402.187159i