Main Content

isInputDirectFeedthroughImpl

Direct feedthrough status of input

Syntax

[flag1,...,flagN] = isInputDirectFeedthroughImpl(obj)
[flag1,...,flagN] = isInputDirectFeedthroughImpl(obj,input,input2,...)

Description

[flag1,...,flagN] = isInputDirectFeedthroughImpl(obj) specifies whether each input is a direct feedthrough input. If direct feedthrough is true, the output depends on the input at each time instant.

[flag1,...,flagN] = isInputDirectFeedthroughImpl(obj,input,input2,...) uses one or more of the System object input specifications to determine whether inputs have direct feedthrough.

If you do not include the isInputDirectFeedthroughImpl method in your System object™ class definition file, all inputs are assumed to be direct feedthrough.

Code Generation

The following cases describe when System objects in Simulink® code generation use direct or nondirect feedthrough.

System object's code generation supportUses a propagation Impl methodSimulink Code Generation Result
YN

Simulink automatically infers the direct feedthrough settings from the System object code.

YYSimulink does not automatically infer the direct feedthrough settings. Instead, it uses the value returned by the isInputDirectFeedthroughImpl method.
N

Default isInputDirectFeedthroughImpl method returns false, indicating that direct feedthrough is not enabled. To override the default behavior, implement the isInputDirectFeedthroughImpl method in your class definition file.

Run-Time Details

isInputDirectFeedthroughImpl is called by the MATLAB System block.

Method Authoring Tips

  • You must set Access = protected for this method.

  • You cannot modify, implement, or access tunable properties in this method.

  • Do not use the input values of the System object in this method if you intend to use the System object in Simulink using the MATLAB System block. You can only query the inputs for their specifications namely data type, complexity and size.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your isInputDirectFeedthroughImpl method does not use the object, you can replace this input with ~.

Inputs to the algorithm (stepImpl) of the System object. The inputs list must match the order of inputs in the stepImpl signature.

Output Arguments

expand all

Logical value, either true or false indicating whether the input is direct feedthrough. The number of output flags must match the number of inputs to the System object (inputs to stepImpl, outputImpl, or updateImpl).

Examples

expand all

Use isInputDirectFeedthroughImpl in your class definition file for marking all inputs as nondirect feedthrough.

methods (Access = protected)
   function flag = isInputDirectFeedthroughImpl(~)
      flag = false;
   end
end

Complete Class Definition

classdef intDelaySysObj < matlab.System 
   % intDelaySysObj Delay input by specified number of samples.

   properties
      InitialOutput = 0;
   end
   properties (Nontunable)
      NumDelays = 1;
   end
   properties (DiscreteState)
      PreviousInput;
   end

   methods (Access = protected)
      function validatePropertiesImpl(obj)
         if ((numel(obj.NumDelays)>1) || (obj.NumDelays <= 0))
            error('Number of delays must be > 0 scalar value.');
         end
         if (numel(obj.InitialOutput)>1)
            error('Initial Output must be scalar value.');
         end
      end

      function setupImpl(obj)
         obj.PreviousInput = ones(1,obj.NumDelays)*obj.InitialOutput;
      end
      
      function resetImpl(obj)
         obj.PreviousInput = ones(1,obj.NumDelays)*obj.InitialOutput;
      end
      
      function [y] = outputImpl(obj,~)
         y = obj.PreviousInput(end);
      end
      function updateImpl(obj, u)
         obj.PreviousInput = [u obj.PreviousInput(1:end-1)]; 
      end
      function flag = isInputDirectFeedthroughImpl(~)
         flag = false;
      end
   end
end 

Version History

Introduced in R2013b