1 ## Copyright (C) 1995-2012 Friedrich Leisch
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} autocor (@var{x}, @var{h})
21 ## Return the autocorrelations from lag 0 to @var{h} of vector @var{x}.
22 ## If @var{h} is omitted, all autocorrelations are computed.
23 ## If @var{x} is a matrix, the autocorrelations of each column are
25 ## The particular algorithm used is from the field of statistics and
26 ## differs from the definition used in signal processing.
29 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at>
30 ## Description: Compute autocorrelations
32 ## Deprecated in version 3.4
34 function retval = autocor (X, h)
36 persistent warned = false;
39 warning ("Octave:deprecated-function",
40 "autocor is obsolete and will be removed from a future version of Octave; See the Octave-Forge signal package and the function xcor for a replacement");
47 retval = autocov (X, h);
52 if (min (retval (1,:)) != 0)
53 retval = retval ./ (ones (rows (retval), 1) * retval(1,:));