Power spectrum with pwelch & question about Parseval's

5 views (last 30 days)
I have xt, a complex sequence of size length N. I use the pwelch function to compute a PSD, using
[yf, ys] = pwelch(xt, w, 0, fsize, fs, 'centered')
fs is the sampling rate. fsize is the fftsize, which is set such that I have some 300 averages or so (say N/300). w is some window function with the same number of points as fsize. Freq resolution on the spectrum is fs/fsize = fstep, say.
I estimate power in the spectrum as sum(ys)*fstep. I want to estimate the power in xt, and expect to find equivalence (by Parseval's relationship). I estimate this as: sum(abs(xt).^2). The two powers are not equal, and bear no sensible relationship to each other either. I have tried 7 different sequences for xt. Power(xt) > Power(ys) by factors ranging from 216 to 1670.
Further, when I upsample xt by a factor of 4, I find that sum(abs(xt_upsampled).^2) is 4 times greater than sum(abs(xt).^2). This is using the resample command. I thought resample was supposed to normalize the power. I am now very uncertain how to estimate power in the time-domain. Any suggestions? Does pwelch do something that invalidates Parseval's or am I wrongly applying it?
  2 Comments
AR
AR on 26 Aug 2022
I just realized that the power estimate from xt was actually energy, and that I haven't accounted for time. So let me rework that and come back if there's still some problem.
AR
AR on 26 Aug 2022
Following up, once the power estimate is corrected as sum(abs(xt).^2)/(fs*total_time_length), it is correct and matches the spectral estimate. One could also just use the bandpower function. Apologize for not having thought about this properly before asking - please scratch the question if that makes sense.

Sign in to comment.

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!