Matlab调用函数实现CIC滤波器
matlab里设计cic滤波器的函数有以下两种:
1. fdesign.decimator
例如:设定好采样频率Fs, 信号带宽Fp, 阻带衰减As, 差分时延m及降采样比D就可以得到cic滤波器的传输函数
d1 =fdesign.decimator(D,'CIC',m,Fpass,As,Fs);
Hcic =design(d1);
2.mfilt.cicdecim (fixed-point CIC decimator, mfilt是matlab里专门用来设计多速率信号处理滤波器的一套函数)
hm =mfilt.cicdecim(decimation_factor,differential_delay,NumberofSections);
decimation_factor为降采样比,differential_delay同上为差分时延,NumberofSections为cic滤波器的节数,与第一个函数相比,这个函数没有规定采样滤波,通带宽度、阻带衰减等
在信号处理中,信号发射时,信号通过载波,调制,以电磁波的形式发射出来
在接收端,射频信号通过天线接收,超外差式等方式进行处理,变频到中频
然后通过数字技术对中频信号进行处理,此时的中频信号采样率很高,多达几十兆赫
而要解调出来的信号很小,此时就要经过滤波来得到我们需要的信号
如果直接设计滤波器,阶数会非常庞大,软件,硬件设备都承受不了
因此,一般常用的技术是进行下变频处理,其主要技术就是通过抽取滤波进行下变频
常用的滤波器就是CIC抽取, 希望可以帮助一些坛友解决基本的问题。
下面以一个实例,对一个采样频率为45.5MHz的信号进行14倍的抽取滤波,同时进行
补偿滤波器的设计,并给出CIC滤波器、补偿滤波器和级联后的频谱图
-
- % Design a minimum-order CIC compensator that compensates...
- % for the droop in the passband for the CIC decimator.
- Fs = 45.5e6; % Input sampling frequency
- Fpass = 0.5e6; % Frequency band of interest
- D = 14; % Decimation factor of CIC
- d1 = fdesign.decimator(D,'CIC',1,Fpass,65,Fs); %design a cic filter
- Hcic = design(d1);
- Hd(1) = cascade(dfilt.scalar(1/gain(Hcic)),Hcic);
- d2 = fdesign.ciccomp(Hcic.DifferentialDelay, ...
- Hcic.NumberOfSections,Fpass,1.625e6,.005,66,Fs/D); % design a cic compensator filter
- Hd(2) = design(d2);
- fcfwrite([Hcic Hd(2)],'CICdesciption','dec'); % 其中,生成的.fcf文件描述滤波器的结构
- hvt=fvtool(Hd(1),Hd(2),cascade(Hd(1),Hd(2)),'Fs',[Fs Fs/D Fs], ... % plot whole response
- 'ShowReference', 'off');
- legend(hvt, 'CIC','CIC compensator', 'Whole response','Location', 'Northeast');