SysFreq Class Properties


Jump to: navigation, search
SysFreq Class Properties
Green carrot left.gif
sysFreq Class Example sysFreq Class Methods
Green carrot.jpg
In order to prevent spam, users must register before they can edit or create articles.

1 Introduction to sysFreq Class Properties

In Stochastic Controls there are essentially two parts to a frequency domain analysis. First, the disturbance and noise PSDs causing system error. Second, the system response. The system response is typically represented using a transfer function or state-space model.

In order to do a frequency domain analysis you must construct a frequency domain model (using transfer functions or state-space equations) to represent the system components. These components typically include

  • the plant or system to be controlled,
  • the feedback sensors, and
  • the controller or compensator.

These component models must then be connected to form the

  • open loop,
  • closed loop, and
  • disturbance rejection system models.

Then a standard disturbance PSD is applied to disturbance rejection model in order to determine residual error based on the disturbance at the plant's output. The influence of the noise PSD must be determined using the closed loop model. The 2 results are then RSS'd together determine the residual system error. This is fairly straight forward (if a little tedious) for simple SISO systems.

Even for simple SISO systems there are a few implementation issues to be aware of:

  1. The frequency vector of the PSD must be in the same units as the frequency vector of the system model.
  2. The elements of both the PSD and system model frequency vectors must be identical and the vectors must be the same size.
  3. The system model magnitude must be a raw magnitude for system response (to PSD) calculation - not in dB.
  4. MATLAB's bode command requires all frequency vector arguments be in rad/sec not Hz.

There are other implementation issues as well as these. All of the implementation issues are fiarly simple and straight forward to correct. However, it gets tedious fixing these issues for every analysis of every system since most real world systems are MIMO not SISO. Often the MIMO can be broken up into multiple decoupled SISO systems but then you have to add code or calls to helper function for each of these SISO models generated form the original MIMO.

2 sysFreq Class Properties

All of the property attributes that a MATLAB class can have may be found in the article: MATLAB 2009a Class Property Attributes.

The sysFreq Class object uses 3 types of property attributes:

  1. Public: These are the most commonly used and needed properties
  2. Private: These are read-only properties
  3. Hidden: These are read-write properties that you shouldn't need to change and won't show up when you type the variable for the class into the MATLAB command prompt

2.1 Display of the sysFreq Class

Let's sysFreq Class Instantiation class object:

 >> a = sysFreq(sys, [], 'Name', 'Test System');

Then the displayed properties and values are:

 >> a
              Name: 'Test System'
              Sys: [1x1 ss]
              InputType: 'Torque'
              OutputType: 'Angle'
              UnitBaseFreq: 'Hz'
              PlotFreqUnit: 'Hz'
              NumFreqPnts: 5000
              FreqVec: [1x5000 double]
              sysFreq_Version: 0.1000

In this case we did not provide a freqVec (2nd argument which is empty) but the class called MATLAB's bode function is order to determine a minimum and maximum frequency of interest. Then it created a vector of 5000 points (based on the NumFreqPnts default value of 5000).

2.2 Public Properties

Public properties are visible and settable via the property name - a.{Property} - such as:

 >> a.NumFreqPnts


 >> a.Name = 'My Test System';

Below is the MATLAB code for the Public properties of the sysFreq Class.

 %	---	Public Properties
     Name = ;
     Sys = ss();
     InputType = 'Torque';
     OutputType = 'Angle';
     UnitBaseFreq = 'Hz';
     PlotFreqUnit = 'Hz';
     NumFreqPnts = 5000;
     FreqVec = [];
   end % --- properties


  • Name: The name or description of the class. This is used in plotting and should describe the data in a unique manner.
  • Sys: LTI object representing the system model.
  • InputType: I work with Fast Steering Mirrors so the input is typically a torque around the CG of the mirror. If this were a system spring-mass-damper based on translational motion then input would be a force. If this were an electric motor then the input would probably be a current.
  • OutputType: For mirrors the output is an angular position of the mirror; for a spring-mass-damper it would be a translational position; and for a motor the output would probably be a torque.
  • UnitBaseFreq: Units for frequency vector. Valid values are 'Hz' and 'rad/sec'. Defaults to 'Hz'.
  • PlotFreqUnit: This property sets the frequency units desired on any output plot. It defaults to 'Hz' but can be changed to 'rad/sec'.
  • FreqVec: A vector of frequency values at which the system should be examined (evaluated in the case of getResponse or plot).
    • NumFreqPnts: An integer telling the class how many points should be in any FreqVec that the class must create. (Only used when you don't provided a full FreqVec.)

2.3 Private Properties

These properties are visible and returnable (i.e. a.clrs will return a value). However, the values of these properties can only be set by sysFreq class methods.

Below is the MATLAB code for the Private properties of the sysFreq Class.

 % --- Hidden Properties
   properties (Hidden)
     sys = ss();
     clrs = {'b', 'r', 'g', 'm', 'k', 'c'};
     lines = {'-', '-.', '--', '.-'};
   end	% --- properties (Hidden)


  • sys: This is a copy of the public Sys property necessary to allow people to get the LTI system when they've typed all lower case.
  • clrs: The colors (in order) that are used by the plot method.
  • lines: The line types (in order) that are used by the plot method.

2.4 Hidden Properties

Knowing the property name allows you to set them and return them. These properties are Hidden primarily because the user shouldn't need access to them.

Below is the MATLAB code for the Hidden properties of the sysFreq Class.

 % --- Private Properties
   properties (SetAccess = private)
     sysFreq_Version = 0.1;
   end	% --- properties (SetAccess private)


  • sysFreq_Version: Just a version number.

3 Notes

  • This class requires the Controls System Toolbox