sigal average power estimation
Show older comments
Hi !
I've created a snippet to test my insight of power the density spectra computed from the fft matlab function. Unfortunately, I have a factor 4 between average power computed from the signal in the time domain and the average power estimated from the FFT. May I ask you some hints ? Regards. Here my snippet :
N=1024;
Fs=1e3;
Ts=1/Fs;
timeSlot = N*Ts;
tVect = (0:N-1)*Ts;
F_axis = (0:N-1)*Fs/N;
F_axis_Single = F_axis(1:length(F_axis)/2);
A2=2;A=sqrt(A2);
% number of harmonics
nH = 10;
% build a set of nH random frequencies ranged from 0 to Fs/2
freqIDs = sort(round((N/2)*rand(1,nH )));
setOfFreqs = F_axis_Single(freqIDs);
% buid a set of harmonics of frequencies defined above
noiseHarmos = A*sin(2*pi*tVect'*setOfFreqs);
noiseSig = sum(noiseHarmos,2);
% figure;plot(tVect,sigs);
fftSig_Db = fft(noiseSig);
fftSig_Sg = fftSig_Db(1:N/2); % FFT single sided coeff
fftSig_Sg(2:end) = 2*fftSig_Sg(2:end);
% norm of FFT
absFftSig_Sg = abs(fftSig_Sg); % /N to get FFT in V
absFftSig_Sg_V = abs(fftSig_Sg)/N; % /N to get FFT in V
% DSP
dspSigSg = absFftSig_Sg.^2/N;
% Average powa from time domain
powFromSig = mean(noiseSig.^2)
% Average powa from frequency domain
powFromDsp = sum(dspSigSg)/N
Accepted Answer
More Answers (0)
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!