cic滤波器,matlab里设计CIC滤波器该用哪个函数
本文目录索引
- 1,matlab里设计CIC滤波器该用哪个函数
- 2,CIC的滤波器
- 3,谁会用matlab设计一个CIC滤波器,要有完整的程序,谢谢了
- 4,下面是CIC滤波器频率响应图的M代码。求大神帮解释下,特别是那几个函数的运用搞清楚
- 5,CIC是什么意思
- 6,matlab怎么调用fdatool的滤波器
- 7,怎样设计数字梳状滤波器
1,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滤波器的节数,与第一个函数相比,这个函数没有规定采样滤波,通带宽度、阻带衰减等
2,CIC的滤波器
CIC cascade imtegrator comb,积分梳状滤波器CIC滤波器最初由Hogenauer提出,因为它结构简单,没有乘法器,只用加法器、积分器和寄存器,适合工作在高采样率。而且,CIC滤波器是一种基于令吉电相消的FIR滤波器,已经被证明是在高速抽取或插值系统中非常有效的单元。CIC滤波器包括两个基本部分:积分部分和梳状部分。单级CIC抽取滤波器如图1所示:单级CIC插值滤波器如图2所示:
3,谁会用matlab设计一个CIC滤波器,要有完整的程序,谢谢了
CIC抽取补偿滤波器设计,CIC滤波器采用5阶8倍抽取
如下:
%
%THIS IS A WIZARD GENERATED FILE. DO NOT EDIT THIS FILE!
%
%---------------------------------------------------------------------------------------------------------
%This is a filter withfixed coefficients
%This Model Only Support Single Channel Input Data.
%Please input:
%data vector: stimulation(1:n)
%
% This Model Only Support FIR_WIDTH to 51 Bits
%
%FILTER PARAMETER
%Input Data Type: Signed
%Input Data Width: 13
%FIR Width (Full Calculation Width Before Output Width Adjust) : 23
%-----------------------------------------------------------------------------------------------------------
%MegaWizard Scaled Coefficient Values
function output = CIC8_fir_comp_mlab_mat (stimulation, output)
coef_matrix=[0 0 1 0 -2 -3 0 7 10 1 -17 -26 -5 46 102 127 102 46 -5 -26 -17 1 10 7 0 -3 -2 0 1 0 0 ];
INTER_FACTOR = 1;
DECI_FACTOR = 1;
MSB_RM = 0;
MSB_TYPE = 0;
LSB_RM = 0;
LSB_TYPE = 0;
FIR_WIDTH = 23;
OUT_WIDTH = FIR_WIDTH - MSB_RM - LSB_RM ;
DATA_WIDTH = 13;
data_type= 1;
% check size of inputs.
[DX,DY] = size(stimulation);
[CX,CY] = size(coef_matrix);
if (CX ~= DY * INTER_FACTOR)
fprintf('WARNING : coef_matrix size and input data size is not match\n');
end
%fill coef_matrix to length of data with the latest coef set
if (CX < DY * INTER_FACTOR)
for i= CX +1:DY * INTER_FACTOR
coef_matrix(i,:) = coef_matrix(CX,:);
end
end
%check if input is integer
int_sti=round(stimulation);
T = (int_sti ~= stimulation);
if (max(T)~=0)
fprintf('WARNING : Integer Input Expected: Rounding Fractional Input to Nearest Integer...\n');
end
%Input overflow check
switch data_type
case 1
%set max/min for signed
maxdat = 2^(DATA_WIDTH-1)-1;
mindat = -maxdat-1;
case 2
%set max/min for unsigned
maxdat = 2^DATA_WIDTH-1;
mindat = 0;
end
if(data_type == 2)
if(abs(coef_matrix) == coef_matrix)
FIR_WIDTH = FIR_WIDTH +1;
end
end
%Saturating Input Value
a=find(int_sti>maxdat);
b=find(int_sti<mindat);
if (~isempty(a)|~isempty(b))
fprintf('WARNING : Input Amplitude Exceeds MAXIMUM/MINIMUM allowable values - saturating input values...\n');
lena = length (a);
lenb = length (b);
for i =1:lena
fprintf('%d > %d \n', int_sti(a(i)), maxdat);
int_sti(a(i)) = maxdat;
end
for i =1:lenb
fprintf('%d < %d \n', int_sti(b(i)), mindat);
int_sti(b(i)) = mindat;
end
end
% Add interpolation
inter_sti = zeros(1, INTER_FACTOR * length(int_sti));
inter_sti(1:INTER_FACTOR:INTER_FACTOR * length(int_sti)) = int_sti;
for i = 1 : DY *INTER_FACTOR
coef_current = coef_matrix(i,:);
output_temp(i) = simp_adaptive (inter_sti, coef_current, i);
end
% Truncate output
len1 = length(output_temp);
switch LSB_TYPE
case 0
%truncate
out_dec = bi_trunc_lsb(output_temp,LSB_RM,FIR_WIDTH);
case 1
%round
out_dec = bi_round(output_temp,LSB_RM, FIR_WIDTH);
end
switch MSB_TYPE
case 0
%truncate
out_dec = bi_trunc_msb(out_dec,MSB_RM,FIR_WIDTH-LSB_RM);
case 1
%round
out_dec = bi_satu(out_dec,MSB_RM, FIR_WIDTH-LSB_RM);
end
% choose decimation output in phase=DECI_FACTOR-1
if(DECI_FACTOR == 1)
output = out_dec;
else
output = out_dec(DECI_FACTOR:DECI_FACTOR:len1);
end
function[output, outindex] = simp_adaptive (int_sti, coef_current, data_index, output)
%Simulation is the whole input sequence
%coef_current is the current coefficient set
%data_index gives the last data to use
%outputs are the sum of input and coef multiplication
%outindex is the next data_index
sti_current = zeros(length(coef_current),1);
data_length = length(int_sti);
%Check data index
if (data_index > data_length)
fprintf('ERROR: DATA INDEX IS LARGER THAN DATA LENGTH!!!\n');
return;
end
for i = 1: length(coef_current)
if ((data_index -i+1)>0 & (data_index - i+1)<=data_length)
sti_current(i,1) = int_sti(data_index - i+1);
end
end
outindex= data_index+1;
output = coef_current * sti_current;
% end of function simp_adaptive
function output = bi_round(data_in,LSB_RM,ORI_WIDTH, output)
% LSB_RM is the bit to lose in LSB
% ORI_WIDTH is the original data width
data = round (data_in / 2^LSB_RM);
output = bi_satu(data,0,ORI_WIDTH - LSB_RM);
%end of function bi_trunc_lsb
function output = bi_trunc_lsb(data_in,LSB_RM,ORI_WIDTH, output)
% LSB_RM is the bit to lose in LSB
% ORI_WIDTH is the original data width
%2's complement system
output = bitshift(2^ORI_WIDTH*(data_in<0) + data_in, -LSB_RM) - 2^(ORI_WIDTH-LSB_RM) *(data_in<0);
% end of function bi_round
function output = bi_trunc_msb(data_in,MSB_RM,ORI_WIDTH, output)
% MSB_RM is the bit to lose in LSB
% ORI_WIDTH is the original data width
%2's complement system
data = 2^ORI_WIDTH * (data_in < 0)+ data_in;
erase_num = 2^(ORI_WIDTH - MSB_RM) - 1;
data = bitand(data, erase_num);
output = data - 2^(ORI_WIDTH - MSB_RM)*(bitget(data,ORI_WIDTH - MSB_RM));
%end of bi_trunc_msb
function output = bi_satu(data_in,MSB_RM,ORI_WIDTH, output)
% MSB_RM is the bit to lose in LSB
% ORI_WIDTH is the original data width
%2's complement system
maxdat = 2^(ORI_WIDTH - MSB_RM -1)-1;
mindat = 2^(ORI_WIDTH - MSB_RM -1)*(-1);
data_in(find(data_in > maxdat)) = maxdat;
data_in(find(data_in < mindat)) = mindat;
output = data_in;
%end of bi_satu
4,下面是CIC滤波器频率响应图的M代码。求大神帮解释下,特别是那几个函数的运用搞清楚
这段代码是级联积分梳状滤波器中梳状滤波器的部分。 [h1,f1]=freqz(ones(1,D),1,1000,fs)在matlab help中查freqz有详细解释及举例。该句用于分析长度为5的FIR滤波器的频率响应,返回值h1为频率响应,f1为频率轴,已经是以Hz为单位了(0~fs/2) 因此下句也就用错了 plot(f1/(fs/2),20*log10(abs(h1))-max(20*log10(abs(h1)))应改为 plot(f1,20*log10(abs(h1))-max(20*log10(abs(h1))) 此时画出的是幅频图,幅度进行了归一化,幅度单位是dB。
5,CIC是什么意思
CIC指的是中华联合保险集团股份有限公司。 中华保险是中华联合保险集团股份有限公司(CHINA UNITED INSURANCE GROUP COMPANY LIMITED)的简称,始建于1986年7月15日,前身是新疆生产建设兵团农牧业生产保险公司,是新中国之后我国成立的第二家国有控股保险公司。 发展: 2016年2月,辽宁成大股份有限公司、中国中车股份有限公司和富邦人寿保险股份有限公司入股,成为中华联合保险股份有限公司股东。 2017年,公司更名为“中华联合保险集团股份有限公司”。 2019年6月,中华保险与腾讯战略合作,携手推进数字化转型升级。 以上内容参考 百度百科—CIC
6,matlab怎么调用fdatool的滤波器
1、输入:被白噪声污染的正弦信号,fs=100khz,信号频率为10khz,噪声信号为20khz,现在要滤掉20khz的正弦信号。 2、现在用等波纹IFR滤波器,10khz通过 12khz截止。 3、使用file菜单---generate mfile,命名为mylowfilter。 4、figure(2);Hd = mylowfilter;output=filter(Hd,y);plot(output);title('滤波后的波形');
7,怎样设计数字梳状滤波器
)__编辑区(Editor\Debugger Window)编制各种M-文件,存盘(Save),运行(Run)等.
MATLAB中与数学相关的常用的工具箱
在命令区(Command Window)键入help命令,可查看工具箱;
matlab\elmat - Elementary matrices and matrix manipulation.
matlab\elfun - Elementary math functions.
matlab\specfun - Specialized math functions.
matlab\matfun - Matrix functions - numerical linear algebra.
matlab\datafun - Data analysis and Fourier transforms.
matlab\polyfun - Interpolation and polynomials.
matlab\funfun - Function functions and ODE solvers.
matlab\graph2d - Two dimensional graphs.
matlab\graph3d - Three dimensional graphs.
matlab\specgraph - Specialized graphs.
MATLAB中与数学相关的常用的工具箱
nnet\nnet - Neural Network Toolbox.
nnet\nndemos - Neural Network Demonstrations.
toolbox\optim - Optimization Toolbox.
toolbox\pde - Partial Differential Equation Toolbox.
toolbox\splines - Spline Toolbox.
toolbox\stats - Statistics Toolbox.
toolbox\symbolic - Symbolic Math Toolbox.
wavelet\wavelet - Wavelet Toolbox.
工具箱及命令查询 help topics
在命令区(Command Window)键入
help ops
help lang
help elfun
help fabs
help sqrt
MATLAB中基本代数运算符
运算 符号 举例
加法,a+b + 5+3
减法,a-b - 5-3
乘法,a×b * 5*3
除法,a÷b / or \ 48/4=4\48=12
乘幂,ab ^ 5^2=25
MATLAB中数组,矩阵基本运算符
运算 符号 举例
加法,a+b + [1 2]+[3 4] [1,2]+3
减法,a-b - [1 2]-[3 4] [1,2]-3
乘法,a*b * [1,2]*3 [1,2]'*[3,4]
a.*b .* [1,2].*[3,4]=[3,8]
逆乘,左乘 \ ax=b x=a\b=inv(a)*b
右乘 / xa=b x=b'/a=b'*inv(a)
乘幂,方阵的幂 ^ a^2=a*a
元素的幂 .^ a.^2 x.^3
变量及数组输入
MATLAB的变量及数组均是以向量或矩阵方式存储的
1:向量方式输入
x=[1,2,3,4,5] %以向量(数组)方式给x赋值
y=(x(3)+x(5))/2*x(4) %调用x中的元素
z=sqrt(x) %每个元素开方
t=x' %向量x的转置赋给t
u=x*t %向量的内积(u为向量x的模的平方)
变量及数组输入
2:矩阵方式输入
a=[1,2,3;4,5,6;7,8,0] %矩阵输入 (a为3阶方阵)
b=[366;804;351] %列矩阵输入
det(a) %方阵行列式
inv(a) %方阵的逆
x=a\b %ax=b方程组的解
y=inv(a)*b %与x相同
disp([a,b,x]) %显示矩阵
变量及数组输入
3:矩阵的简单运算
c=inv(a) %方阵的逆阵
y=c*b %矩阵乘积
d=[a b];disp([d]) %矩阵拼接
d=a'; disp([d]) %矩阵转置
g=2*a+3 %常数乘矩阵,各元素加3
p=eye(3) %3阶单位矩阵
y=a.*p %两矩阵对应元素乘积
zeros(3) %3阶零矩阵
变量及数组输入
4:数组的分点输入和步长输入
x=linspace(0,2*pi,30); %按分点赋值
y=50*sin(x);
plot(x,y); %画正弦曲线
plot(x,y, 'r*');
hold on
t=0:0.5:7
z=t.^2;
plot(t,z, 'bo'); %画y=x^2曲线
plot(t,z, 'r--');
MATLAB中关系和逻辑运算
关系运算符 逻辑运算符
> >= 0 | y==0).*y;
z=z+.5*(y0右极限
limit(fx,x,0, 'left') %求fx:x->0左极限
limit(fx,x,inf) %求fx:x->∞极限