2014-03-29 41 views
-1

這裏是我的PSD程序在微伏^ 2/Hz,其中W是我的數據。功率譜侮辱在微伏^ 2/Hz?

Fs=128 
x1 =W; 
L = length(x1); 
NFFT = 2^nextpow2(L); 
f = Fs/2*linspace(0,1,NFFT/2+1); 
n = 0:L-1; 
pxx1 = pwelch(x1,L); 
plot(pxx); 

我需要知道,如果我的計劃是對還是錯在這裏要想在微伏^ 2/Hz的內置PSD。

+1

您應該測試它。它是否爲已知數據提供了正確的值? – 2014-03-29 01:57:18

回答

0

使用pwelch確實是以正確的方式獲得以每赫茲爲單位的功率譜密度。但是,您可能需要提供更多參數給pwelch

% input is a time series x 

fs=128     % sample rate (Hz) 
bw = 0.1;     % desired spectrum resolution (Hz) 
nfft = fs/bw;    % length of fft (samples) 
nfft = 2^nextpow2(nfft); % round to nearest power of 2 
bw = fs/nfft;   % actual resolution 

% Estimate the power spectral density 
[Pxx, f] = pwelch(x, hanning(nfft), nfft/2, nfft, fs); 

% Plot the results 
loglog(f, Pxx) 
xlabel('frequency [Hz]'); 
ylabel('units^2/Hz');