FFT variance and spectral density

10 views (last 30 days)
Ken W
Ken W on 17 Dec 2015
Commented: Star Strider on 18 Dec 2015
Hi,
I would like to understand the relationship between variance and spectral density. Below is my source code,
a=1:1:10 b=fft(a)
% Parceval theorem p1=sum(a.^2) p2=sum(abs(b).^2)/length(a)
var(a)
I manage to show that p1 = p2 based on Parceval theorem. But how to show that variance of a is equal to power spectral density.
Thank you.
  1 Comment
Ken W
Ken W on 17 Dec 2015
How to calculate variance from spectral density? Could you show me using the source code above?
Thank you.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 17 Dec 2015
Edited: Star Strider on 17 Dec 2015
If you have the Signal Processing Toolbox, you can use the pwelch function to get the confidence intervals. See the documentation on Upper and Lower 95%-Confidence Bounds. You can specify the confidence bounds you want.
To get the variance, first calculate the probability corresponding to one standard deviation:
Npdf = @(x) (1-erf(-x./sqrt(2)))./2;
SD_1 = diff(Npdf([-1 1]))
SD_1 =
682.6895e-003
so use that as the probability for the 'ConfidenceLevel' value. Square the value the function returns to get the variance. (The Statistics Toolbox normcdf function will also produce this probability value.)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!