| Contents | Index |
This section shows you how to measure the average power of a deterministic periodic signal. This type of signal is continuous in time, but produces a discrete power spectrum. A signal made up of sinusoids is an example of a power signal that has infinite energy, but finite average power . The example shows how to estimate the average power of a sinewave with a peak amplitude of 1.
First, you measure the average power using a periodogram spectrum object, and then calculate and plot the mean-square (power) spectrum.
Fs = 1024; % Sampling frequency
t = 0:1/Fs:1-(1/Fs); % Time vector
A = 1; % Peak amplitude
F1 = 128; % Hz
x = A*sin(2*pi*t*F1); % Sinusoidal signal
hp = spectrum.periodogram('hamming'); % Create periodogram
% Create options object and set properties
hpopts = psdopts(hp,x);
set(hpopts,'Fs',Fs,'SpectrumType','twosided','centerdc',true);
msspectrum(hp,x,hpopts);
v = axis; axis([v(1) v(2) -10 -5.5]); % Zoom in Y.

The average power of each complex sinusoid is approximately -6 dB.
To calculate the average power by "integrating" under the power spectral density (PSD) curve, you use the psd method on the spectrum object (hp) , and then use the avgpower method.
hpsd = psd(hp,x,hpopts); plot(hpsd);

Notice that the peaks of this plot are not the same height as the mean-square spectrum peaks. The area under the PSD curve is the measure of the average power, not the peak heights. By using the avgpower method and converting the result to dB, you can see that the average power is the same for both of them.
power_freqdomain = avgpower(hpsd)
power_freqdomain =
0.5000According to Parseval's theorem, the total average power in a sinusoid is the same, whether you compute the power in the time or frequency domain. You can verify the estimated average power by summing the signal in the time domain.
power_timedomain = sum(abs(x).^2)/length(x)
power_timedomain =
0.5000Converting this linear value to a logarithmic value, you see that the average power is the same as shown in the mean-square spectrum plot.
10*log10(power_freqdomain/2) ans = -6.0206
![]() | Changing Spectral Analysis Object Property Values |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |