Mercurial > forge
changeset 10646:419d25fc090e octave-forge
fix test syntax
author | cdf |
---|---|
date | Tue, 07 Aug 2012 05:55:09 +0000 |
parents | afe77b16b1a1 |
children | b51c41f24c02 |
files | extra/lssa/inst/lombnormcoeff.m |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/lssa/inst/lombnormcoeff.m Sun Aug 05 23:05:36 2012 +0000 +++ b/extra/lssa/inst/lombnormcoeff.m Tue Aug 07 05:55:09 2012 +0000 @@ -22,16 +22,6 @@ ## ## @end deftypefn -%!test -%!shared t, x, o, maxfreq; -%! maxfreq = 4 / ( 2 * pi ); -%! t = linspace(0,8); -%! x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); -%! o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%!assert( lombnormcoeff(t,x,o(1)),63.3294946603949,5e-10 ); -%!assert( lombnormcoeff(t,x,o(2)),73.2601360674868,5e-10 ); -%!assert( lombnormcoeff(t,x,o(3)),53.0799752083903,5e-10 ); - function coeff = lombnormcoeff(T,X,omega) tau = atan2( sum( sin( 2.*omega.*T)), sum(cos(2.*omega.*T))) / 2; @@ -39,3 +29,12 @@ + sum ( X .* sin ( omega .* T - tau ) ) .^ 2 / sum ( sin ( omega .* T - tau ) .^ 2 ) ) / ( 2 * var(X) ) ); endfunction + +%!shared t, x, o, maxfreq +%! t = linspace(0,8); +%! maxfreq = 4 / ( 2 * pi ); +%! o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%! x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); +%!assert( lombnormcoeff(t,x,o(1)),63.3294946603949,5e-10 ); +%!assert( lombnormcoeff(t,x,o(2)),73.2601360674868,5e-10 ); +%!assert( lombnormcoeff(t,x,o(3)),53.0799752083903,5e-10 );