remezex2.m

来自「这是几种滤波器的MATLAB的M文件源码」· M 代码 · 共 20 行

M
20
字号
%
%	Program name - REMEZ1.m
%
N=44
Fs=50000;								%	Sampling frequency										%	Filter length
Ap=1;										%	Pass band ripple in dB
As=45;									%	Stop band attenuation in dB
M=[0 0 1 1 0 0];						%	Desired magnitude response
F=[0, 0.4, 0.48, 0.64, 0.72 1] ;				%	Band edge frequencies
dp=(10^(Ap/20)-1)/(10^(Ap/20)+1);
ds=10^(-As/20);
W=[dp/ds, 1, dp/ds];
dev=[ds ds dp dp ds ds ];
[b delta] = remez(N-1, F, M, W);%	Compute the filter coefficients
[H, f] = freqz(b, 1, 1024, Fs);	%	Compute the frequency response
mag = 20*log10(abs(H));				% 	of filter and plot it
plot(f, mag), grid on
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')

⌨️ 快捷键说明

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