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

📄 fir digital filter(with chebyshev algorithm).m

📁 Fir滤波器
💻 M
字号:
clear all;
rp=0.25;% Passband ripple
rs=50;  %Stopband ripple
Fs=200; % Sampling frequency
wp1=0.2;%normalized passband frequency
ws1=0.3;%normalized stopband frequency
wp=Fs/2*wp1;%passband frequency
ws=Fs/2*ws1;%stopband frequency
f=[wp ws]; % Cutoff frequencies
a = [1 0]; % Desired amplitudes
% Compute deviations
dev = [(10^(rp/20)-1)/(10^(rp/20)+1)  10^(-rs/20)]; 
[n,fo,ao,W] = firpmord(f,a,dev,Fs);
hn=remez(n+2,fo,ao,W);
hw=fft(hn,512);
w=[0:511]*2/512;
figure(1)%Fig.h(n)
stem(hn),title('h(n)');
figure(2)%Amplitude frequency characteristic 
plot(w,20*log10(abs(hw)),'r');grid on;
axis([0,1,-90,10]);
xlabel('normalized frequency');ylabel('magnitude/dB');
figure(3)%effect of filter
f1=15;f2=40;
dt=1/Fs;t=0:dt:3;
x=sin(2*pi*f1*t)+cos(2*pi*f2*t);
y=fftfilt(hn,x);
subplot(2,1,1),plot(t,x),title('input signal');
subplot(2,1,2),plot(t,y),title('output signal');






⌨️ 快捷键说明

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