function fcoefs=MakeERBFilters(fs,numChannels,lowFreq,width)
% function [fcoefs]=MakeERBFilters(fs,numChannels,lowFreq)
% This function computes the filter coefficients for a bank of
% Gammatone filters. These filters were defined by Patterson and
% Holdworth for simulating the cochlea.
%
% The result is returned as an array of filter coefficients. Each row
% of the filter arrays contains the coefficients for four second order
% filters. The transfer function for these four filters share the same
% denominator (poles) but have different numerators (zeros). All of these
% coefficients are assembled into one vector that the ERBFilterBank
% can take apart to implement the filter.
%
% The filter bank contains "numChannels" channels that extend from
% half the sampling rate (fs) to "lowFreq". Alternatively, if the numChannels
% input argument is a vector, then the values of this vector are taken to
% be the center frequency of each desired filter. (The lowFreq argument is
% ignored in this case.)
% Note this implementation fixes a problem in the original code by
% computing four separate second order filters. This avoids a big
% problem with round off errors in cases of very small cfs (100Hz) and
% large sample rates (44kHz). The problem is caused by roundoff error
% when a number of poles are combined, all very close to the unit
% circle. Small errors in the eigth order coefficient, are multiplied
% when the eigth root is taken to give the pole location. These small
% errors lead to poles outside the unit circle and instability. Thanks
% to Julius Smith for leading me to the proper explanation.
% Execute the following code to evaluate the frequency
% response of a 10 channel filterbank.
% fcoefs = MakeERBFilters(16000,10,100);
% y = ERBFilterBank([1 zeros(1,511)], fcoefs);
% resp = 20*log10(abs(fft(y')));
% freqScale = (0:511)/512*16000;
% semilogx(freqScale(1:255),resp(1:255,:));
% axis([100 16000 -60 0])
% xlabel('Frequency (Hz)'); ylabel('Filter Response (dB)');
% Rewritten by Malcolm Slaney@Interval. June 11, 1998.
% (c) 1998 Interval Research Corporation
if nargin < 4; width = 1.0; end % Scaling of bandwidths by dpwe
T = 1/fs;
if length(numChannels) == 1
cf = ERBSpace(lowFreq, fs/2, numChannels);
else
cf = numChannels(1:end);
if size(cf,2) > size(cf,1)
cf = cf';
end
end
% Change the followFreqing three parameters if you wish to use a different
% ERB scale. Must change in ERBSpace too.
EarQ = 9.26449; % Glasberg and Moore Parameters
minBW = 24.7;
order = 1;
ERB = ((cf/EarQ).^order + minBW^order).^(1/order);
B=1.019*2*pi*ERB*width;
A0 = T;
A2 = 0;
B0 = 1;
B1 = -2*cos(2*cf*pi*T)./exp(B*T);
B2 = exp(-2*B*T);
A11 = -(2*T*cos(2*cf*pi*T)./exp(B*T) + 2*sqrt(3+2^1.5)*T*sin(2*cf*pi*T)./ ...
exp(B*T))/2;
A12 = -(2*T*cos(2*cf*pi*T)./exp(B*T) - 2*sqrt(3+2^1.5)*T*sin(2*cf*pi*T)./ ...
exp(B*T))/2;
A13 = -(2*T*cos(2*cf*pi*T)./exp(B*T) + 2*sqrt(3-2^1.5)*T*sin(2*cf*pi*T)./ ...
exp(B*T))/2;
A14 = -(2*T*cos(2*cf*pi*T)./exp(B*T) - 2*sqrt(3-2^1.5)*T*sin(2*cf*pi*T)./ ...
exp(B*T))/2;
gain = abs((-2*exp(4*i*cf*pi*T)*T + ...
2*exp(-(B*T) + 2*i*cf*pi*T).*T.* ...
(cos(2*cf*pi*T) - sqrt(3 - 2^(3/2))* ...
sin(2*cf*pi*T))) .* ...
(-2*exp(4*i*cf*pi*T)*T + ...
2*exp(-(B*T) + 2*i*cf*pi*T).*T.* ...
(cos(2*cf*pi*T) + sqrt(3 - 2^(3/2)) * ...
sin(2*cf*pi*T))).* ...
(-2*exp(4*i*cf*pi*T)*T + ...
2*exp(-(B*T) + 2*i*cf*pi*T).*T.* ...
(cos(2*cf*pi*T) - ...
sqrt(3 + 2^(3/2))*sin(2*cf*pi*T))) .* ...
(-2*exp(4*i*cf*pi*T)*T + 2*exp(-(B*T) + 2*i*cf*pi*T).*T.* ...
(cos(2*cf*pi*T) + sqrt(3 + 2^(3/2))*sin(2*cf*pi*T))) ./ ...
(-2 ./ exp(2*B*T) - 2*exp(4*i*cf*pi*T) + ...
2*(1 + exp(4*i*cf*pi*T))./exp(B*T)).^4);
allfilts = ones(length(cf),1);
fcoefs = [A0*allfilts A11 A12 A13 A14 A2*allfilts B0*allfilts B1 B2 gain];
if (0) % Test Code
A0 = fcoefs(:,1);
A11 = fcoefs(:,2);
A12 = fcoefs(:,3);
A13 = fcoefs(:,4);
A14 = fcoefs(:,5);
A2 = fcoefs(:,6);
B0 = fcoefs(:,7);
B1 = fcoefs(:,8);
B2 = fcoefs(:,9);
gain= fcoefs(:,10);
chan=1;
x = [1 zeros(1, 511)];
y1=filter([A0(chan)/gain(chan) A11(chan)/gain(chan) ...
A2(chan)/gain(chan)],[B0(chan) B1(chan) B2(chan)], x);
y2=filter([A0(chan) A12(chan) A2(chan)], ...
[B0(chan) B1(chan) B2(chan)], y1);
y3=filter([A0(chan) A13(chan) A2(chan)], ...
[B0(chan) B1(chan) B2(chan)], y2);
y4=filter([A0(chan) A14(chan) A2(chan)], ...
[B0(chan) B1(chan) B2(chan)], y3);
semilogx((0:(length(x)-1))*(fs/length(x)),20*log10(abs(fft(y4))));
end
没有合适的资源?快使用搜索试试~ 我知道了~
基于gammatone滤波器实现信号去噪研究附matlab代码.zip
共14个文件
m:8个
png:3个
jpg:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 2 下载量 194 浏览量
2022-10-28
21:21:07
上传
评论
收藏 332KB ZIP 举报
温馨提示
1.版本:matlab2019a,不会运行可私信 2.领域:【信号去噪】 3.内容:基于gammatone滤波器实现信号去噪研究附matlab代码.zip 4.适合人群:本科,硕士等教研学习使用
资源推荐
资源详情
资源评论
收起资源包目录
【信号去噪】基于gammatone滤波器实现信号去噪研究附matlab代码.zip (14个子文件)
demo_scramble.png 7KB
demo_scramble.m 3KB
MakeERBFilters.m 5KB
demo_scramble_01.png 66KB
frame.m 653B
ola.m 2KB
index.html 13KB
localperm.m 750B
ERBFilterBank.m 2KB
speech.wav 91KB
shufflewins.m 809B
ERBSpace.m 1KB
2.png 174KB
scramble.jpg 15KB
共 14 条
- 1
资源评论
- guangcheng12342023-02-05资源内容详尽,对我有使用价值,谢谢资源主的分享。
- 2301_773078222024-03-07怎么能有这么好的资源!只能用感激涕零来形容TAT...
天天Matlab科研工作室
- 粉丝: 2w+
- 资源: 7253
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功