medfreq
R2026bMedian frequency
Syntax
Description
Time-Domain Inputs
estimates the median normalized frequency, fMed = medfreq(x)fMed, of the
power spectrum of a time-domain signal, x.
Specify
xas a vector, matrix, or a MATLAB® timetable (since R2026b). Ifxis a matrix or a timetable, then the function computes the median frequency of each column or variable independently.To compute the power spectrum,
medfrequses theperiodogramfunction with a rectangular window and number of DFT points equal to the length ofx.
Frequency-Domain Inputs
Additional Options
specifies the frequency interval fMed = medfreq(___,freqRange)freqRange over which to
compute the median frequency.
This syntax can include any combination of input arguments from previous syntaxes, as long as you specify
freqRangebefore theDomainname-value argument.If you specify the second input as empty and
xis not a timetable, then the function assumes normalized frequencies.
medfreq(___) with no output arguments plots
the PSD or power spectrum and annotates the median frequency.
Examples
Input Arguments
Output Arguments
Algorithms
To determine the median frequency, medfreq computes a
periodogram power spectrum estimate using a rectangular window. You can obtain the same
value of median frequency, fMed, from a signal
x at a sample rate Fs in these three
ways.
| Directly from the signal |
fMed = medfreq(x,Fs) |
| From the periodogram of the signal |
[P,F] = periodogram(x,[],length(x),Fs); fMed = medfreq(P,F) |
| From the power spectral estimate (Welch's PSD) of the signal |
[P,F] = pwelch(x,rectwin(length(x)),[],length(x),Fs); fMed = medfreq(P,F) |
Note
Because medfreq uses an intermediary representation
to transform the input signal from the time domain to frequency domain, the
returned median frequency might vary, depending on the signal transformation
method, number of DFT points, and window size.
References
[1] Phinyomark, Angkoon, Sirinee Thongpanja, Huosheng Hu, Pornchai Phukpattaranont, and Chusak Limsakul. "The Usefulness of Mean and Median Frequencies in Electromyography Analysis." In Computational Intelligence in Electromyography Analysis – A Perspective on Current Applications and Future Challenges, edited by Ganesh R. Naik. London: IntechOpen, 2012. https://doi.org/10.5772/50639.
Extended Capabilities
Version History
Introduced in R2015aSee Also
findpeaks | meanfreq | periodogram | plomb | pwelch









