Optimize FFT test input generation

This commit is contained in:
2026-07-05 19:48:16 +08:00
parent 7e72bd455a
commit d13f7933d8
3 changed files with 89 additions and 16 deletions

View File

@@ -5,6 +5,7 @@
#include <common_func.h>
#include <confreg_time.h>
#include <fft.h>
#include "../fft_test_data.h"
// BSP板级支持包所需全局变量
unsigned long UART_BASE = 0xbf000000;
@@ -80,12 +81,7 @@ int main(int argc, char** argv)
float sw_in_im[FFT_POINT_NUM];
for (int i = 0; i < FFT_POINT_NUM; i++) {
float dc_part = 4000.0f;
float f10_part = 8000.0f * cos(2 * PI * 10.0 * i / FFT_POINT_NUM);
float f200_part = 6000.0f * sin(2 * PI * 200.0 * i / FFT_POINT_NUM);
float f400_part = 3000.0f * sin(2 * PI * 400.0 * i / FFT_POINT_NUM);
sw_in_re[i] = dc_part + f10_part + f200_part + f400_part;
sw_in_re[i] = (float)fft_test_sample((unsigned int)i);
sw_in_im[i] = 0.0f;
}
@@ -153,4 +149,4 @@ int main(int argc, char** argv)
}
return 0;
}
}