matlab.System.isInputDirectFeedthroughImpl - Direct feedthrough status of input - MATLAB (original) (raw)
Direct feedthrough status of input
Syntax
[flag1,...,flagN] = isInputDirectFeedthroughImpl(obj) [flag1,...,flagN] = isInputDirectFeedthroughImpl(obj,input,input2,...)
Description
[[flag1,...,flagN](#bt2mgz5-flag1flagN)] = isInputDirectFeedthroughImpl([obj](#bt2mgz5%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8))
specifies whether each input is a direct feedthrough input. If direct feedthrough istrue
, the output depends on the input at each time instant.
[[flag1,...,flagN](#bt2mgz5-flag1flagN)] = isInputDirectFeedthroughImpl([obj](#bt2mgz5%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8),`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 support | Uses a propagation Impl method | Simulink Code Generation Result |
---|---|---|
Y | N | Simulink automatically infers the direct feedthrough settings from the System object code. |
Y | Y | Simulink does not automatically infer the direct feedthrough settings. Instead, it uses the value returned by theisInputDirectFeedthroughImpl method. |
N | — | Default isInputDirectFeedthroughImpl method returns false, indicating that direct feedthrough is not enabled. To override the default behavior, implement theisInputDirectFeedthroughImpl 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
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
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 tostepImpl
, outputImpl
, orupdateImpl
).
Examples
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