How to correctly plot the PSD of segments of a signal?
8 次查看(过去 30 天)
显示 更早的评论
I have a signal r of length S samples of baseband bandwidth W Hz. This represents the received signal in a communication system. The sampling rate is fs and carrier frequency is fc. I want to monitor the two-sided power spectral density (PSD) of r in segements each of length U samples, where I prefer to calculate the PSD from fft directly instead of a built in function, but having an additional appraoch using a built-in function may be helpful. The way I do it now for the first segment for example is like so
r1 = r(1:U);
[psd,f]=pwelch(r1);
plot(f, 10*log10(psd));
From the documentaion it seems that I used pwelch incorrectly or not the way I wanted it, because the above syntax returns the normalized frequency as x-axis.
The one I think I need is the following
[pxx,f] = pwelch(x,window,noverlap,f,fs)
But I am not sure what I should use for windows, nooverlap, and f. I also want to calculate a similar result using fft directly on the segments. I do it as so
psd1 = abs(fft(r1)).^2/(fs*S);
where I know I need to normalize the power of the fft of the segment, but not sure how exactly.
How can I use these both methods (or any other built-in method other than pwelch) correctly in MATLAB?
0 个评论
回答(1 个)
Chunru
2022-9-16
% r1 = r(1:U);
U = 8192;
r1 = randn(U, 1) + 1i*randn(U,1); % complex baseband signal
fs = 10000;
fc = 2000;
nfft = 1024;
[pxx,f] = pwelch(r1,nfft, nfft*3/4, 1024, fs);
% win, overlap, nfft, fs
plot(f, 10*log10(pxx));
xline(fc)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!