Skip to content

sidFreqBTFDR

Python equivalent: sid.freq_btfdr

Blackman-Tukey spectral analysis with frequency-dependent resolution.

result = sidFreqBTFDR(y, u)
result = sidFreqBTFDR(y, [])
result = sidFreqBTFDR(y, u, 'Resolution', R)
result = sidFreqBTFDR(y, u, 'Resolution', R, 'Frequencies', w, 'SampleTime', Ts)

Like sidFreqBT, but the window size varies across frequencies. The user specifies a resolution parameter (in rad/sample) instead of a fixed window size. Finer resolution (smaller R) uses a larger window and gives lower variance but coarser frequency detail, while coarser resolution (larger R) uses a smaller window.

This is an open-source replacement for the System Identification Toolbox function 'spafdr'.

Inputs

Name Description
y Output data, (N x n_y) matrix. Column vector for SISO.
For multiple trajectories: (N x n_y x L) array or cell array
{y1, y2, ...} for variable-length data. Spectral estimates
are ensemble-averaged across trajectories.
u Input data, (N x n_u) matrix. Column vector for SISO.
For multiple trajectories: (N x n_u x L) or cell array.
Use [] for time series (output spectrum only).

Name-value options

Name Description
'Resolution' Frequency resolution in rad/sample. Scalar (uniform)
or vector of same length as frequency grid (per-freq).
Default: 2*pi / min(floor(N/10), 30).
'Frequencies' Frequency vector in rad/sample, in (0, pi].
Default: 128 linearly spaced values.
'SampleTime' Sample time in seconds. Default: 1.0.

Outputs

Name Description
result Struct with fields:
.Frequency (n_f x 1) frequency vector, rad/sample
.FrequencyHz (n_f x 1) frequency vector, Hz
.Response (n_f x n_y x n_u) complex frequency response
.ResponseStd (n_f x n_y x n_u) standard deviation of Response
.NoiseSpectrum (n_f x n_y x n_y) noise spectrum
.NoiseSpectrumStd (n_f x n_y x n_y) standard deviation
.Coherence (n_f x 1) squared coherence (SISO only)
.SampleTime sample time in seconds
.WindowSize (n_f x 1) vector of window sizes M_k
.DataLength number of samples N
.NumTrajectories number of trajectories L
.Method 'sidFreqBTFDR'

Examples

N = 1000; u = randn(N, 1);
y = filter([1 0.5], [1 -0.8], u) + 0.1*randn(N, 1);
result = sidFreqBTFDR(y, u, 'Resolution', 0.3);
sidBodePlot(result);

Algorithm

For each frequency w_k: 1. Determine local window size M_k = ceil(2*pi / R_k). 2. Compute Hann window W_{M_k} and biased covariances up to lag M_k. 3. Compute windowed spectral estimates via direct DFT. 4. Form \(G(w_k)\) and \(Phi_v(w_k)\) as in sidFreqBT. 5. Compute asymptotic uncertainty using local window norm.

References

Ljung, L. "System Identification: Theory for the User", 2nd ed., Prentice Hall, 1999. Sections 6.3-6.4.

Specification

SPEC.md §5 — Frequency-Dependent Resolution

See also

sidFreqBT, sidFreqETFE, sidBodePlot, sidSpectrumPlot

Changelog

  • 2026-03-24: First version by Pedro Lourenço.