This file is indexed.

/usr/share/octave/packages/signal-1.3.0/aryule.m is in octave-signal 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## Copyright (C) 1999 Paul Kienzle <pkienzle@users.sf.net>
## Copyright (C) 2006 Peter Lanspeary
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Function File} {@var{a} =} aryule (@var{x}, @var{p})
## @deftypefnx {Function File} {[@var{a}, @var{v}, @var{k}] =} aryule (@var{x}, @var{p})
## Fit an AR (@var{p})-model with Yule-Walker estimates.
## @table @var
## @item x
## data vector to estimate
## @item a
## AR coefficients
## @item v
## variance of white noise
## @item k
## reflection coeffients for use in lattice filter
## @end table
##
## The power spectrum of the resulting filter can be plotted with
## pyulear(x, p), or you can plot it directly with ar_psd(a,v,...).
##
## See also:
## pyulear, power, freqz, impz -- for observing characteristics of the model
## arburg -- for alternative spectral estimators
##
## Example: Use example from arburg, but substitute aryule for arburg.
##
## Note: Orphanidis '85 claims lattice filters are more tolerant of
## truncation errors, which is why you might want to use them.  However,
## lacking a lattice filter processor, I haven't tested that the lattice
## filter coefficients are reasonable.
## @end deftypefn

function [a, v, k] = aryule (x, p)

  if ( nargin~=2 )
    print_usage;
  elseif ( ~isvector(x) || length(x)<3 )
    error( 'aryule: arg 1 (x) must be vector of length >2' );
  elseif ( ~isscalar(p) || fix(p)~=p || p > length(x)-2 )
    error( 'aryule: arg 2 (p) must be an integer >0 and <length(x)-1' );
  endif

  c = xcorr(x, p+1, 'biased');
  c(1:p+1) = [];     # remove negative autocorrelation lags
  c(1) = real(c(1)); # levinson/toeplitz requires exactly c(1)==conj(c(1))
  if nargout <= 1
    a = levinson(c, p);
  elseif nargout == 2
    [a, v] = levinson(c, p);
  else
    [a, v, k] = levinson(c, p);
  endif

endfunction

%!demo
%! % use demo('pyulear')