SignalProcessing
RealCepstrum
compute the real cepstrum of the signal
Calling Sequence
Parameters
Description
Examples
Compatibility
RealCepstrum(A)
A
-
Array of real numeric values; the signal
The RealCepstrum(A) command computes the real logarithm of the magnitude of the Fourier transform of a sequence.
A must be a one-dimensional Array and must contain real numbers only.
with⁡SignalProcessing:
We will artificially pollute a signal with an echo. The Cepstrum command will then be used to identify the location of the echo.
Fs≔100:
tStart≔0:
tEnd≔15:
tEcho≔4.5:
N≔tEnd−tStart⁢Fs+1:
Define a clean, unpolluted signal:
t≔Vector⁡seq⁡i,i=tStart..tEnd,1.0Fs:
cleanSignal≔`~``/`⁡`~`sin⁡2⁢π⋅1.3⁢t,` $`,`~``+`⁡t,` $`,10+`~``/`⁡`~`cos⁡2⁢π⋅2.4⁢t,` $`,`~``+`⁡t,` $`,10:
cleanSignalPlot≔plot⁡t,cleanSignal,legend=Clean Signal
The echo is the original signal, delayed by tEcho.
echoSignal≔Vector⁡`$`⁡0,floor⁡Fs⁢tEcho+1,cleanSignal1..N−floor⁡Fs⁢tEcho+1:
The dirty signal is the clean signal plus the echo multiplied by a small factor:
dirtySignal≔cleanSignal+0.3⁢echoSignal:
dirtySignalPlot≔plot⁡t,dirtySignal,color=blue,legend=Signal with Echo
r≔RealCepstrum⁡dirtySignal:
plot⁡t,r,view=tStart..tEnd,−1.5..1
The peak in the cepstrum plot shows the location of the echo. Find the sample at which the echo occurs.
threshold≔map⁡x↦piecewise⁡x<0.2,0,1,r:
ind≔ArrayTools:-SearchArray⁡threshold,5:
The echo starts at sample 452 and a time of t[452]
t452
4.510000000
Now use this information to generate an IIR filter to remove the echo.
filteredSignal≔SignalProcessing:-Filter⁡dirtySignal,Array⁡1,`$`⁡0,450,0.35,Array⁡1:
filteredSignalPlot≔plot⁡t,filteredSignal,color=black,legend=Filtered Signal
plots:-display⁡dirtySignalPlot,filteredSignalPlot
plots:-display⁡cleanSignalPlot,filteredSignalPlot
The SignalProcessing[RealCepstrum] command was introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
See Also
SignalProcessing[ComplexCepstrum]
Download Help Document