evalRequirement
Class: sdo.requirements.MonotonicVariable
Package: sdo.requirements
Evaluate satisfaction of monotonic variable requirement
Syntax
evaluation = evalRequirement(requirement,variableData)
Description
evaluates
whether the test data, evaluation
= evalRequirement(requirement
,variableData
)variableData
, satisfy
the monotonic variable requirement that is specified in the requirement
object.
A positive evaluation
value indicates that the
requirement has been violated.
Input Arguments
requirement
— Monotonic variable requirement
sdo.requirements.MonotonicVariable
object
Monotonic variable requirement, specified as an sdo.requirements.MonotonicVariable
object.
In the object, you specify the monotonicity required for each dimension
of the variable in requirement.Type
.
variableData
— Variable data to be evaluated
vector | matrix | array
Variable data to be evaluated, specified as a real numeric vector, matrix, or multidimensional array.
Output Arguments
evaluation
— Evaluation of the monotonic requirement
column vector
Evaluation of the monotonic requirement, returned as a column
vector. The number of elements in evaluation
is
the same as the number of dimensions in variableData
.
A positive value in the vector indicates that the requirement has
been violated for the corresponding dimension of the variableData
.
The magnitude of evaluation
corresponds to the
difference between two successive elements that come closest to violating
the requirement. For an example, see Evaluate a Monotonic Variable Requirement.
Examples
Evaluate a Monotonic Variable Requirement
Create a requirement object with default properties.
Requirement = sdo.requirements.MonotonicVariable;
Specify the requirement type for a 1-dimensional variable as monotonically decreasing.
Requirement.Type = {'>'};
Specify test data for a 1-dimensional variable.
Data = [20; 15; 25; 26];
Evaluate if the test data satisfies the requirement.
Evaluation = evalRequirement(Requirement,Data)
Evaluation = 10
Since Evaluation
is a positive number, it shows that the requirement is violated. To understand the magnitude of Evaluation
, consider the elements of the test data. While 20>15 satisfies the '>' requirement, 15<25 and 25<26 violate the requirement, resulting in a positive Evaluation
value. Because the elements 15 and 25 violate the requirement the most, the magnitude of Evaluation
is 10, the difference between these elements.
Evaluate Monotonic Variable Requirement for a Multidimensional Variable
Create a requirement object, and specify the monotonicity for a 2-dimensional variable.
Requirement = sdo.requirements.MonotonicVariable('Type',{'<','>'});
The object requires the elements in the first dimension of the variable to be monotonically increasing and the elements in the second dimension to be monotonically decreasing.
Specify 2-dimensional test data for the variable.
Data = [10 5; 20 24;30 33];
Evaluate if the test data satisfies the requirement.
Evaluation = evalRequirement(Requirement,Data)
Evaluation = 2×1
-9
4
Evaluation
is column vector with size corresponding to the dimensions of the test data.
To understand the magnitude of Evaluation
, consider the elements of the test data along each dimension. For the first dimension of the test data, going down the rows, the software checks the '<' requirement. Since 10<20<30 and 5<24<33 both satisfy the requirement, Evaluation(1)
is a negative number. Because 24<33 comes closest to violating the requirement, the magnitude of Evaluation
for this dimension is 9, the difference between these two elements.
For the second dimension of the test data, going across the columns, the software checks, the '>' requirement. While 10>5 satisfies the requirement, 20<24 and 30<33 do not satisfy the requirement. This results in Evaluation(2)
being a positive number, indicating that the requirement is not satisfied. Because the elements 20 and 24 violate the requirement the most, the magnitude of Evaluation(2)
is 4, the difference between these elements.
Version History
Introduced in R2016b
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)