Code covered by the BSD License  

Highlights from
Lomb normalized periodogram

  • fastlomb(x,t,varargin) FASTLOMB caculates the Lomb normalized periodogram (aka Lomb-Scargle, Gauss-Vanicek or Least-Squares spectrum) of a vector x with coordinates in t.
  • lomb(x,t,varargin) LOMB caculates the Lomb normalized periodogram (aka Lomb-Scargle, Gauss-Vanicek or Least-Squares spectrum) of a vector x with coordinates in t.
  • View all files

4.0

4.0 | 3 ratings Rate this file 25 Downloads (last 30 days) File Size: 7.44 KB File ID: #22215

Lomb normalized periodogram

by Christos Saragiotis

 

22 Nov 2008 (Updated 04 Dec 2008)

Both functions calculate the Lomb-Scargle periodogram (aka Gauss-Vanicek/Least-squares spectrum)

| Watch this File

File Information
Description

Both functions caculate the Lomb normalized periodogram (aka Lomb-Scargle, Gauss-Vanicek or Least-Squares spectrum) of a vector x with coordinates in t, which is essentially a generalization of the DFT for unevenly sampled data.

The codes are transcriptions from Fortran of the subroutines found in Section 13.8 (pp. 569-577) of "Numerical recipes in Fortran 77: the art of scientific computing", 2nd ed., vol. 1, Cambridge University Press, NY, USA, 2001 by WH Press, SA Teukolsky, WT Vetterling and BP Flannery,

However, Matlab's characteristics have been taken into account in order to make it fast for Matlab.

FASTLOMB is much faster than LOMB (especially when the length of the input increases) but even LOMB is faster than any other implementation I found in FileExchange. Also they both do not suffer from memory problems (I tested them both for inputs of 100,000 samples).

I'd also like to acknowledge file ID: 20004 (for some reason I can't get two file IDs in the acknowledgements)

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
lombscargle.m

MATLAB release MATLAB 7.6 (R2008a)
Other requirements Example times on my 3-year old pc: Samples of input/LOMB time (sec)/FASTLOMB time (sec): 1,000 / 6 / 0.15, 5,000 / 12 / 0.5, 10,000 / 50 / 1., 50,000 / 20min / 5., 100,000 / 2hrs / 40
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
24 Aug 2009 Daniel Armyr

Nice implelemtation of the Lomb method. The only reason I am not giving this a five is that the built-in plotting functionality is far to over-specified. Opening up a new figure and then drawing raw lines in it is not particularly flexible or helpful for integrating into larger applications.

23 Feb 2010 Benjamin Bayes

Excellent function. However, in fastlomb.m, it seems like on line 212,

ck = 1 + mod(fix(t(j)*fac),2*nfreq);

should be

ck = 1 + mod(t(j)*fac,2*nfreq);

If not changed, it seems like the else statement on line 228 is never reached. Thanks!

25 Feb 2010 Benjamin Bayes  
25 Mar 2010 Christos Saragiotis

Daniel, thank you for your commenting.

Regarding the plotting part, I am not sure I understand what you mean, but you can always set fig to 0 and then take the output of the m-files and plot them as you wish.

Sorry it took me so long to answer, I thought I was getting an automatic email every time someone commented but it seems this is not the case

08 May 2011 Felipe G. Nievinski

Does the job.
You might want to replace line 198:

    if length(x)~=nt, disp(sprintf('WARNING %s: Double entries have been eliminated',mfilename)); end

for:

    if length(x)~=nt, warning('fastlomb:Duplicates','Double entries have been eliminated.'); end

so that it can be disabled issuing warning('off','fastlomb:Duplicates')

Please login to add a comment or rating.
Updates
25 Nov 2008

After running the Matlab profiler, I realized that the waitbar I had in the lomb.m function was the main factor of slowness of the lomb.m function. So I removed the waitbar and updated the info in the "Other requirements" section.

04 Dec 2008

I corrected a formula where a sqrt was supposed to exist and it didn't. The results don't differ much though.

Sorry about this...

Tag Activity for this File
Tag Applied By Date/Time
signal processing Christos Saragiotis 24 Nov 2008 14:05:34
earth science Christos Saragiotis 24 Nov 2008 14:05:34
transforms Christos Saragiotis 24 Nov 2008 14:05:34
lomb Christos Saragiotis 24 Nov 2008 14:05:34
periodogram Christos Saragiotis 24 Nov 2008 14:05:34
spectrum Christos Saragiotis 24 Nov 2008 14:05:34
least squares spectrum Christos Saragiotis 24 Nov 2008 14:05:34
gauss Christos Saragiotis 28 Jul 2009 06:45:35
scargle Christos Saragiotis 28 Jul 2009 06:45:45

Contact us at files@mathworks.com