📄 attn.m
字号:
function y =attn (ty,n,w,esq)
% ATTN Attenuation (in dB) of classical LP Filters.
%
% Y = ATTN(TY,N,W,E2) attenuation of classical LOWPASS prototypes.
% TY = 'bw','c1', and 'c2' (Butterworth, Chebyshev I, Chebyshev II)
% N = order
% W = array of normalized frequencies
% E2 = epsilon squared (eps^2) (default: 1).
% Y = attenuation in dB. Y is the same size as W
%
% ATTN (with no input arguments) invokes the following example:
% % Compute the attenuation of a 5th order Chebyshev filter
% % with eps^2=0.5 at the frequencies W = 1,1.5,2,2.5,3.
% >>y = attn('c1',5,[1:.5:3],0.5)
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin == 0,
help attn
disp('strike a key to see results of above example')
pause
y = attn('c1',5,[1:.5:3],0.5)
return
end
if nargin < 4, esq = 1; end
if ty == 'bw',
y = 10*log10(1+esq*(w.^(2*n)));
elseif ty=='c1',
y = 10*log10(1+esq*(chebyfun(n,w)).^2);
elseif ty == 'c2',
y = 10*log10(1+(1)./(esq*(chebyfun(n,(1)./w)).^2));
else
error('Unidentified filter type')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -