Mercurial > hg > octave-nkf
annotate scripts/signal/yulewalker.m @ 17796:6b51f5f44aea
find symbols in proper scope when debugging (bug #40397)
* lex.h (lexical_feedback::symbol_table_context::init_scope):
Delete member variable and all uses.
(lexical_feedback::symbol_table_context::pop): Assert that the context
is not empty before popping.
(lexical_feedback::symbol_table_context::push): Use default argument.
(lexical_feedback::symbol_table_context::curr_scope): If empty, return
symbol_table::current_scope, not the initial scope in effect when the
object is created.
* oct-parse.in.yy (octave_base_parser::make_anon_fcn_handle,
octave_base_parser::recover_from_parsing_function):
Don't check for empty lexer.symtab_context here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 29 Oct 2013 16:29:46 -0400 |
parents | d63878346099 |
children | 4197fc428c7d |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17338
diff
changeset
|
1 ## Copyright (C) 1995-2013 Friedrich Leisch |
3426 | 2 ## |
3922 | 3 ## This file is part of Octave. |
4 ## | |
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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
3426 | 9 ## |
3922 | 10 ## Octave is distributed in the hope that it will be useful, but |
3191 | 11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
3426 | 13 ## General Public License for more details. |
14 ## | |
3191 | 15 ## You should have received a copy of the GNU General Public License |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
3191 | 18 |
3449 | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {[@var{a}, @var{v}] =} yulewalker (@var{c}) | |
21 ## Fit an AR (p)-model with Yule-Walker estimates given a vector @var{c} | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
7125
diff
changeset
|
22 ## of autocovariances @code{[gamma_0, @dots{}, gamma_p]}. |
3426 | 23 ## |
3449 | 24 ## Returns the AR coefficients, @var{a}, and the variance of white |
25 ## noise, @var{v}. | |
26 ## @end deftypefn | |
3426 | 27 |
3457 | 28 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> |
29 ## Description: Fit AR model by Yule-Walker method | |
3426 | 30 |
3191 | 31 function [a, v] = yulewalker (c) |
3426 | 32 |
7125 | 33 if (nargin != 1) |
34 print_usage (); | |
35 endif | |
36 | |
3191 | 37 p = length (c) - 1; |
3426 | 38 |
3191 | 39 if (columns (c) > 1) |
40 c = c'; | |
41 endif | |
3426 | 42 |
3191 | 43 cp = c(2 : p+1); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
44 CP = zeros (p, p); |
3426 | 45 |
3191 | 46 for i = 1:p |
47 for j = 1:p | |
48 CP (i, j) = c (abs (i-j) + 1); | |
49 endfor | |
50 endfor | |
3426 | 51 |
3191 | 52 a = inv (CP) * cp; |
53 v = c(1) - a' * cp; | |
3426 | 54 |
3191 | 55 endfunction |
56 | |
57 |