Hi all,
Below is the method to the get PSD estimate of a signal with frequency in hertz as the x axis (per matlab). I am wondering how this code would change if my Sample frequency is 256 Hz? I'm having trouble understanding the significance of using 500 and 300 and how this would change if my fs was 256 (or any number for that matter).
Also, I need my Y-axis to output (V^2/hz) and I'm wondering how to db/Hz to V^2/hz. My time series data is in units of volts. Also why do they use 10*log10??
Thanks!
Create a signal consisting of a 100 Hz sinusoid in additive N(0,1) white noise. Reset the random number generator for reproducible results. The sample rate is 1 kHz and the signal is 5 seconds in duration.
rng default
fs = 1000;
t = 0:1/fs:5-1/fs;
x = cos(2*pi*100*t) + randn(size(t));
Obtain Welch's overlapped segment averaging PSD estimate of the preceding signal. Use a segment length of 500 samples with 300 overlapped samples. Use 500 DFT points so that 100 Hz falls directly on a DFT bin. Input the sample rate to output a vector of frequencies in Hz. Plot the result.
[pxx,f] = pwelch(x,500,300,500,fs);
plot(f,10*log10(pxx))
xlabel('Frequency (Hz)')
ylabel('PSD (dB/Hz)')