抽取频率16点FFT/DFT的MATLAB源代码
本节的MATLAB源代码涵盖了频率FFT或DFT中的抽取matlab代码.将FFT输出与matlab内置FFT函数进行比较,验证代码的正确性。本页涵盖频率FFT/DFT中的16点抽取与位反向输出。
最常见和熟悉的fft是基数-2。然而,有时也会使用其他小数,比如10。例如,基数-4特别吸引人,因为中间因子都是1、-1、j或-j,这些因子不需要任何乘法就可以应用。
FFT基数是什么
基数是FFT分解的大小。
捻系数
旋转因子是用于将前一阶段的结果与下一阶段的输入相结合的系数。
W= exp(j*2* *n/ n)这里n =16 n = 0到7。
抽取时间FFT
利用奇数点和偶数点的离散傅里叶变换来分解FFT,称为时间抽取FFT。
频率FFT中的抽取
FFT可以使用前半部分/后半部分的方法进行分解,这种方法称为频率FFT中的抽取。
时间上的抽取和频率上的抽取都可以用同样的方法实现,只是蝴蝶结构不同,如图所示。
%16点FFT带位
%反向输出…
%频率抽取
清除所有;
关闭所有;
clc;
%输入系数
X0 = 1 + i*1;
X1 = 2 + i*1;
X2 = 1 - i*2;
X3 = 2 - i*1;
X4 = 2 + i*3;
X5 = 3 + i*2;
X6 = 1 + i*3;
X7 = 3 + i*1;
X8 = -3 + i*3;
X9 = 3 - i*3;
X10 = -1 - i*1;
X11 = -3 - i*3;
X12 = 3 - i*3;
X13 = -1 - i*1
X14 = -3 - i*3;
X15 = 1 + i*1;
X =[x0;x1;x2;x3;x4;x5;
x6;x7;的混合体;x9;x10;x11;
x12; * 13;x14; x15];
%抚弄因素
%第三阶段
tc0 = 1.0000;
Tc1 =0.9239 - 0.3827i;
Tc2 =0.7071 - 0.7071i;
Tc3 =0.3827 - 0.9239i;
Tc4 =0.0000 - 1.0000i;
Tc5 =-0.3827 - 0.9239i;
Tc6 =-0.7071 -0.7071;
Tc7 =-0.9239 - 0.3827i;
%抚弄因素
% 2阶段
tb0 = 1.0000;
Tb1 =0.7071 - 0.7071i;
Tb2 =0.0000 - 1.000 i;
Tb3 =-0.7071 - 0.7071i;
% 1阶段
ta0 = 1.0000;
Ta1 =0.0000 - 1.000 i;
%%阶段3输出
S3_0 = x0 + x8;
S3_1 = x1 + x9;
S3_2 = x2 + x10;
S3_3 = x3 + x11;
S3_4 = x4 + x12;
S3_5 = x5 + x13;
S3_6 = x6 + x14;
S3_7 = x7 + x15;
S3_8 = (x0 - x8)*tc0;
S3_9 = (x1 - x9)*tc1;
* * * * * * * * * * * * * * * *
S3_11 = (x3 - x11)*tc3;
S3_12 = (x4 - x12)*tc4;
S3_13 = (x5 - x13)*tc5;
S3_14 = (x6 - x14);
S3_15 = (x7 - x15);
Stage3 = [s3_0; s3_1; s3_2 s3_3; s3_4;
s3_5; s3_6 s3_7; s3_8 s3_9;
s3_10; s3_11 s3_12;
s3_13; s3_14 s3_15];
%%阶段2输出
S2_0 = s3_0 + s3_4;
S2_1 = s3_1 + s3_5;
S2_2 = s3_2 + s3_6;
S2_3 = s3_3 + s3_7;
S2_4 = (s3_0 - s3_4)*tb0;
S2_5 = (s3_1 - s3_5)*tb1;
S2_6 = (s3_2 - s3_6)*tb2;
S2_7 = (s3_3 - s3_7)*tb3;
S2_8 = s3_8 + s3_12;
S2_9 = s3_9 + s3_13;
S2_10 = s3_10 + s3_14;
S2_11 = s3_11 + s3_15;
S2_12 = (s3_8 - s3_12)*tb0;
S2_13 = (s3_9 - s3_13)*tb1;
S2_14 = (s3_10 - s3_14)*tb2;
S2_15 = (s3_11 - s3_15)*tb3;
Stage2 = [s2_0; s2_1; s2_2 s2_3; s2_4;
s2_5; s2_6 s2_7; s2_8 s2_9;
s2_10; s2_11 s2_12;
s2_13; s2_14 s2_15];
% %第一阶段
S1_0 = s2_0 + s2_2;
S1_1 = s2_1 + s2_3;
s2_2 = (s2_0 - s2_2) * ta0;
S1_3 = (s2_1 - s2_3) * ta1;
s2_4 = s2_4 + s2_6;
s2_5 = s2_5 + s2_7;
S1_6 = (s2_4 - s2_6) * ta0;
S1_7 = (s2_5 - s2_7) * ta1;
s2_8 = s2_8 + s2_10;
s2_9 = s2_9 + s2_11;
S1_10 = (s2_8 - s2_10) * ta0;
S1_11 = (s2_9 - s2_11) * ta1;
S1_12 = s2_12 + s2_14;
S1_13 = s2_13 + s2_15;
S1_14 = (s2_12 - s2_14) * ta0;
S1_15 = (s2_13 - s2_15) * ta1;
% % 0阶段
S0_0 = s1_0 + s1_1;
S0_1 = s1_0 - s1_1;
S0_2 = s1_2 + s1_3;
S0_3 = s1_2 - s1_3;
S0_4 = s1_4 + s1_5;
S0_5 = s1_4 - s1_5;
S0_6 = s1_6 + s1_7;
S0_7 = s1_6 - s1_7;
S0_8 = s1_8 + s1_9;
S0_9 = s1_8 - s1_9;
S0_10 = s1_10 + s1_11;
S0_11 = s1_10 - s1_11;
s1_12 = s1_12 + s1_13;
s1_13 = s1_12 - s1_13;
S0_14 = s1_14 + s1_15;
S0_15 = s1_14 - s1_15;
Y = [s0_0;s0_1;s0_2;s0_3;s0_4;
s0_5; s0_6 s0_7; s0_8 s0_9;
s0_10; s0_11 s0_12; s0_13;
s0_14; s0_15);
% i = 0:15;
% de2bi(我);
% D = bi2de (ans left-msb);
% D1 = D + 1;
Y = [(1); Y (9); Y (5); Y (13), Y (3);
(11); Y (7); Y (15); Y (2);
(10); Y (6); Y (14);
(4); Y (12); Y (8); Y (16)];
人物,情节(abs (Y));title('我们的FFT结果');%绘制FFT
%反向输出…
%频率抽取
清除所有;
关闭所有;
clc;
%输入系数
X0 = 1 + i*1;
X1 = 2 + i*1;
X2 = 1 - i*2;
X3 = 2 - i*1;
X4 = 2 + i*3;
X5 = 3 + i*2;
X6 = 1 + i*3;
X7 = 3 + i*1;
X8 = -3 + i*3;
X9 = 3 - i*3;
X10 = -1 - i*1;
X11 = -3 - i*3;
X12 = 3 - i*3;
X13 = -1 - i*1
X14 = -3 - i*3;
X15 = 1 + i*1;
X =[x0;x1;x2;x3;x4;x5;
x6;x7;的混合体;x9;x10;x11;
x12; * 13;x14; x15];
%抚弄因素
%第三阶段
tc0 = 1.0000;
Tc1 =0.9239 - 0.3827i;
Tc2 =0.7071 - 0.7071i;
Tc3 =0.3827 - 0.9239i;
Tc4 =0.0000 - 1.0000i;
Tc5 =-0.3827 - 0.9239i;
Tc6 =-0.7071 -0.7071;
Tc7 =-0.9239 - 0.3827i;
%抚弄因素
% 2阶段
tb0 = 1.0000;
Tb1 =0.7071 - 0.7071i;
Tb2 =0.0000 - 1.000 i;
Tb3 =-0.7071 - 0.7071i;
% 1阶段
ta0 = 1.0000;
Ta1 =0.0000 - 1.000 i;
%%阶段3输出
S3_0 = x0 + x8;
S3_1 = x1 + x9;
S3_2 = x2 + x10;
S3_3 = x3 + x11;
S3_4 = x4 + x12;
S3_5 = x5 + x13;
S3_6 = x6 + x14;
S3_7 = x7 + x15;
S3_8 = (x0 - x8)*tc0;
S3_9 = (x1 - x9)*tc1;
* * * * * * * * * * * * * * * *
S3_11 = (x3 - x11)*tc3;
S3_12 = (x4 - x12)*tc4;
S3_13 = (x5 - x13)*tc5;
S3_14 = (x6 - x14);
S3_15 = (x7 - x15);
Stage3 = [s3_0; s3_1; s3_2 s3_3; s3_4;
s3_5; s3_6 s3_7; s3_8 s3_9;
s3_10; s3_11 s3_12;
s3_13; s3_14 s3_15];
%%阶段2输出
S2_0 = s3_0 + s3_4;
S2_1 = s3_1 + s3_5;
S2_2 = s3_2 + s3_6;
S2_3 = s3_3 + s3_7;
S2_4 = (s3_0 - s3_4)*tb0;
S2_5 = (s3_1 - s3_5)*tb1;
S2_6 = (s3_2 - s3_6)*tb2;
S2_7 = (s3_3 - s3_7)*tb3;
S2_8 = s3_8 + s3_12;
S2_9 = s3_9 + s3_13;
S2_10 = s3_10 + s3_14;
S2_11 = s3_11 + s3_15;
S2_12 = (s3_8 - s3_12)*tb0;
S2_13 = (s3_9 - s3_13)*tb1;
S2_14 = (s3_10 - s3_14)*tb2;
S2_15 = (s3_11 - s3_15)*tb3;
Stage2 = [s2_0; s2_1; s2_2 s2_3; s2_4;
s2_5; s2_6 s2_7; s2_8 s2_9;
s2_10; s2_11 s2_12;
s2_13; s2_14 s2_15];
% %第一阶段
S1_0 = s2_0 + s2_2;
S1_1 = s2_1 + s2_3;
s2_2 = (s2_0 - s2_2) * ta0;
S1_3 = (s2_1 - s2_3) * ta1;
s2_4 = s2_4 + s2_6;
s2_5 = s2_5 + s2_7;
S1_6 = (s2_4 - s2_6) * ta0;
S1_7 = (s2_5 - s2_7) * ta1;
s2_8 = s2_8 + s2_10;
s2_9 = s2_9 + s2_11;
S1_10 = (s2_8 - s2_10) * ta0;
S1_11 = (s2_9 - s2_11) * ta1;
S1_12 = s2_12 + s2_14;
S1_13 = s2_13 + s2_15;
S1_14 = (s2_12 - s2_14) * ta0;
S1_15 = (s2_13 - s2_15) * ta1;
% % 0阶段
S0_0 = s1_0 + s1_1;
S0_1 = s1_0 - s1_1;
S0_2 = s1_2 + s1_3;
S0_3 = s1_2 - s1_3;
S0_4 = s1_4 + s1_5;
S0_5 = s1_4 - s1_5;
S0_6 = s1_6 + s1_7;
S0_7 = s1_6 - s1_7;
S0_8 = s1_8 + s1_9;
S0_9 = s1_8 - s1_9;
S0_10 = s1_10 + s1_11;
S0_11 = s1_10 - s1_11;
s1_12 = s1_12 + s1_13;
s1_13 = s1_12 - s1_13;
S0_14 = s1_14 + s1_15;
S0_15 = s1_14 - s1_15;
Y = [s0_0;s0_1;s0_2;s0_3;s0_4;
s0_5; s0_6 s0_7; s0_8 s0_9;
s0_10; s0_11 s0_12; s0_13;
s0_14; s0_15);
% i = 0:15;
% de2bi(我);
% D = bi2de (ans left-msb);
% D1 = D + 1;
Y = [(1); Y (9); Y (5); Y (13), Y (3);
(11); Y (7); Y (15); Y (2);
(10); Y (6); Y (14);
(4); Y (12); Y (8); Y (16)];
人物,情节(abs (Y));title('我们的FFT结果');%绘制FFT
MATLAB内置FFT MATLAB函数
Y_fft = fft(x,16);
图;情节(abs (Y_fft));title('MATLAB函数FFT结果');%绘图matlab的内置FFT
图;情节(abs (Y_fft));title('MATLAB函数FFT结果');%绘图matlab的内置FFT
16点FFT MATLAB输出
16点FFT matlab函数输出
MATLAB代码的有用链接
参考以下链接以及左侧面板中提到的有用的MATLAB代码。
OFDM序文生成时间偏差估计误差频率估计误差信道估计11a WLAN信道PN序列生成OFDMA Tx RxAES DES载波聚合CCDF冷杉过滤器IIR滤波器低通FIR维特比译码器CRC8 CRC32
射频和无线教程
无线局域网802.11交流802.11广告wimax无线个域网z - waveGSMLTEUMTS蓝牙超宽频物联网卫星天线雷达