AnswerBun.com

Matlab CIC decimator output mirrored

Signal Processing Asked by Edson Manoel on August 7, 2020

I am trying to use the dsp.CICDecimatior function and comparing the output to a C code algorithm that I have. The CIC decimator is configured as decimation factor of 8 , 3 sections and differential delay equals 1.
below is the code used:

CIC1 = dsp.CICDecimator(8,1,3);
k=0;
step1_sig=zeros(1,128);
for i=1:16
    step1_sig(1,i)=CIC1(real(normalRx(1+k:8+k)'));
    k=k+8;
end
step1_sig'

The output looks mirrored as you can see in the figure below:

enter image description here

I am confident that the C code output is correct, because I have compared it to the following C++ :
https://github.com/EsonJohn/CIC-filter

Both produced the same output, so the issue have to be in my Matlab code.
In the traditional CIC decimator algorithm, the delay unit in the integrator is used in the feedback path, but in the MATLAB block it uses the unit delay in the feedforward path of the integrators:
https://www.mathworks.com/help/dsp/ref/dsp.cicdecimator-system-object.html#d120e192907

enter image description here

Although the filter will be equivalent (same frequency response), the numerical output of the two implementations are a different (I guess it is the mirrored look that I mentioned above).

As it seems that the reason to the problem might be the way the CIC filter is implemented in MATLAB with the unit delay in the feedforward path of the integrator, the question now becomes:
Is there a way of using the dsp.CICDecimator with the unit delay on the FEEDBACK path of the integrator?

It should be like this:

enter image description here

Add your own answers!

Related Questions

Why do I have a high peak at the beginning of my FFT (not DC)?

1  Asked on February 24, 2021 by gabriel-galeote-checa

 

Adding attenuations in dB

1  Asked on February 12, 2021 by jumbot

   

Estimating a Filter’s Envelope

0  Asked on February 8, 2021

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir