Plotting Power Spectrum Density in Matlab

In summary, to plot power spectrum density in Matlab, the <code>pwelch</code> function can be used. This function calculates the power spectrum density using Welch's method and allows for customization of parameters such as window type, window length, and overlap. Power spectral density (PSD) and power spectrum are different measures of power distribution in a signal, with PSD representing power per unit frequency and power spectrum showing power at specific frequencies. A PSD plot can be interpreted by identifying peaks, patterns, and trends, and the total power in the signal can be determined by the area under the curve. The <code>pwelch</code> function in Matlab also allows for comparison of PSD between two signals, and accuracy can be
  • #1
yongs90
6
0

Homework Statement


I have an autocorrelation function given by
R([itex]\tau[/itex]) = [itex]J_0[/itex](2[itex]\pi[/itex][itex]f_d[/itex][itex]\tau[/itex])

I have already plotted it in Matlab using the following commands
ts=0.0000001;
fs=1/ts;
fd=100;

tau=0:0.0000001:0.05;
R=besselj(0,2*pi*fd.*tau);

How do I plot its PSD in Matlab and the plotted picture looks like this:
http://www.mypicx.com/09032011/Temp/

Homework Equations


The Attempt at a Solution


When I use the command pwelch(R), it just won't yield the picture.
http://www.mypicx.com/09032011/blabla/

I will obtain something different. How do I scale it so that I will resemble the picture given. thanks
 
Last edited:
Physics news on Phys.org
  • #2


Hello,

In order to plot the PSD (power spectral density) of your autocorrelation function in Matlab, you can use the command pwelch as you have mentioned. However, in order to obtain a plot similar to the one given in the forum post, you will need to specify the sampling frequency and the window length for the pwelch command.

The sampling frequency can be specified by using the 'Fs' parameter, and the window length can be specified by using the 'N' parameter. For example, you can use the following command to obtain a similar plot:

pwelch(R,[],[],[],fs,'onesided')

The 'onesided' parameter ensures that only the positive frequencies are plotted, which is the case in the given picture. You can also play around with the 'N' parameter to obtain a smoother or more detailed plot.

I hope this helps. Let me know if you have any further questions.
 

Related to Plotting Power Spectrum Density in Matlab

1. How do I plot power spectrum density in Matlab?

To plot power spectrum density in Matlab, you can use the pwelch function. This function takes in a signal and calculates its power spectrum density using Welch's method. The resulting plot can be customized with various parameters such as window type, window length, and overlap.

2. What is the difference between power spectral density and power spectrum?

Power spectral density (PSD) is a measure of the power distribution of a signal with respect to frequency. It represents the power per unit frequency and is often used in the analysis of signals that are not stationary. On the other hand, power spectrum is a measure of the power of a signal at specific frequencies. It is calculated by taking the squared magnitude of the Fourier transform of a signal. In Matlab, the pwelch function calculates and plots the PSD.

3. How do I interpret a power spectrum density plot?

A power spectrum density plot shows the distribution of power in a signal with respect to frequency. The peaks in the plot indicate the frequencies with the highest power, while the overall shape of the plot can help identify any underlying patterns or trends in the signal. Additionally, the area under the curve represents the total power in the signal.

4. Can I compare the power spectrum density of two signals in Matlab?

Yes, you can compare the power spectrum density of two signals in Matlab using the pwelch function. By plotting both signals on the same graph, you can visually compare their power distribution and identify any similarities or differences. You can also use statistical tests, such as the Welch's t-test, to determine if the differences in the power spectrum density of the two signals are significant.

5. How can I improve the accuracy of my power spectrum density plot in Matlab?

There are a few ways to improve the accuracy of a power spectrum density plot in Matlab. First, you can increase the window length and/or overlap in the pwelch function to reduce spectral leakage. Additionally, you can try using different window types, such as Hamming or Blackman, to see which one gives the best results for your signal. Finally, it is important to ensure that your signal is properly pre-processed, such as removing any trends or artifacts, before calculating the power spectrum density.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
24K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Replies
3
Views
2K
  • Cosmology
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
Back
Top