addTolerance
Class: fxpOptimizationOptions
Specify numeric tolerance for optimized system
Syntax
addTolerance(options,blockPath,portIndex,tolType,tolValue)
addTolerance(options,blockPath,portIndex,tolType,tolValue,'LoggingInfo',logInfo)
Description
addTolerance(
specifies a numeric tolerance for the output signal specified by
options
,blockPath
,portIndex
,tolType
,tolValue
)blockPath
and portIndex
, with the
tolerance type specified by tolType
and value specified by
tolValue
.
addTolerance(
specifies a tolerance and options for logging information with options
,blockPath
,portIndex
,tolType
,tolValue
,'LoggingInfo',logInfo
)Simulink.SimulationData.LoggingInfo
.
Input Arguments
options
— Associated fxpOptimizationOptions
object
fxpOptimizationOptions
fxpOptimizationOptions
object to add a tolerance
specification.
blockPath
— Path to block for which to add tolerance
block path name
Path to the block to add a tolerance to, specified as a character vector.
Data Types: char
| string
portIndex
— Index of output port of block
scalar integer
Index of output port of the block specified by
blockPath
for which you want to specify a
tolerance, specified as a scalar integer.
Data Types: double
tolType
— Type of tolerance to specify
'AbsTol'
| 'RelTol'
| 'TimeTol'
Type of tolerance to add to the port indicated specified as either
absolute tolerance, 'AbsTol'
, relative tolerance,
'RelTol'
, or time tolerance,
'TimeTol'
.
Data Types: char
tolValue
— Difference between the original output and the output of the new design
scalar double
Acceptable level of tolerance for the signal specified by
blockPath
and
portIndex
.
If tolType
is set to 'AbsTol'
,
then tolValue
represents the absolute value of the
maximum acceptable difference between the original output, and the output of
the new design.
If tolType
is set to 'RelTol'
,
then tolValue
represents the maximum relative
difference, specified as a percentage, between the original output, and the
output of the new design. For example, a value of 1e-2
indicates a maximum difference of one percent between the original output,
and the output of the new design.
If tolType
is set to 'TimeTol'
,
then tolValue
defines a time interval, in seconds, in
which the maximum and minimum values define the upper and lower values to
compare against.
For more information, see How the Simulation Data Inspector Compares Data.
Data Types: double
'LoggingInfo',logInfo
— Optional signal logging settings
Simulink.SimulationData.LoggingInfo
object
Optional signal logging settings, specified as a name-value pair where
logInfo
is a Simulink.SimulationData.LoggingInfo
object. Use this input
argument to specify a Decimation value to control the amount of
data logged by the Simulation Data Inspector.
Example: logInfo = Simulink.SimulationData.LoggingInfo();
logInfo.DecimateData = true; logInfo.Decimation = 10;
addTolerance(options,
'model/blockPath',2,'AbsTol',1,'LoggingInfo',logInfo);
Examples
Specify required numeric tolerance for optimized system
Load the system for which you want to optimize the data types.
load_system('ex_auto_gain_controller');
Create a fxpOptimizationOptions
object with default property values.
options = fxpOptimizationOptions;
To specify a required numeric tolerance to use during the optimization process, use the addTolerance
method of the fxpOptimizationOptions
object. To specify several tolerance constraints, call the method once per constraint. You can specify either relative, or absolute tolerance constraints.
addTolerance(options, 'ex_auto_gain_controller/output_signal', 1, 'AbsTol', 5e-2); addTolerance(options, 'ex_auto_gain_controller/input_signal', 1, 'RelTol', 1e-2);
Use the showTolerances
method to display all tolerance constraints added to a specified fxpOptimizationOptions
object.
showTolerances(options)
Path Port_Index Tolerance_Type Tolerance_Value _________________________________________ __________ ______________ _______________ {'ex_auto_gain_controller/output_signal'} 1 {'AbsTol'} 0.05 {'ex_auto_gain_controller/input_signal' } 1 {'RelTol'} 0.01 ans = 2x4 table Path Port_Index Tolerance_Type Tolerance_Value _________________________________________ __________ ______________ _______________ {'ex_auto_gain_controller/output_signal'} 1 {'AbsTol'} 0.05 {'ex_auto_gain_controller/input_signal' } 1 {'RelTol'} 0.01
Version History
Introduced in R2018aR2021b: Change in syntax for fxpOptimizationOptions.addTolerance
Behavior changed in R2021b
In previous releases, you specified options for logging information with a
Simulink.SimulationData.LoggingInfo
object as:
addTolerance(options,blockPath,portIndex,tolType,tolValue,loggingInfo)
Starting in R2021b, you must now specify logging information as a name-value pair:
addTolerance(options,blockPath,portIndex,tolType,tolValue,'LoggingInfo',logInfo)
See Also
Classes
Functions
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)