Mercurial > forge
changeset 10440:33cbf3d3a61e octave-forge
Added lombnormcoeff, haven't finished testing yet.
author | benjf5 |
---|---|
date | Tue, 12 Jun 2012 14:56:43 +0000 |
parents | 6c19a05abd36 |
children | f75f33cb1c70 |
files | extra/lssa/lombnormcoeff.m |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/lssa/lombnormcoeff.m Tue Jun 12 14:56:43 2012 +0000 @@ -0,0 +1,9 @@ +## Copyright (c) 2012 Benjamin Lewis <benjf5@gmail.com> +## GNU GPLv2 + +function coeff = lombnormcoeff(X,Y,omega) +tau = atan2( sum( sin( 2.*omega.*X)), sum(cos(2.*omega.*X))) / 2; +coeff = ( ( sum ( Y .* cos( omega .* X - tau ) ) .^ 2 ./ sum ( cos ( omega .* X - tau ) .^ 2 ) + + sum ( Y .* sin ( omega .* X - tau ) ) .^ 2 / sum ( sin ( omega .* X - tau ) .^ 2 ) ) + / ( 2 * var(Y) ) ); +end \ No newline at end of file