4.7

4.7 | 10 ratings Rate this file 195 downloads (last 30 days) File Size: 7.35 KB File ID: #993

lombscargle.m

by Brett Shoelson

 

29 Oct 2001 (Updated 09 Apr 2003)

Code covered by BSD License  

Performs a Lomb-Scargle periodogram analysis on unevenly spaced data.

Download Now | Watch this File

File Information
Description

LOMBSCARGLE(INPUTDATA, DUPE_ELIM) performs a Lomb-Scargle periodogram (spectral) analysis on an n x 2 matrix of data (inputdata = x(i),y(i)) that are not necessarily evenly spaced. (For evenly spaced data, more traditional Fourier-based spectral methods may be more appropriate.)

DUPE_ELIM (= 0 or 1) is an optional argument that will prompt the program (if dupe_elim == 1) to eliminate duplicated samples from the analysis. The default value is 0.

This program will plot and spectrally analyze the input data, and then plot the power spectrum of the data.

The program is also capable of overlaying a signal of known frequency and amplitude; this may be helpful for spectral calibration. The resulting spectrum plot will also include significance levels. Finally, the program will reconstruct a plot of frequencies determined to be "significant" (at alpha = 0.05); for this reconstruction, frequencies within 5% of the calibration signal (if used) will be discarded. Significant frequencies and powers are written to the MATLAB command window.

(This program is based on a Lomb-Scargle implementation in Press, Teukolsky, et al. Numerical Recipes, "Spectral Analysis of Unevenly Sampled Data." Use of this program requires an understanding of the Press/Teukolsky implementation, inculding the usage of hifac and ofac variables. The user is referred to that source for a thorough discussion of the algorithms. In addition, the references cited in Press/Teukolsky are quite helpful--particularly Scargle 1982, and Horne and Baliunas, 1986.)

Note that there is an over-reliance in this code on global variables, and that no attempts have been made to vectorize for loops or to optimize the implementation. Perhaps in the next version....

The attached file INPUTTOLOMB.M includes code for easily generating test data with known frequencies and amplitudes. This file is helpful for users trying to understand the output generated by lombscargle.

Acknowledgements
This submission has inspired the following:
Lomb normalized periodogram
MATLAB release MATLAB 6.1 (R12.1)
Zip File Content  
Other Files inputtolomb.m,
lombscargle.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (13)
07 Apr 2003 cj p

two functions with the same name ("period") so won't run...

15 Dec 2004 Benjamin Rosenbluth  
15 Dec 2004 Benjamin Lopez  
10 May 2005 Russ Fischer

Well done. The significance levels on the spectral plot are especially useful.

02 Mar 2006 Udo Schwarz  
27 Mar 2006 Martin Trauth  
04 May 2007 Ken Liao

Works exactly like it supposed to. It would be nice to output the raw spectrum data to a matrix.

16 May 2007 samir khan  
24 Jul 2007 Shyam Sundar  
04 Jan 2008 sella lestari

i still learning about this topic.
thanks for help me to understand and use this file.

04 Feb 2008 kondala rao rupa  
02 Jun 2008 Hasan Demirhan

i have 538 data points and i need analyse these data. But when i entering hifac=1548 programme did't work, so i need fast computation for this value.

05 Jun 2008 Pooria Sattari

Hey Guys:

I have problems with the inputdata prcedure. How should I input my n*2 matrix?

Thanks,

Please login to add a comment or rating.
Updates
31 Oct 2001

Provides a missing subfunction.

09 Apr 2003

Eliminates a duplicated subfunction, and fixes a bug when hifac is selected. Also, now successfully evaluates the real part of imaginary data.

Tag Activity for this File
Tag Applied By Date/Time
spectral analysis Brett Shoelson 22 Oct 2008 06:38:57
lomb scargle periodogram Brett Shoelson 22 Oct 2008 06:38:57
signal processing Brett Shoelson 22 Oct 2008 06:38:57
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com