📄 lowpass_p354.asv
字号:
%clear;close all;
wp=0.8*pi;%passband end
ws=0.88*pi;
%wc=(wp+ws)/2;
width=ws-wp;%width of the transition band
N=ceil(6.6*pi/width);
if (rem(N,2))==0
N=N+1;
end
Nw=N;%Legnth of the window
wc=(wp+ws)/2;%cutoff frequency of filter
n=0:N-1;
alpha=(N-1)/2;
m=n-alpha+0.00001;
hd=sin(wc*m)./(pi*m);
%compute time response of the hanning window
win=hanning(Nw);
%compute acture inpulse respinse of the filter
h=hd.*win';
b=h;
freqz(b,1,512);
fs=500;
t=(1:100)/fs;
%s1=sin(2*pi*t*200);
s2=sin(2*pi*t*150);
s3=sin(2*pi*t*20);
s=s2+s3;
plot(t,s);
xlabel('time(sec)');ylabel('time waveform');
sf=filter(b,1,s);
plot(t,sf);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -