getDiscreteStateSpecification
Get the size, data type, and complexity of the discrete state of a System object
Description
[
returns the size, data type, and complexity of the discrete state property. This property
must be a discrete state property.size
,dataType
,complexity
] = getDiscreteStateSpecification(obj
,propertyName
)
Examples
Check the specification of the discrete state of a System object
Call getDiscreteStateSpecification to get the size, data type, and complexity of the discrete state of a System object™.
Consider a System object object defined as,
classdef UnitDelay < matlab.System % UnitDelayNondirect Delay input by one time step properties(DiscreteState) State Step end methods(Access = protected) function resetImpl(obj) obj.State = 0; % Initialize states obj.Step = 1; end function [y1, y2] = stepImpl(obj,u) y1 = obj.State; % Output current state y2 = obj.Step; obj.State = u; obj.Step = obj.Step + 1; end function [sz1, sz2] = getOutputSizeImpl(obj) sz1 = [1,1]; % Specify size of output port sz2 = [1,1]; end function [flag1, flag2] = isOutputFixedSizeImpl(obj) flag1 = true; % Specify if output is fized size flag2 = true; end function [c1, c2] = getOutputDataTypeImpl(obj) c1 = 'double'; % Specify output datatype c2 = 'double'; end function [c1, c2] = isOutputComplexImpl(obj) c1 = false; % Specify if output is complex c2 = false; end function [sz,dt,cp] = getDiscreteStateSpecification(obj,name) sz = [1 1]; dt = "double"; cp = false; end end
Create an instance of the System object and provide it with an input.
a = UnitDelay(); [out, step] = a(1);
Call getDiscreteStateSpecification to check the specification of the 'Step' state.
[sz,dt,cp] = getDiscreteStateSpecification(a,"Step");
Input Arguments
obj
— System object
System object
System object handle used to access properties, states, and methods specific to the object.
propertyName
— Discrete state property name
property name
Name of discrete state property of the System object
Output Arguments
size
— Property size
[1 1]
(default) | numeric vector
Vector containing the length of each dimension of the property.
dataType
— Property data type
double
(default) | character vector
Data type of the property. For built-in data types, dataType
is
a character vector. For fixed-point data types, dataType
is a
numeric type object.
complexity
— Complexity of the property
false
(default) | true
Complexity of the property as a scalar, logical value:
true
— complexfalse
— real
Version History
Introduced in R2012a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)