# PSD-Wiener Khinchin-xcorr problem due to the division coefficients of the PSD

5 views (last 30 days)
SYML2nd on 4 Jul 2019
Edited: SYML2nd on 5 Jul 2019
Hi,
I am trying to calculate the PSD from the autocorrelation. I am finding the following problems doing this (it is mandatory for me using this autocorrelation):
1. The test 1 is verified. I used the same division that are placed in this documenthttp://aaronscher.com/Course_materials/Communication_Systems/documents/PSD_Autocorrelation_Noise.pdf, but unfortunately I am not sure why the psd should by divided by the length of the signal instead of the length of the autocorrelation.
2. The Parseval theorem (%parseval failed) is failed so I am wandering if this means that my division are not correct. If I apply the parseval theorem using the normalization %parseval passed, the test is passed. So can you help me to understand if my "normalization" is wrong.
I hope you can help me. I tried a lot of time to find the right normalization.
clear; clc; close all;
v_c=dlmread('v_c.txt', '\t', 1, 0)
v1=(v_c(:,2:2))
%Tinc rappresenta il passo temporale
Tinc=0.001;
Fs=1/Tinc;
r1 =xcorr(v1,v1)/Fs;
freq =transpose( -Fs/2:Fs/length(r1):Fs/2-(Fs/length(r1)));
delta_f=(freq(2)-freq(1))
PSDfromr1 = abs(fftshift(fft(r1)))*(1/((length(v1))))
%test 1 CumulatePSDfromr1 should be equal to rms2v1
CumulatedPSDfromr1=sum(PSDfromr1)*0.005
rms2v1=rms(v1)^2
% parseval failed
vf2=sum((PSDfromr1).^2);
vt=sum(r1.^2)
% parseval passed
vf=sum(abs(fftshift(fft(r1))).^2)/length(r1);
figure (1)
plot(freq,PSDfromr1)

R2019a

### Community Treasure Hunt

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

Start Hunting!