Main Content


Effective sampling rate of a time vector

Since R2020a


effectivefs is a function used in code generated by Diagnostic Feature Designer.

[Fs,irregular] = effectivefs(T) checks the regularity of one-dimensional time array T and returns the best approximation Fs to the underlying sampling rate. Code that is generated by Diagnostic Feature Designer uses effectivefs when performing spectral processing and other computations.

Input Arguments

collapse all

Time array of sampling instants, expressed as a one-dimensional datetime array, a one-dimensional duration array, or a numeric vector.

Output Arguments

collapse all

Effective sampling rate, returned as a numeric scalar.

  • If T is a duration array, then Fs is in cycles per time unit of T.

  • If T is a datetime array, then effectiveFs determines the best value for the time unit based on the data, and Fs is in cycles per time unit.

  • If T is a numeric vector, then Fs is in cycles per second.

Irregularity indicator, returned as a logical.

  • When irregular is true, the sampling instants in T are unevenly spaced. Fs represents the effective sampling rate of T.

  • When irregular is false, the sampling instants in T are evenly spaced. Fs represents the true sampling rate of T.

Version History

Introduced in R2020a