how to plot psd versus frequency

6 次查看(过去 30 天)
vincent lin
vincent lin 2020-1-17
I have file with format t, I, Q
#% Time (s) I Channel (V) Q Channel (V)
xx=[+0.0000000000E+00 +1.3265187530E-02 -1.5107325599E-02
+2.0345052083E-09 +7.4751380907E-03 -2.0936643962E-02
+4.0690104167E-09 -1.7931125163E-03 -2.2093545044E-02
+6.1035156250E-09 -1.1648589721E-02 -1.7382003350E-02];
xx=(xx(:,2).'+j*xx(:,3).');
Sampling frequency is 1/2.0345052083E-09. how can I plot the spectrum versus frequency?
[pxx, w] = periodogram(xx);
plot(w,10*log10(pxx));
gives me strange plot, with middle empty and two sides have spectrum. Also how to get the integrated band power from frequency freq_a to freq_b?

回答(1 个)

Hiro Yoshino
Hiro Yoshino 2020-1-17
[pxx, w] = periodogram(xx);
gives you the PSD (pxx) and the normalized frequency (w).
If you are falimiar with the theory, you can convert it into the frequency of your expectation as follows:
is the formula. N is the number of samples.
If not, the best bet is
[pxx, w] = periodogram(xx, fs);
where fs is the sampling frequency and w is the converted frequency.
Also, you should look into how PSD is calculated and it would help you understand how the PSD data are sorted.
You cannot expect something you find in your text book to appear.
If you do not have time to learn it, then you can just copy the way it is used:

类别

Help CenterFile Exchange 中查找有关 Parametric Spectral Estimation 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by