学习笔记 CIC filter及其matlab实现

  • 格式:doc
  • 大小:436.00 KB
  • 文档页数:16
[2] Example of Cascaded Integrator Comb filter in Matlab/2007/07/01/example-of-cascaded-integrator-comb-filter-in-matlab/
[3]Digital Signal Processing – Principles, Algorithms and Applications, John G. Proakis, Dimitris G. Manolakis
Figure 2c: the classic form of 1st-order CIC filter, 忽略figure 2b中的1/D因子。
其中前馈部分称为comb section, 其differential delay 是D;反馈部分称为积分器。
差分方程:
Equation 6
Equation 7
学习笔记: CIC filter及其matlab实现
2010-04-19 14:55 8063人阅读评论(0)收藏举报
filtermatlabdelaybufferoutputinput
References:
[1] Understanding cascaded integrator-comb filters – By Richard Lyons, Courtesy ofEmbedded Systems ProgrammingURL:/articles/article10028.html
Recursive running-sum filter
Figure 2: D-point averaging filters
Figure 2a是标准的D-point moving-average 处理,需要D-1次加法运算和1次乘法运算。时域表达式:
Equation 1
z域表达式:
Equation 2
CIC滤波器不需要乘法运算,易于硬件实现。
抽取CIC滤波器只不过是滑动平均滤波器的一个非常高效的迭代实现,有NRtaps, 其输出再进行R抽取. 同样,插值CIC滤波器在每两个输入采样之间插入R-1个0,然后通过一个NR-tap的工作在输出采样率ƒs,out的滑动平均滤波器。对于高采样率转换率的抽取和插值来说,Figure 1所示的级联形式的计算量大大低于单一FIR滤波器的计算量。
ylabel(’Amplitude’)
title(’frequency response of Moving average filter’)
Figure 1c的matlab实现
% Implementing Cascaded Integrator Comb filter with the
% comb section following the integrator stage
N = 10;
delayBuffer = zeros(1,N);
intOut = 0;
xn = sin(2*pi*[0:.1:10]);
for ii = 1:length(xn)
% comb section
combOut = xn(ii) – delayBuffer(end);
delayBuffer(2:end) = delayBuffer(1:end-1);
Figure 7a 是一个任意的基带频谱和它的由于8倍插值而产生的在ƒs,in整数倍上的频谱复制。
Figure 7b是滤波器的输出频谱,反映了不完美的滤波引入的不需要的频谱镜像。
在CIC滤波器后连接一个传统的lowpass tapped-delay-line FIR滤波器,如果这个滤波器的阻带包含第一个频谱镜像,那么可以很好的滤除这些频谱镜像。
CIC数字滤波器是窄带低通滤波器的高计算效率的实现形式,常常被嵌入到现代通信系统的抽取和插值模块的硬件实现中。
CIC filter 应用
CIC滤波器非常适合用作抽取之前的抗混迭滤波和插值之后的抗镜像滤波。这两种应用都跟very high-data-rate滤波有关,例如现代无线系统中硬件正交调制和解调,以及delta-sigma A/D 和 D/A 转换器。
例子:figure 1a的matlab实现,滑动平均滤波器,忽略scale factor
% Moving Average filter
N = 10; %延时
xn = sin(2*pi*[0:.1:10]); %n=[0:1:100]; sin(2*pi*f*t)=sin(2*pi*f*T*n)=>f=1Hz, fs=10Hz.
hn = ones(1,N); %脉冲响应
y1n = conv(xn,hn);
% transfer function of Moving Average filter
hF = fft(hn,1024);
plot([-512:511]/1024, abs(fftshift(hF)));
xlabel(’Normalized frequency’)
intOut = 0;
xn = sin(2*pi*[0:.1:10]);
for ii = 1:length(xn)
% integrator
intOut = intOut + xn(ii);
% comb section
combOut = intOut – delayBuffer(end);
delayBuffer(2:end) = delayBuffer(1:end-1);
z域传递函数:
Equation 3
Figure 2b: 迭代running-sum filter,等价于fin-1) + … + x(n-D+1)]
y(n-1) = 1/D * [x(n-1) + x(n-2) + x(n-D+1) + x(n-D)]
delayBuffer(1) = xn(ii);
% integrator
intOut = intOut + combOut;
y2n(ii) = intOut;
end
err12 = y1n(1:length(xn)) – y2n;
err12dB = 10*log10(err12*err12′/length(err12)) % identical outputs
虽然在单位圆上有极点,但是CIC滤波器的系数都是1,滤波器系数没有量化误差,因此CIC滤波器并不存在通常滤波器因在单位圆上有极点而导致的风 险。虽然有递归,但是CIC滤波器是稳定的,线性相位的,有有限长度的脉冲响应。在0Hz处(DC),CIC滤波器增益等于comb滤波器delay D.
CIC滤波器在抽取和插值中的应用
Figure 3: Single-stage CIC filter time-domain responses whenD= 5
Figure 2c这个1阶CIC滤波器看做是2部分的级联。Figure 3a是comb stage的脉冲响应,figure 3b是积分器的脉冲响应,figure 3c是整个系统的脉冲响应。系统的脉冲响应是一个矩形序列,等价于moving-average filter和recursive running-sum filter的单位脉冲响应,仅仅相差一个常数的scale factor。
close all
先integrator后comb的实现
% Implementing Cascaded Integrator Comb filter with the
% integrator section following the comb stage
N = 10;
delayBuffer = zeros(1,N);
y(n) – y(n-1) = 1/D * [x(n) – x(n-D)]
Equation 4
z域传递函数:
Equation 5
Equation 3 和 Equation 5 本质是一样的。Equation 3 是非递归表达式,equation 5是递归表达式。不考虑delay length D的话,递归形式只需要一个加法和一个减法运算。
delayBuffer(1) = intOut;
y3n(ii) = combOut;
end
err13 = y1n(1:length(xn)) – y3n;
err13dB = 10*log10(err13*err13′/length(err13)) % identical outputs
CIC filter structures
Figure 5: Single-stage CIC filters used in decimation and interpolation
大多数的CIC滤波器的rate change R等于comb的差分延时D.
Figure 6: Magnitude response of a 1st-order,D= 8, decimating CIC filter: before decimation; aliasiing afterR= 8 decimation
ƒs,out= ƒs,in/R
The spectral band, of widthB, centered at 0Hz is the desired passband of the filter.
A key aspect of CIC filters is the spectral folding that takes place due to decimation.
Figure 6a 中用阴影表示了将要被混迭且影响目标频带的频谱。
Figure 6b 是对混迭后(下采样后)目标频带的频谱混迭情况。
Figure 7: 1st-order,D=R= 8, interpolating CIC filter spectra: input spectrum; output spectral images