%% Inverse Complex Cepstrum of Echo
% Generate a sine of frequency 45 Hz, sampled at 100 Hz. Add an echo with half the amplitude and 0.2 s later. Compute the complex cepstrum of the signal.

Fs = 100;
t = 0:1/Fs:1.27;

s1 = sin(2*pi*45*t);		
s2 = s1 + 0.5*[zeros(1,20) s1(1:108)];

c = cceps(s2);

%
% Compute the inverse complex cepstrum. Plot the echo data and its inverse complex cepstrum.

x = icceps(c);
plot(t,s2,t,x,'r--')
xlabel('Time (s)')
legend('Echo signal','Inverse complex cepstrum')

% Copyright 2019 The MathWorks, Inc.