# Ask for CIC filter MATLAB code or SIMULINK setting

1. ## cic filter

Can one show me CIC filter(cascade of integrator comb filter) MATLAB code?
I want to design a Sinc^2 comb filter followed by sigma-delta ADC.
It is 1-bit input , 16-bit output decimation filter.
How can I bulit and setting a CIC SIMULINK model?
pls help me, thank you! •

2. ## ask simulink

Hi Kuohsi,

I want to design a Sinc^2 comb filter followed by sigma-delta ADC.
You mean, you want to design a SD ADC followed by a Decimation filter, right ? The other way around doesn't make any sense...

Can one show me CIC filter(cascade of integrator comb filter) MATLAB code?
Do u have the Filter Design and Fixed-Point Toolbox ? If so, try this function mfilt.cicdecim or use the Filter Design & Analysis Tool -Fdatool-

Otherwise code the transfer function of your CIC Filter in Matlab e.g. like this

K = 2; % Sinc/Comb-Filter 2nd-order
D1 = 8; % Decimationfactor
f1 = [0:5e6]; % Frequencyvector
fs1 = 40e6; % Sampling Frequency
w1 = 2*pi*f1/fs1;
x0 = [((sin(w1*D1/2))./(D1*sin(w1/2))).^K];

figure(1)
plot(f1,20*log10(abs(x0)));
grid on;
title('Magnitude Response of 2nd order CIC in dB');
xlabel('Frequency in Hz');
ylabel('Decibels');
set(gcf, 'Color', 'White'); •

3. ## cic filter matlab Originally Posted by adamsr
Hi Kuohsi,

I want to design a Sinc^2 comb filter followed by sigma-delta ADC.
You mean, you want to design a SD ADC followed by a Decimation filter, right ? The other way around doesn't make any sense...

Can one show me CIC filter(cascade of integrator comb filter) MATLAB code?
Do u have the Filter Design and Fixed-Point Toolbox ? If so, try this function mfilt.cicdecim or use the Filter Design & Analysis Tool -Fdatool-

Otherwise code the transfer function of your CIC Filter in Matlab e.g. like this

K = 2; % Sinc/Comb-Filter 2nd-order
D1 = 8; % Decimationfactor
f1 = [0:5e6]; % Frequencyvector
fs1 = 40e6; % Sampling Frequency
w1 = 2*pi*f1/fs1;
x0 = [((sin(w1*D1/2))./(D1*sin(w1/2))).^K];

figure(1)
plot(f1,20*log10(abs(x0)));
grid on;
title('Magnitude Response of 2nd order CIC in dB');
xlabel('Frequency in Hz');
ylabel('Decibels');
set(gcf, 'Color', 'White');
Thanks for your reply!
And then I will design a CIC decimator that 1-bit input and 16-bit output.
How can I start to design it?
How can I calculate the SNR at the 16-bit output?
How can I bulit and setting a CIC SIMULINK model?

Thank you very much!!:D --[[ ]]--