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 commentaire

Ken W
Ken W le 17 Déc 2015
How to calculate variance from spectral density? Could you show me using the source code above?
Thank you.

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 17 Déc 2015
Modifié(e) : Star Strider le 17 Déc 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.)

2 commentaires

Ken W
Ken W le 18 Déc 2015
Thank you very much
Star Strider
Star Strider le 18 Déc 2015
My pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by