Mercurial > hg > octave-nkf
comparison scripts/signal/autoreg_matrix.m @ 3457:e031284eea27
[project @ 2000-01-19 08:49:56 by jwe]
author | jwe |
---|---|
date | Wed, 19 Jan 2000 08:50:14 +0000 |
parents | 858695b3ed62 |
children | 38c61cbf086c |
comparison
equal
deleted
inserted
replaced
3456:434790acb067 | 3457:e031284eea27 |
---|---|
22 ## @var{y}(@var{t}-1), ..., @var{y}(@var{t}-@var{k})]} is the t-th row | 22 ## @var{y}(@var{t}-1), ..., @var{y}(@var{t}-@var{k})]} is the t-th row |
23 ## of the result. The resulting matrix may be used as a regressor matrix | 23 ## of the result. The resulting matrix may be used as a regressor matrix |
24 ## in autoregressions. | 24 ## in autoregressions. |
25 ## @end deftypefn | 25 ## @end deftypefn |
26 | 26 |
27 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> | 27 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> |
28 ## Description: Design matrix for autoregressions | 28 ## Description: Design matrix for autoregressions |
29 | 29 |
30 function X = autoreg_matrix (y, k) | 30 function X = autoreg_matrix (y, k) |
31 | 31 |
32 if (nargin != 2) | 32 if (nargin != 2) |
33 usage ("autoreg_matrix (y, k)"); | 33 usage ("autoreg_matrix (y, k)"); |
34 endif | 34 endif |
35 | 35 |
36 if !(is_vector (y)) | 36 if (! (is_vector (y))) |
37 error ("autoreg_matrix: y must be a vector"); | 37 error ("autoreg_matrix: y must be a vector"); |
38 endif | 38 endif |
39 | 39 |
40 T = length (y); | 40 T = length (y); |
41 y = reshape (y, T, 1); | 41 y = reshape (y, T, 1); |
42 X = ones (T, k+1); | 42 X = ones (T, k+1); |