⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hant.m

📁 四种窗函数设计FIR数字滤波器matlab源码(hant,hamming,blackman,kaiser)
💻 M
字号:
format short e;
wp=2*pi*3000;
wa=2*pi*5000;
ws=2*pi*20000;
alpha=0.5;
Bt=wa-wp;
wc=0.5*(wa+wp);
Nmin=ceil((4*ws)/Bt);
disp('Nmin='),disp(Nmin);
N=input('N=');
n=[0:1:N-1];
m=n+eps;
T=2*pi/ws;
hd=sin(wc*m*T)./(pi*m);
n=[0:1:(N-1)/2];
m=n+eps;
wn=alpha+(1-alpha)*cos((2*pi*m)./(N-1));
Wn=[wn zeros(1,N-length(wn))];
hn=hd.*Wn;
L=length(wn);
hn_r=zeros(1,L);
for l=1:1:L;
    hn_r(l)=hn(1,l);
end
hn_fliplr=fliplr(hn_r);
if floor(N/2)==(N-1)/2; %N is odd;
    hn_l=zeros(1,L-1);
    for k=1:1:L-1;
        hn_l(k)=hn_fliplr(1,k);
        hn=[hn_l hn_r];
    end
else hn=[hn_fliplr, hn_r];
end
n=[-(N-1)/2:1:(N-1)/2];
m=n+eps;
wn=alpha+(1-alpha)*cos((2*pi*m)./(N-1));
n=0:1:N-1;
subplot(2,1,1),stem(n,wn);
xlabel('n');ylabel('W_H(n)');
grid on;
n=0:1:N-1;
subplot(2,1,2),stem(n,hn);
xlabel('n'); ylabel('h(n)');
grid on


      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -