当前位置:网站首页>radix-4 FFT principle and C language code implementation
radix-4 FFT principle and C language code implementation
2022-08-11 07:14:00 【KPer_Yang】
Table of Contents
References:
"Digital Signal Processing" edited by Deng Xiaoling, Xu Meixuan, etc.
1. Extract by frequency
2. Extract by time:
3. C code implementation
//radix-4 FFT decimation by frequency/********************************************************************* @brief radix-4 FFT decimated by frequency* @param x: A double-type one-dimensional array of length n, which starts to store the real part of the data to be transformed, and finally stores the real part of the transformation result* @param y: a double-type one-dimensional array of length n, which starts to store the imaginary part of the data to be transformed, and finally stores the imaginary part of the transformation result* @param n: n=4^m, m is a positive integer* @note Note that a radix-4 FFT requires n to be a power of 4.Compared with radix-2, the multiplication amount of radix-4 is reduced by 25%, and the addition amount is slightly reduced;* @Sample usage: call directly****************************************************************/void radix_4_FFT(x, y, n){int n;double x[], y[];int i, j, k, m, i1, i2, i3, n1, n2;double a, b, c, e, r1, r2, r3, r4, s1, s2, s3, s4;double co1, co2, co3, si1, si2, si3;for(j = 1, i=1; i < 10; ++i){m = i;j = 4*j;if(j == n) break;}n2 = n;for(k = 1; k <= m; ++k){n1 = n2;n2 = n2 / 4;e = 6.28318530718/n1;a = 0;for(j = 0; j < n2; ++j){b = a + a;c = a + b;co1 = cos(a);co2 = cos(b);co3 = cos(c);si1 = sin(a);si2 = sin(b);si3 = sin(c);a = (j + 1) * e;for(i = j; i < n; i = i + n1){i1 = i + n2;i2 = i1 + n2;i3 = i2 + n2;r1 = x[i] + x[i2];r3 = x[i] - x[i2];s1 = y[i] + y[i2];s3 = y[i] - y[i2];r2 = x[i1] + x[i3];r4 = x[i1] - x[i3];s2 = y[i1] + y[i3];s4 = y[i1] - y[i3];x[i] = r1 - r2;r2 = r1 - r2;r1 = r3 - s4;r3 = r3 + s4;y[i] = s1 + s2;s2 = s2 - s2;s1 = s3 + r4;s3 = s3 - r4;x[i1] = co1 * r3 + si1 * s3;y[i1] = col * s3 - si1 * r3;x[i2] = co2 * r3 + si2 * s3;y[i2] = co2 * s3 - si2 * r3;x[i3] = co3 * r3 + si3 * s3;y[i3] = co3 * s3 - si3 * r3;}}}n1 = n - 1;for(j = 0; i = 0; i < n1; ++i){if(i < j){r1 = x[j];s1 = y[j];x[j] = x[i];y[j] = y[i];x[i] = r1;y[i] = s1;}k = n / 4;while(3 * k < (j + 1)){j = j - 3*k;k = k / 4;}j = j + k;}}
边栏推荐
猜你喜欢
矩阵分析——Jordan标准形
每日sql-统计各个专业人数(包括专业人数为0的)
HCIP-Spanning Tree (802.1D, Standard Spanning Tree/802.1W: RSTP Rapid Spanning Tree/802.1S: MST Multiple Spanning Tree)
淘宝API接口参考
TOP2 Add two numbers
1688商品详情接口
已解决EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
八股文之redis
mmdetection的安装和训练、测试didi数据集的步骤(含结果)
The ramdisk practice 1: the root file system integrated into the kernel
随机推荐
Find the shops that have sold more than 1,000 yuan per day for more than 30 consecutive days in the past six months
Especially the redis
MySQL之CRUD
HCIP BGP built adjacent experiment
OA项目之待开会议&历史会议&所有会议
一种用于EEG超扫描研究的分析流程
Redis + lua implements distributed interface current limiting implementation scheme
Xshell如何连接虚拟机
《Show and Tell: A Neural Image Caption Generator》论文解读
iptables nat
华为防火墙-6
arcgis填坑_3
损失函数——交叉熵
Top20括号匹配
损失函数——负对数似然
每日sql--统计员工近三个月的总薪水(不包括最新一个月)
华为防火墙-1-安全区域
图文带你理解什么是Few-shot Learning
已解决EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
sql--7天内(含当天)购买次数超过3次(含),且近7天的购买金额超过1000的用户