help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'rceps' and DC-free input signal


From: Sergei Steshenko
Subject: 'rceps' and DC-free input signal
Date: Sat, 2 Jul 2011 12:39:53 -0700 (PDT)

Hello,

I'm looking into source of 'rceps' (signal-1.0.8/rceps.m) file:

     33 function [y, ym] = rceps(x)
     34   if (nargin != 1)
     35     usage("y = rceps(x)");
     36   end
     37   y = real(ifft(log(abs(fft(x)))));
     38   if nargout == 2
     39     n=length(x);
     40     if rows(x)==1
     41       if rem(n,2)==1
     42         ym = [y(1), 2*y(2:n/2), zeros(1,n/2-1)];
     43       else
     44         ym = [y(1), 2*y(2:n/2), y(n/2+1), zeros(1,n/2-1)];
     45       endif
     46     else
     47       if rem(n,2)==1
     48         ym = [y(1,:); 2*y(2:n/2,:); zeros(n/2-1,columns(y))];
     49       else
     50         ym = [y(1,:); 2*y(2:n/2,:); y(n/2+1,:); 
zeros(n/2-1,columns(y))];
     51       endif
     52     endif
     53     ym = real(ifft(exp(fft(ym))));
     54   endif
     55 endfunction

and I'm having doubts regarding

     37   y = real(ifft(log(abs(fft(x)))));
line.

The point is that the 'x' signal can be DC-free, in such a case fft(x)(1),
i.e. the DC component of 'x' spectrum, will be zero, so abs(fft(x))(1)
will be zero as well, and feeding 0 into 'log' function doesn't look like
a good idea to me.

Any clarifications ?

Thanks,
 Sergei.

P.S. Essentially, any spectral component can be zero. In fact, if input
signal is a pure sine function whose frequency exactly equals frequency
of an FFT bin, all the spectral components but one will be zero.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]