1 ## Copyright (C) 1994 Dept of Probability Theory and Statistics TU Wien <Andreas.Weingessel@ci.tuwien.ac.at>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
16 ## usage: cceps (x [, correct])
18 ## Returns the complex cepstrum of the vector x.
19 ## If the optional argument correct has the value 1, a correction
20 ## method is applied. The default is not to do this.
22 ## Author: Andreas Weingessel <Andreas.Weingessel@ci.tuwien.ac.at>
24 ## Last modifified by AW on Nov 8, 1994
26 function cep = cceps (x, c)
40 error ("cceps: x must be a vector");
44 bad_signal_message = ["cceps: bad signal x, ", ...
45 "some Fourier coefficients are zero."];
48 if (min (abs (F)) == 0)
49 error (bad_signal_message);
52 # determine if correction necessary
56 cor = (c && (real (F (half + 1)) < 0));
59 if (min (abs (F)) == 0)
60 error (bad_signal_message);
65 cep = fftshift (ifft (log (F)));
71 # make cepstrum of same length as input vector