Additional Data Types


IMAT has defined additional data types beyond the ones presented so far. A subset of these is presented here.

FCN

The fcn data type is a function data type designed specifically for Vibrata, ATA's Response Simulation product. It is a subclass of imat_fn, which means that it inherits all of the properties and methods of imat_fn. This means that all of the imat_fn properties are also properties of fcn, and all of the imat_fn methods that are not specifically overloaded for fcn will also work. This also means that the Function Reference and Data Attribute Reference in this User Guide for imat_fn also apply to fcn.

fcn extends imat_fn to add several properties. These properties are described here.

To see what methods are available for fcn, use this command:

>> methods(fcn)

To see the help for a specific fcn method, type

>> help fcn/<method_name>            % or use 'doc', and put in the actual method name for <method_name>

Some IMAT functionality has specific understanding of fcn objects, and will tailor their functionality to fcn -specific properties. For example, uiplot recognizes fcn and displays functions in the list by Name rather than by reference/response coordinate and IDLine1, which is what it displays for imat_fn. It can also import and export .fcn files directly through its interface.

The fcn constructor accepts the same input arguments as the imat_fn constructor. For example, to create a 4x1 fcn and set its FunctionType to 'Frequency Response Function', use the following command.

>> f = fcn(4,'FunctionType','Frequency Response Function')

f =

(4x1) FCN with the following attributes:
Row  Name        FunctionType                 NumberElements  IDLine1
---  ----------  ---------------------------  --------------  -------
  1  Function 1  Frequency Response Function  0
  2  Function 2  Frequency Response Function  0
  3  Function 3  Frequency Response Function  0
  4  Function 4  Frequency Response Function  0

To convert between imat_fn and fcn, simply pass your variable through the appropriate constructor. See below for an example. When you convert an fcn to an imat_fn, you will lose the FCN-specific properties. When you convert an imat_fn to an fcn, the FCN-specific properties will be given default values.

>> f_i = imat_fn(3)           % Create a 3x1 imat_fn

f_i =

3x1 IMAT Function with the following attributes:
Record Name                 FunctionType     AbscissaSpacing  NumberElements
--------------------------- ---------------- ---------------- ----------------
1_(1X+,1X+)                 Time Response    Even             0
2_(1X+,1X+)                 Time Response    Even             0
3_(1X+,1X+)                 Time Response    Even             0

>> f_i.ResponseNode = 1:3     % Set an imat_fn property (which is therefor also a FCN-specific property)

f_i =

3x1 IMAT Function with the following attributes:
Record Name                 FunctionType     AbscissaSpacing  NumberElements
--------------------------- ---------------- ---------------- ----------------
1_(1X+,1X+)                 Time Response    Even             0
2_(1X+,2X+)                 Time Response    Even             0
3_(1X+,3X+)                 Time Response    Even             0

>> f_f = fcn(f_i)             % Convert the imat_fn to an FCN--default values are set for the FCN-specific properties

f_f =

(3x1) FCN with the following attributes:
Row  Name           FunctionType   NumberElements  IDLine1
---  -------------  -------------  --------------  -------
  1  1_(1X+,1X+)_1  Time Response  0
  2  2_(1X+,2X+)_1  Time Response  0
  3  3_(1X+,3X+)_1  Time Response  0

>> f_f.Name = 'My function'   % Set a FCN-specific property

f_f =

(3x1) FCN with the following attributes:
Row  Name         FunctionType   NumberElements  IDLine1
---  -----------  -------------  --------------  -------
  1  My function  Time Response  0
  2  My function  Time Response  0
  3  My function  Time Response  0

>> f_i2 = imat_fn(f_f);      % Create a 3x1 imat_fn

f_i2 =

3x1 IMAT Function with the following attributes:
Record Name                 FunctionType     AbscissaSpacing  NumberElements
--------------------------- ---------------- ---------------- ----------------
1_(1X+,1X+)                 Time Response    Even             0
2_(1X+,2X+)                 Time Response    Even             0
3_(1X+,3X+)                 Time Response    Even             0

Loading and Saving FCN

The fcn object defines several properties in addition to the imat_fn properties. These properties cannot be stored in a Universal file (UNV) or Associated Data File (ADF), so we utilized a different file format so that round-tripping fcn objects would not lose any information. The .fcn file is a MATLAB .mat file that contains specific information related to the fcn and how to process it. This includes units information, so that importing a .fcn into MATLAB when IMAT has been set to use a different units system from the one used to create the .fcn will properly convert the fcn data to the current units system.

To load fcn objects from a .fcn file, use the load method. This is an fcn method, so for MATLAB to recognize that you want to use this method, and not the MATLAB built-in load function, you must pass in an fcn object as the first input argument. If you do not pass in a filename, you will be prompted for one. Some examples of load usage are provided below.


>> f = load(fcn);              % You will be prompted for the .fcn file to load

>> f = load(fcn,'file.fcn');

>>

To save an fcn to a .fcn file, use the save method. Since you are passing in an fcn object as one of the input arguments, MATLAB understands that you want to use the FCN's save method instead of its built-in save function.


>> save(fcn);                  % You will be prompted for the .fcn file to write to

>> save(fcn,'file.fcn');

>>

 


Previous

Next