# 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:

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

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:

## Related Questions

### cascade realisation from direct realisation

0  Asked on October 24, 2021 by rohitm

### How to estimate the modulation transfer function of images?

1  Asked on October 24, 2021

### Any Ideas for Extracting the lines on a Football Pitch?

0  Asked on October 24, 2021 by jonah-f

### Output of marginally stable systems

2  Asked on October 24, 2021

### Converting a lowpass filter to a highpass filter. FIR filter-type 1

1  Asked on March 10, 2021 by bl-lov

### What are the practical constraints on designing Sensing matrix in compressed Sensing?

2  Asked on March 7, 2021 by digi1

### High pass filter not attenuating signal at start of input

1  Asked on February 24, 2021 by ankit-chudasama

### 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

### Response time of residual current device and sampling times

0  Asked on February 23, 2021 by blue_electronx

### What is the difference between a range image and a depth map?

1  Asked on February 21, 2021 by uxkqez7

### Weird ringing at signal start and end for default Matlab lowpass filter

1  Asked on February 19, 2021 by anand-kulkarni

1  Asked on February 12, 2021 by jumbot

### Most efficient way to find single dominant frequency (without amplitude) in analog signal

0  Asked on February 11, 2021 by tobalt

### Blind Estimation of Signal Parameter and Noise Variance

1  Asked on February 10, 2021 by dsp-guy-sam

### Finding the system output by convolution

1  Asked on February 10, 2021 by jisbon

### Estimating a Filter’s Envelope

0  Asked on February 8, 2021

### Audio Activity Detection and Classification

1  Asked on February 7, 2021

### How can i identify number of return of the ping in the sonar?

0  Asked on February 6, 2021 by jay-patel

### Difference between Analog IQ sampling and creating IQ digitally

1  Asked on February 5, 2021 by malik12