M = 2;  % Differential delays in the filter.
N = 1;  % Filter sections
R = 1;   % Decimation factor

Pnum = 100;

DeltaPulse = double(zeros(Pnum,1)); 
DeltaPulse(1) = 1;    % Create a 160-point impulse signal

intBlock1 = int32(zeros(Pnum,1));
intBlock2 = int32(zeros(Pnum,1));
intBlock3 = int32(zeros(Pnum,1));
intBlock4 = int32(zeros(Pnum,1));
intBlock5 = int32(zeros(Pnum,1));

for i = 1:N
    if i==1
        intBlock1(i) = intBlock1(i)+DeltaPulse(i);
        intBlock2(i) = intBlock2(i)+intBlock1(i);
        intBlock3(i) = intBlock3(i)+intBlock2(i);
        intBlock4(i) = intBlock4(i)+intBlock3(i);
        intBlock5(i) = intBlock5(i)+intBlock4(i);
    else
        intBlock1(i) = intBlock1(i-1)+DeltaPulse(i);
        intBlock2(i) = intBlock2(i-1)+intBlock1(i);
        intBlock3(i) = intBlock3(i-1)+intBlock2(i);
        intBlock4(i) = intBlock4(i-1)+intBlock3(i);
        intBlock5(i) = intBlock5(i-1)+intBlock4(i);
    end
end

figure('name','In Data Time', 'Numbertitle', 'off')
subplot(5,1,1)
plot(intBlock1)
subplot(5,1,2)
plot(intBlock2)
subplot(5,1,3)
plot(intBlock3)
subplot(5,1,4)
plot(intBlock4)
subplot(5,1,5)
plot(intBlock5)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% figure('name','In Data Time', 'Numbertitle', 'off')
% subplot(2,1,1)
% plot(DeltaPulse)
% grid on;
% grid minor;
% title('Delta Pulse')
% xlabel('Time')
% ylabel('Amp')
% 
% subplot(2,1,2)
% plot(intBlock1)
% grid on;
% grid minor;
% title('Int Block Out')
% xlabel('Time')
% ylabel('Amp')  