[C#] Fourier transform (FFT, DFT) Program

//[C#] Fourier transform (FFT, DFT) Program

[C#] Fourier transform (FFT, DFT) Program

Using MS Excel’s Macro function allows an automatic transformation of Fast Fourier Transform(FFT) and Discrete Fourier Transform (DFT) of individual data, however, users may find it difficult to use sometimes, as it takes much of data when using MS Excel, therefore, I would like to show how to make a program using a library (*.dll) for Fourier Transform part with C#.

2020-01-26_22h18_33

Run program can be downloaded by clicking right link FourierTransform.zip. <- Click
All the source code is released in the below GitHub link.
https://github.com/ImagingSolution/FourierCSharp

Please see below on how to use this program.

 

Program running

By unzipping the above .zip file, you will find the files named as below. Then, double click FourierTransform.exe to run the program.

  • FourierTransform.exe
  • FourierCSharp.dll
  • sampledata

 

Data format that allows Fourier Transform

Data is composed of 1 data per row in .CSV file format.

Sample 01)

1
1.30939551
1.59096344
1.820538079
1.980767038
2.06331351
2.069803727
2.01139008
1.906994542
1.780482109
1.65716389
1.560123288
1.506883103
1.506883103
1.560123288

In case there include real and imaginary numbers in the input data, it becomes real number part and imaginary number part per row.

Sample 02)

50, 0
0, -25
0, 0
0, -12.5
0, 0
0, 0

Please refer to the sample data saved as .CSV file format inside sampldata folder of the .zip file.

 

Data Acquisition

Clicking File → LoadData and designating .CSV file allows data acquisition and shows the result of Fourier Transform (magnitude of each frequency after Fourier Transform).
Fourier Transform runs FFT (in case the number of data is 2 to the n) and DFT (all other cases).

 

Transform to DFT or IDFT

In menu, clicking Fourier direction → Forward or Backward allows to transform to DFT or IDFT.

DFT and IDFT are calculated as below formula.

DFT formula

IDFT formula

 

 

 

 

 

Window function

Clicking one of the following Window→ Hamming, Hanning, Blackman allows you to apply each window function.
Please note that once you apply window function, you are not able to retrieve the original data.
Therefore, if you need the original data, please recall the data again.

before window function

after window function

 

 

 

 

 

 

 

 

[Caution]

All programs disclosed here can be used freely, however, please be careful to use them, as we are not held responsible for the problems caused by the program bugs.

2020-04-20T16:38:13+00:00