# 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

### how to understand the MIMO zero forcing as a bank of decorrelators?

1  Asked on October 24, 2021 by hao-xue

### Advantage of applying a Window Function in Analysis and Synthesis of STFT?

2  Asked on October 24, 2021 by micropyre

### processing gain in the receiver

2  Asked on October 24, 2021

### Question on N point DTFT – Fourier transform

2  Asked on October 24, 2021 by ruhi

### Lifting scheme versus filter banks

1  Asked on October 24, 2021

### Match an Equalizer Curve

1  Asked on October 24, 2021 by alex-lisi

### DDS generated chirp and antialiasing filter : what is the best suited filter for a chirp?

1  Asked on October 24, 2021 by atom_84

### Deconvolving a 1d Signal Using a Lookup Table of Kernels

3  Asked on October 24, 2021 by bla

### Having converted a grayscale image to binary using im2bw(), is the converse operation possible?

2  Asked on October 24, 2021 by lisa-chowdhury

### Why is my time domain interpolation via zero-padding in frequency domain wrong?

3  Asked on October 24, 2021

### Is white noise WSS by nature or not?

3  Asked on October 24, 2021

### If a square wave is a sum of odd harmonic impulses, why is it continuous in the frequency domain?

3  Asked on October 24, 2021

### tx and rx model supporting all data rates

1  Asked on October 24, 2021

### Determining a system’s causality using its impulse response

1  Asked on October 24, 2021

### Finding PHASE between two sinusoids with FFT/DFT (ArduinoFFT w/ C)

3  Asked on October 24, 2021

### Effect of time duration in bandpass filtering

0  Asked on October 24, 2021 by joe-kid

### Optimization of harmonics calculation

1  Asked on October 24, 2021

### Conventional channel coding/decoding

2  Asked on October 24, 2021 by fatima_ali

### Why does fft energy leakage was solved

1  Asked on October 24, 2021

### What is the pipeline DAC tollerable offset from plot

0  Asked on October 24, 2021

### Ask a Question

Get help from others!