?? lowpass_p354.m
字號(hào):
%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*230);
s=s2+s3;
plot(t,s);
xlabel('time(sec)');ylabel('time waveform');
sf=filter(b,1,s);
plot(t,sf);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -