- Segment Length (window): The length of each segment affects the trade-off between frequency resolution and time resolution. A longer segment length provides better frequency resolution but poorer time resolution. Conversely, a shorter segment length provides better time resolution but poorer frequency resolution.
- Overlap (noverlap): The number of overlapping samples between adjacent segments affects the smoothing and averaging of the PSD estimate. Increasing the overlap can reduce variance and improve the frequency resolution, but it also increases computational complexity.
- DFT Size (nfft): The number of points used in the discrete Fourier transform (DFT) determines the frequency resolution of the PSD estimate. A larger DFT size provides higher frequency resolution, allowing for more precise identification of spectral features. However, it also increases computational complexity.
- Sample Rate (fs): The sample rate of the input signal is used to compute the frequency axis of the PSD estimate in Hz. It ensures that the frequency axis is correctly scaled and corresponds to the actual frequencies in the input signal.
Adjustments to Welch PSD Estimate of Signal with Frequency in Hertz
16 次查看(过去 30 天)
显示 更早的评论
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)')
0 个评论
回答(1 个)
Sudarsanan A K
2023-10-20
Hello,
I understand that you are referring to the MathWorks documentation example: https://in.mathworks.com/help/signal/ref/pwelch.html#btulru8-5
I note that you want to use a different sampling frequency "fs" and find issue in understanding the relevance of the arguments of the "pwelch()" function.
The mentioned example is using the following syntax:
[pxx,f] = pwelch(signal, window, noverlap, nfft, fs);
The choices of the arguments in the "pwelch()" function can influence the power spectral density (PSD) estimation in the following ways:
Therefore, the choice of specific values for these arguments in the mentioned example (x, 500, 300, 500, fs) can be varied according to your requirements depending on the nature of the signal and analysis and it does not only depend on the sampling frequency "fs". Specifically, for the given example, you can choose these values such that it maintains the same ratio with the current values. Also, use a "nfft" so that 100 Hz falls directly on a DFT bin.
Regarding the unit of 10*log10(pxx) in the plotting, it is to represent the estimated PSD in dB/Hz. If you want it to be just W/Hz (or ), you can remove that conversion.
To know more about the use-cases of "pwelch()" function, you can refer to the MathWorks documentation in the link:
Further, for better understanding of the Welch method for PSD estimation, you can refer to the MathWorks documentation in the link:
I hope this helps you!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parametric Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!