comparison scripts/signal/diffpara.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 3e3e14ad5149
comparison
equal deleted inserted replaced
3456:434790acb067 3457:e031284eea27
33 ## 33 ##
34 ## Reference: Brockwell, Peter J. & Davis, Richard A. Time Series: 34 ## Reference: Brockwell, Peter J. & Davis, Richard A. Time Series:
35 ## Theory and Methods Springer 1987. 35 ## Theory and Methods Springer 1987.
36 ## @end deftypefn 36 ## @end deftypefn
37 37
38 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> 38 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at>
39 ## Description: Estimate the fractional differencing parameter 39 ## Description: Estimate the fractional differencing parameter
40 40
41 function [d, D] = diffpara (X, a, b) 41 function [d, D] = diffpara (X, a, b)
42 42
43 if ((nargin < 1) || (nargin > 3)) 43 if ((nargin < 1) || (nargin > 3))
44 usage ("[d, D] = diffpara (X, a, b)"); 44 usage ("[d, D] = diffpara (X, a, b)");
45 else 45 else
46 if is_vector (X) 46 if (is_vector (X))
47 n = length (X); 47 n = length (X);
48 k = 1; 48 k = 1;
49 X = reshape (X, n, 1); 49 X = reshape (X, n, 1);
50 else 50 else
51 [n, k] = size(X); 51 [n, k] = size(X);
57 b = a; 57 b = a;
58 a = 1; 58 a = 1;
59 endif 59 endif
60 endif 60 endif
61 61
62 if !(is_scalar (a) && is_scalar (b)) 62 if (! (is_scalar (a) && is_scalar (b)))
63 error ("diffpara: a and b must be scalars"); 63 error ("diffpara: a and b must be scalars");
64 endif 64 endif
65 65
66 D = zeros (b - a + 1, k); 66 D = zeros (b - a + 1, k);
67 67
68 for l = 1:k 68 for l = 1:k
69 69
70 w = 2 * pi * (1 : n-1) / n; 70 w = 2 * pi * (1 : n-1) / n;
71 71
72 x = 2 * log (abs( 1 - exp (-i*w))); 72 x = 2 * log (abs (1 - exp (-i*w)));
73 y = log (periodogram (X(2:n,l))); 73 y = log (periodogram (X(2:n,l)));
74 74
75 x = center (x); 75 x = center (x);
76 y = center (y); 76 y = center (y);
77 77