Matlab Pwelch: Changing Units of Plot - Urgent Help

In summary, the conversation involves simulating vibrations in Simulink and processing the results in Matlab. The individual is trying to plot the power spectral density (PSD) for their acceleration results using the pwelch method. They are struggling with converting the results from dB/Hz to ms^-2 and also want to add a line of best fit to the plot. They are seeking advice on how to achieve these goals before the end of the day.
  • #1
19dan87
6
0
Hi,
I am simulating vibrations in simulink and processing my results in matlab. I am trying plot the PSD for my acceleration results using pwlech method.
When I plot the PSD plots from the methods below
(NOTE:I have a sampling rate of 0.006 so that means I am using a sample frequency of Fs=1/0.006=166)
Pwelch(x,[],[],2024,fs)
Or [Pxx,f]=pwelch(x,[],[],2024,fs) plot(f,Pxx)
The results on the Y axis are in the form of dB/Hz. How do I changed the plot/results so that I can plot PSD acceleration, ie. ms^-2 back . I want to show the plots in the form of the units used in the simulations.

Thanks
Dan
 
Physics news on Phys.org
  • #2
also I it would be best if I could show the results of the PSD plots as a smooth line by putting some kind of line of best git through the pwelch values obtained.

Any advice on the above 2 questions will be much appreciated since I have to find a way of doing this into show my results by the end of today.

Thanks

Dan
 

1. How do I change the units of my plot in Matlab Pwelch?

To change the units of your plot in Matlab Pwelch, you can use the 'units' parameter in the pwelch function. Simply specify the desired units (e.g. 'dB' for decibels) and the function will automatically convert the values accordingly.

2. Can I change the units of my plot after it has been created?

Yes, you can change the units of your plot after it has been created. Simply use the 'set' function and specify the 'units' property to the desired units. For example, if you want to change the units to decibels, you can use the following code: set(gca,'units','dB');

3. What are the available units for plotting in Matlab Pwelch?

There are various units that can be used for plotting in Matlab Pwelch, such as decibels (dB), linear (lin), power (pow), and log (log). You can also specify custom units by using the 'punits' parameter in the pwelch function.

4. How do I convert my plot to a different set of units in Matlab Pwelch?

To convert your plot to a different set of units in Matlab Pwelch, you can use the 'convert' function. This function takes in two parameters - the data to be converted and the desired units. For example, if you want to convert your plot to decibels, you can use the following code: convert(data, 'dB');

5. Can I plot my data in multiple units simultaneously in Matlab Pwelch?

Yes, you can plot your data in multiple units simultaneously in Matlab Pwelch. You can do this by using the 'plot' function and specifying the 'units' property for each data set. This will create multiple plots with different units on the same figure.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
735
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
8K
Back
Top