From: <be...@us...> - 2012-06-30 18:46:10
|
Revision: 10709 http://octave.svn.sourceforge.net/octave/?rev=10709&view=rev Author: benjf5 Date: 2012-06-30 18:46:04 +0000 (Sat, 30 Jun 2012) Log Message: ----------- Added lombcoeff, going to add tests to functions and clean up documentation shortly. Modified Paths: -------------- trunk/octave-forge/extra/lssa/fastlsreal.cc trunk/octave-forge/extra/lssa/lscomplex.m Added Paths: ----------- trunk/octave-forge/extra/lssa/lombcoeff.m Modified: trunk/octave-forge/extra/lssa/fastlsreal.cc =================================================================== --- trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-29 16:40:57 UTC (rev 10708) +++ trunk/octave-forge/extra/lssa/fastlsreal.cc 2012-06-30 18:46:04 UTC (rev 10709) @@ -188,7 +188,6 @@ } } iota_record_current->stored_data = true; - std::cout << "Precomputed " << iota_record_current << std::endl; k++; } tau_h += ( 2 * delta_tau ); Added: trunk/octave-forge/extra/lssa/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombcoeff.m (rev 0) +++ trunk/octave-forge/extra/lssa/lombcoeff.m 2012-06-30 18:46:04 UTC (rev 10709) @@ -0,0 +1,31 @@ +## Copyright (C) 2012 Benjamin Lewis <be...@gm...> +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {c =} lombcoeff (time, mag, freq) +## +## Return the coefficient of the Lomb periodogram (unnormalized) for the +## (@var{time},@var{mag}) series for the @var{freq} provided. +## +## @seealso{lombnormcoeff} +## @end deftypefn + + +function coeff = lombcoeff(T, X, o) + theta = atan2(sum(sin(2 .* o .* T )), sum(cos(2.*o.*T)))/ (2 * o ); + coeff = ( sum(X .* cos(o .* T - tau))**2)/(sum(cos(o.*T-tau).**2)) + + ( sum(X .* sin(o .* T - tau))**2)/(sum(sin(o.*T-tau).**2)); +end function + Modified: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m 2012-06-29 16:40:57 UTC (rev 10708) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-06-30 18:46:04 UTC (rev 10709) @@ -26,15 +26,13 @@ function transform = lscomplex( t , x , omegamax , ncoeff , noctave ) n = length(t); ## VECTOR ONLY, and since t and x have the same number of entries, there's no problem. - n1 = 1 / n; transform = zeros(1,ncoeff*noctave); o = omegamax; omul = 2 ^ ( - 1 / ncoeff ); for iter = 1:ncoeff*noctave ot = o .* t; - transform(iter) = sum( ( cos(ot) .- ( sin(ot) .* i ) ) .* x ); ## See the paper for the expression + transform(iter) = sum( ( cos(ot) - ( sin(ot) .* i ) ) .* x ) / n; ## See the paper for the expression o *= omul; ## To advance the transform to the next coefficient in the octave endfor - transform ./ n; endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |