?? f_getas.m
字號(hào):
function [As,f] = f_getAs (b,a,fs,eps)
%_GETAS: Estimate stopband attenuation in dB of a lowpass filter
%
% Usage: [As,f] = f_getAs (b,a,fs,eps)
%
% Inputs:
% b = 1 by m+1 array containing the numerator coefficients
% a = 1 by n+1 array containing the denominator coefficients
% fs = sampling frequency
% eps = threshold used for determining the first zero in dB
% Outputs:
% As = the stopband attenuation in dB:
%
% As = -20log10(delta_s)
%
% f = frequency at which maximum stopband attenuation
% occurs
%
% Notes: This function only works with a lowpass filter with zeros
% on the unit circle.
% Initialize
N = 1000;
% Compute magnitude response
[H,f] = f_freqz(b,a,N,fs);
A = 20*log10(abs(H));
% Estimate As
k = 0;
for i = 1 : N
if A(i) < -eps
k = i;
break
end
end
if k > 0
[ripple,kmax] = max(A(k:N));
As = -ripple;
f = (k+kmax-1)*(fs/2)/N;
else
As = 0;
f = 0;
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -