cheby2_3db_hp.m

来自「编写一个函数」· M 代码 · 共 28 行

M
28
字号
function [b,a] = cheby2_3db_hp(N,wc,ws)
% N is the order
% wc is the 3dB cutoff frequency of the highpass filter we need
% ws is the stopband-edge frequency of the highpass fiter we need
% wclp is the 3dB cutoff frequency of the original lowpass filter 
% wslp is the stopband-edge frequency of the original lowpass filter 

% choose any walue of wclp
wclp=0.2

alfa=-(cos((wclp+wc)*pi/2))/(cos((wclp-wc)*pi/2));
wslp=angle(-(exp(-j*ws*pi)+alfa)/(1+alfa*exp(-j*ws*pi)))/pi;

% find the anolog 3dB cutoff frequency
OmegaC = tan(pi*wclp/2); 
OmegaS = tan(pi*wslp/2); 

% find out the walue of Ast
est=cosh(N*acosh(OmegaS/OmegaC));
Ast=10*log10(1+est^2);

% use classic method to design filter
[b,a] = cheby2(N,Ast,ws,'high')
fvtool(b,a);



⌨️ 快捷键说明

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