📄 fft8_wd.m
字号:
clear;
clc;
close all;
%DFT滤波器组
%参数:旁瓣——13dB 主瓣3dB点——0.086*pi 滤波器点数:8
%窗函数:类型——chebwin 旁瓣——52dB 主瓣3dB点——0.17*pi 窗长:8 使用wintool导出窗函数
cheb_win=[0.087935871008358;0.338634123578981;0.711220803060457;1;1;0.711220803060457;0.338634123578981;0.087935871008358;];
%窗函数:类型——hammingwin 旁瓣——34dB 主瓣3dB点——0.17*pi 窗长:8
hamming_win=[0.08;0.253194691144983;0.642359629619905;0.954445679235113;0.954445679235113;0.642359629619905;0.253194691144983;0.08;];
fiter_f=cheb_win*ones(1,8).*dftmtx(8);
fiter_r=abs(real(fiter_f));
fiter_i=abs(imag(fiter_f));
fiter_m=max(max(max(fiter_r)),max(max(fiter_i)));
fiter_f=round(fiter_f/fiter_m*(2^15-1));
fvtool(fiter_f(:,1),1,fiter_f(:,2),1,fiter_f(:,3),1,fiter_f(:,4),1,fiter_f(:,5),1,fiter_f(:,6),1,fiter_f(:,7),1,fiter_f(:,8),1);
N_point=256;
inval=2*pi/N_point;
f_point= linspace(0,2*pi-inval,256);
nomiga=(0:15)'*ones(1,256)*diag(f_point);
f_points=exp(j*nomiga);
f_r=abs(real(f_points));
f_i=abs(imag(f_points));
f_m=max(max(max(f_r)),max(max(f_i)));
f_points=round(f_points/f_m*(2^15-1));
f_points=conj(f_points');
% f_r=abs(real(f_points));
% f_i=abs(imag(f_points));
f_points1=f_points(:,1:8);
f_points2=f_points(:,9:16);
outiq1=f_points1*fiter_f;
outiq2=f_points2*fiter_f;
y1=abs(outiq1);
y2=abs(outiq2);
y_max1=round(max(max(y1)));
y_max2=round(max(max(y2)));
y_max=round(max(y_max1,y_max2));
y_bin=dec2base(y_max,2)
y_bin_size=size(y_bin)
y1=y1/y_max;
y2=y2/y_max;
y1=20*log10(y1+eps);
y2=20*log10(y2+eps);
plot(f_point/pi,y1, 'DisplayName', 'y');
hold on
plot(f_point/pi,y2, 'DisplayName', 'y');
axis([0,2,-100,2])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -