Define Composite System Objects
This example shows how to define System objects that include other System objects.
Define a bandpass filter System object from separate highpass and lowpass filter System
objects.Store System Objects in PropertiesTo define a System object from other System objects, store those other objects in your
class definition file as properties. In this example, the highpass and lowpass filters are the
separate System objects defined in their own class-definition files.properties (Access = private)
% Properties that hold filter System objects
pLowpass
pHighpass
endComplete Class Definition File of Bandpass Filter Composite System Objectclassdef BandpassFIRFilter < matlab.System
% Implements a bandpass filter using a cascade of eighth-order lowpass
% and eighth-order highpass FIR filters.properties (Access = private)
% Properties that hold filter System objects
pLowpass
pHighpass
endmethods (Access = protected)
function setupImpl(obj)
% Setup composite object from constituent objects
obj.pLowpass = LowpassFIRFilter;
obj.pHighpass = HighpassFIRFilter;
endfunction yHigh = stepImpl(obj,u)
yLow = obj.pLowpass(u);
yHigh = obj.pHighpass(yLow);
endfunction resetImpl(obj)
reset(obj.pLowpass);Define Composite System Objects