Mean-square (power) spectrum
Hmss = dspdata.msspectrum(Data)
Hmss = dspdata.msspectrum(Data,Frequencies)
Hmss = dspdata.msspectrum(...,'Fs',Fs)
Hmss = dspdata.msspectrum(...,'SpectrumType',SpectrumType)
Hmss = dspdata.msspectrum(...,'CenterDC',flag)
The mean-squared spectrum (MSS) is intended for discrete spectra. Unlike the power spectral density (PSD), the peaks in the MSS reflect the power in the signal at a given frequency. The MSS of a signal is the Fourier transform of that signal's autocorrelation.
Hmss = dspdata.msspectrum(Data) uses
the mean-square (power) spectrum data contained in
which can be in the form of a vector or a matrix, where each column
is a separate set of data. Default values for other properties of
the object are as follows:
Vector of frequencies at which the spectrum is evaluated.
The range of this vector depends on the
If you do not
Sampling frequency, which is
Nyquist interval over which the spectral density is calculated.
Valid values are
The interval for
Whether the frequency is normalized (
Hmss = dspdata.msspectrum(Data,Frequencies) uses
the mean–square spectrum data contained in
Hmss = dspdata.msspectrum(...,'Fs',Fs) uses
the sampling frequency
a default set of linear frequencies (in
Fs and sets
Hmss = dspdata.msspectrum(...,'SpectrumType',SpectrumType) uses
SpectrumType string to specify the interval
over which the mean–square spectrum was calculated. For data
that ranges from [0 pi) or [0 pi],
for data that ranges from [0 2pi), set the the
Hmss = dspdata.msspectrum(...,'CenterDC',flag) uses
the value of
flag to indicate whether the zero-frequency
(DC) component is centered. If
it indicates that the DC component is in the center of the two-sided
spectrum. Set the
the DC component is on the left edge of the spectrum.
Methods provide ways of performing functions directly on your
without having to specify the parameters again. You can apply a method
directly on the variable you assigned to your
You can use the following methods with a
For example, to normalize the frequency and set the
to true, use
Hmss = normalizefreq(Hs)
For detailed information on using the methods and plotting the
spectrum, see the
In this example, we construct a mean-square spectrum data object from the one-sided PSD estimate of a signal. The signal consists of two sinusoids in additive noise.
Fs = 32e3; t = 0:1/Fs:1-(1/Fs); x = cos(2*pi*t*1.24e3)+cos(2*pi*t*10e3)+randn(size(t)); X = fft(x); X = X(1:length(X)/2+1); % One-sided DFT P = (abs(X)/length(x)).^2; % Compute the mean-square power P(2:end-1) = 2*P(2:end-1); % Factor of two for one-sided estimate % at all frequencies except zero and the Nyquist Hmss = dspdata.msspectrum(P,'Fs',Fs,'spectrumtype','onesided'); plot(Hmss) % Plot the mean-square spectrum.