This project provides a lightweight C++ implementation of the Fast Fourier Transform (FFT) along with Fourier-based signal reconstruction tools. It allows users to:
- Compute Fourier coefficients from real-valued input data
- Filter frequency components by thresholding
- Reconstruct a signal using a Fourier Series
- Generate interpolated output samples for graphing or analysis
The implementation is fully self-contained, written from scratch, and designed for learning, experimentation, and portfolio demonstration.
- Fast Fourier Transform (FFT) implementation
- Fourier coefficient filtering for noise reduction
- Fourier-series interpolation and reconstruction
- Clean, easy-to-use C++ API
- Works with
std::vector<double>input data - Produces smooth interpolated output for graphing
std::vector<double> data;
LoadData(data);FFT fft;fft.CalculateFFT(data);fft.FilterCoefficients(0); // 0 = no filteringHigher values remove more frequency components.
int num_of_points = data.size();
double delta = 0.5;
double start_point = 0;
double end_point = data.size();
std::vector<double> interpolated_data =
fft.GraphFourierSeries(num_of_points, delta, start_point, end_point);num_of_points - Number of reconstructed sample points to generate
delta - Spacing between the generated x-values
start_point - First x-value of the interpolation interval
end_point - Last x-value of the interpolation interval
return value - Vector of interpolated y-values
double x = 0;
for (auto& elm : interpolated_data)
{
std::cout << "x = " << x << ", y = " << elm << std::endl;
x += delta;
}This project includes a Makefile for compiling all source files and creating the final executable.
To build the program, simply run:
makeThis will:
- Compile
main.cpp,Complex.cpp, andFFT.cpp - Produce object files:
main.o,Complex.o,FFT.o - Link them into an executable named program
all: main.o Complex.o FFT.o
g++ -g main.o Complex.o FFT.o -o program
main.o: main.cpp
g++ -g -c main.cpp
Complex.o: Complex.cpp
g++ -g -c Complex.cpp
FFT.o: FFT.cpp
g++ -g -c FFT.cpp
clean:
rm -f *.o programClean the build with:
make cleanRun the executable with:
./programFFT-Signal-Processing/
README.md
FFT.h
FFT.cpp
Complex.cpp
main.cpp
This project is useful for:
- Learning FFT and Fourier Series reconstruction
- Demonstrating mathematical and algorithmic skills
- Filtering or smoothing discrete signals
- Experimenting with frequency-domain manipulation
It is dependency-free and easy to integrate into other applications.
This project is released under the MIT License, allowing free use, modification, and distribution.
Copyright (c) 2025 Jerome Richards
Created by Jerome Richards
LinkedIn: https://www.linkedin.com/in/jerome-richards343
GitHub: https://github.com/Mathmatician