cplsw(tx,x,ty,y,varargin)
CPLSW cross power spectral density estimate via Lomb-Scargle method and Welch's windowing/averaging, partially based on REDFITX by Olafsdottir, Schulze & Mudelsee (2016)
Output = CPLSW(TX,X,TY,Y)
Perform Lomb-Scargle cross power spectral analysis on two discrete-time signals, X and Y, sampled at instances TX and TY respectively. By default, X and Y are split into 3 segments with 50% overlap and Hanning windowed, then periodograms are calculated then averaged.
X, TX, Y, and TY are all assumed to be vectors with numel(X)==numel(TX) and numel(Y)==numel(TY). Output is a structure with the following entries:
f: Vector of PSD frequencies
varx: Estimated variance of X(TX)
vary: Estimated variance of Y(TY)
gxx: PSD of X(TX)
gyy: PSD of Y(TY)
gxy: CPSD of X(TX), Y(TY)
gd: Theoretical detection limit in power spectra
cxy: Coherency spectrum of X(TX), Y(TY)
cd: Theoretical detection limit in coherency spectra
pxy: Phase spectrum of X(TX) relative to Y(TY)
pd: Theoretical phase confidence
All detection limits assume one-sigma confidence. All power spectra are normalized such that trapz(f,gxx)=1.
Output = CPLSW(TX,X,TY,Y,'OptionName',OptionValue)
Changes OptionName to use OptionValue rather than it's default value. Options include:
'f': Frequency array for PSD. Range is limited from 0 to Nyquist f.
'ofac': Oversampling factor. Default is 4.
'nseg': Number of segments for Welch's averaging. Default is 3.
'plap': Percent overlap of segments. Default is 0.50.
'iwin': Window type. Default is 2. Possible values:
0: Rectangular / no window
1: Triangular window
2: Hanning window (default)
#: Others to come later, or add your own.
'conf': Confidence of detection thresholds. Default is 1-sigma (0.68)
Cite As
Arin Nelson (2026). cplsw(tx,x,ty,y,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/61353-cplsw-tx-x-ty-y-varargin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Signal Processing > Signal Processing Toolbox > Spectral Analysis > Parametric Spectral Estimation >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
