PsdData Class
From ControlTheoryPro.com

Contents
1 Introduction to psdData Class
In Stochastic Controls Power Spectral Densities (PSDs) are often used to represent or define disturbance and noise environments. However, there are several implementation issues that must be dealt with when using PSDs.
The basics of a PSD are as follows:
 The PSD is represented in MATLAB by a vector of frequencies and magnitudes at those frequencies.
 PSDs typically (but not always) have units of magnitude squared (^2) over Hz.
 The primary metric used to compare one PSD to another is the Root Mean Square (RMS).
 As with most metrics the RMS does not tell you everything.
 Particularly important is where in the frequency range does most of the PSD energy resides. More specifically, "Is the energy in the low, mid, or high frequency range by comparison to your designed rejection and performance requirements?"
Some of the PSD implementation issues are:
 PSD measurements are often very coarse particularly in the low frequencies. The result of this is that low frequency measurements might be at 0.01 Hz, 0.1 Hz, 1 Hz, 2 Hz, 5 Hz, 10 Hz, ... For noise PSDs this is not usually an issue. However, disturbance PSDs are often dominated by low frequency content. The RMS is an integration under the curve and coarse measurements often lead to inaccurate RMS calculations.
 Addition and subtraction of PSDs must occur at the same frequency and this often dictates the use of an interpolated PSD.
 Measured data comes in the form that is easiest to capture with the least noise. This often leads to measurements in rate (from good MEMS gyros) or acceleration (from good MEMS accelerometers). While the measurements are in rate or acceleration the disturbances that need to be in any simulation may need to be integrated to a position PSD.
The psdData class object is built in MATLAB 2009a. The purpose of the class is to encapsulate a number of useful functions and lessons learned when dealing with PSD as it relates to Control Systems. For controls we need to be able to plot the PSD, plot the RMS (forward and backward sums), and return the maximum RMS. Additional useful features of the psdData class are:
 Automatic conversion of Time Series data to a PSD
 1 line plotting of the PSD or the Time Series with annotation legends and proper units
 Overloaded methods for plus and minus
 Methods for integration and differentiation of the PSD (change a rate PSD to a position PSD or vice versa)
 Access to both the PSD and Time Series data in a single object
1.1 Additional psdData Class Information
 Examples of Usage
 psdData Properties
 psdData Methods
 Example of creaing psdData Class variables
 psdData Class Coding Notes
2 Download Here
3 Notes
 psdData assumes that any PSD provided to it is 1sided
 psdData creates 1sided PSDs from Time Series Data
 The integrate, differentiate, plus, and minus methods will provide results based on the PSD meaning that Time Series data is not present in the resulting psdData object (it will still be present in the original objects though)
 Calculation of the PSD from time series data requires the pwelch function and pwelch is part of the Signal Processing Toolbox.