Updated Fri, 17 Jul 2020 11:56:31 +0000
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.
Brett Shoelson (2023). lombscargle.m (https://www.mathworks.com/matlabcentral/fileexchange/993-lombscargle-m), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired: Lomb normalized periodogram
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.