傅里叶变换是一种数学方法,用于将时间域信号转换为频率域信号。在 C 语言中,可以使用复数数组和快速傅里叶变换(FFT)算法来实现傅里叶变换。
下面是一个 C 语言实现的 FFT 算法的示例代码:
#include <complex.h>
#include <math.h>
#define PI 3.14159265358979323846
void fft(complex double *x, int n)
{
if (n == 1)
return;
complex double wn = cexp(-2 * PI * I / n);