addTolerance
Specify numeric tolerance for converted system
Description
addTolerance(
adds numeric tolerance data to a proposalSettings
,block_path
,port_index
,tolerance_type
,tolerance_value
)DataTypeWorkflow.ProposalSettings
object for the output signal specified by block_path
and
port_index
, with the tolerance type specified by
tolerance_type
and value specified by
tolerance_value
.
Examples
Specify Signal Tolerances
This example shows how to apply and remove tolerances from signals in a system. In this example, you add tolerances to a DataTypeWorkflow.proposalSettings
object, and then remove all tolerances from this object.
model = 'fxpdemo_feedback';
open_system(model);
Create a DataTypeWorkflow.ProposalSettings
object.
propSettings = DataTypeWorkflow.ProposalSettings;
Add an absolute tolerance of 0.05 to the output of the Down Cast block in the Controller subsystem.
addTolerance(propSettings, 'fxpdemo_feedback/Controller/Down Cast',1,'AbsTol',5e-2);
Add a relative tolerance of 1% to the same signal.
addTolerance(propSettings, 'fxpdemo_feedback/Controller/Down Cast',1,'RelTol',1e-2);
Use showTolerances
to see all tolerances associated with the proposal settings object.
showTolerances(propSettings)
Path Port_Index Tolerance_Type Tolerance_Value _________________________________________ __________ ______________ _______________ {'fxpdemo_feedback/Controller/Down Cast'} 1 {'AbsTol'} 0.05 {'fxpdemo_feedback/Controller/Down Cast'} 1 {'RelTol'} 0.01
Clear the tolerances stored in the ProposalSettings
object.
clearTolerances(propSettings)
Using showTolerances
, verify that there are no longer any tolerances stored in the ProposalSettings
object.
showTolerances(propSettings)
Path Port_Index Tolerance_Type Tolerance_Value ____ __________ ______________ _______________
Input Arguments
proposalSettings
— Object that contains proposal settings
DataTypeWorkflow.ProposalSettings
object
Object that contains proposal settings, specified as a
DataTypeWorkflow.ProposalSettings
object. You add tolerance
specifications to the DataTypeWorkflow.ProposalSettings
object.
block_path
— Path to block for which to add tolerance
character vector
Path to the block for which to add a tolerance to, specified as a character vector.
Data Types: char
| string
port_index
— Index of output port of block
scalar integer
Index of the output port of the blocks, specified as a scalar integer.
Data Types: double
tolerance_type
— Type of tolerance
'AbsTol'
| 'RelTol'
| 'TimeTol'
Type of tolerance, specified as one of these values:
'AbsTol'
– Absolute tolerance'RelTol'
– Relative tolerance'TimeTol'
– Time tolerance
Data Types: char
tolerance_value
— Acceptable difference between original output and output of new design
scalar double
Acceptable difference between the original output and the output of the new design, specified as a scalar double.
If tolerance_type
is set to 'AbsTol'
, then
tolerance_value
represents the absolute value of the maximum
acceptable difference between the original output and the output of the new
design.
If tolerance_type
is set to 'RelTol'
, then
tolerance_value
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 tolerance_type
is set to 'TimeTol'
, then
tolerance_value
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
Version History
Introduced in R2019a
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)