Skip to Main Content Skip to Search
Product Documentation

Create System Objects

System objects are MATLAB object-oriented implementations of algorithms. They extend MATLAB by enabling you to model dynamic systems represented by time-varying algorithms. System objects are well integrated into the MATLAB language, regardless of whether you are writing simple functions, working interactively in the command window, or creating large applications.

In contrast to MATLAB functions, System objects automatically manage state information, data indexing, and buffering, which is particularly useful for iterative computations or stream data processing. This enables efficient processing of long data sets.

System objects support fixed-point arithmetic. To use 64-bit data types, you must have Fixed-Point Toolbox™ software. System objects also support C-code generation from MATLAB and Simulink. With System objects, you can optionally generate code to target the desktop or external hardware. You can use System objects in Simulink® models via the MATLAB Function block. You can compile code that contains System objects within MATLAB functions using MATLAB Compiler™ software. (The compiler product does not support System objects in MATLAB scripts.)

Create a System Object

To use System objects, you must first create an object. For example,

H = dsp.FFT         % Create default FFT object, H

% Create input data
Fs = 1000;           % Sampling frequency
T = 1/Fs;            % Sample time
L = 1024;            % Length of signal
t = (0:L-1)*T        % Time vector

% Sum of two sinusoids
X = 0.7*sin(2*pi*50*t.') + sin(2*pi*120*t.'); 

Define a New System Object

You can define a System object to implement your algorithm. For information and examples, see .

Change a System Object Property

In general, you should set the object properties before you use the step method to run data through the object. To change the value of a property, use this format,

H.Normalize = true  % Set the Normalize property

The property values of the FFT object, H, are displayed.

Run a System Object

To execute a system object, use the step method.

Y = step(H,X);       % Process input data, X

The output data from the step method is stored in Y, which, in this case, is the FFT of X.

Display Available System Objects

To see a list of all the System objects for a particular package, type help comm. To display help for specific objects, properties, or methods, see Find Help and Demos for System Objects .

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS