Mercurial > hg > octave-terminal
changeset 7436:7d06a404b8f9
[project @ 2008-02-01 06:57:50 by jwe]
author | jwe |
---|---|
date | Fri, 01 Feb 2008 06:58:29 +0000 |
parents | 464a55f1a5c2 |
children | 3e450caf93f2 |
files | scripts/ChangeLog scripts/signal/arch_rnd.m |
diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2008-02-01 Dave Goel <deego3@gmail.com> + + * signal/arch_rnd.m: Correctly index E and Y vectors. + 2008-02-01 Bill Denney <bill@denney.ws> * time/weekday.m: Allow vector inputs and speed up.
--- a/scripts/signal/arch_rnd.m +++ b/scripts/signal/arch_rnd.m @@ -63,6 +63,7 @@ a = [a, 0]; la = la + 1; endif + lb = length (b); b = reshape (b, 1, lb); if (lb == 1) @@ -79,18 +80,19 @@ e(1) = sqrt (h(1)) * randn; y(1) = b(1) + e(1); - for t= 2 : M; + for t = 2:M ta = min ([t, la]); - h(t) = a(1) + a(2:ta) * e(t-1:t-ta+1).^2; + h(t) = a(1) + a(2:ta) * e(t-ta+1:t-1).^2; e(t) = sqrt (h(t)) * randn; tb = min ([t, lb]); - y(t) = b(1) + b(2:tb) * y(t-1:t-tb+1) + e(t); + y(t) = b(1) + b(2:tb) * y(t-tb+1:t-1) + e(t); endfor + if (T > M) - for t = M+1 : T; - h(t) = a(1) + a(2:la) * e(t-1:t-la+1).^2; + for t = M+1:T + h(t) = a(1) + a(2:la) * e(t-la+1:t-1).^2; e(t) = sqrt (h(t)) * randn; - y(t) = b(1) + b(2:lb) * y(t-1:t-tb+1) + e(t); + y(t) = b(1) + b(2:lb) * y(t-tb+1:t-1) + e(t); endfor endif