Main Content

evalRequirement

Class: sdo.requirements.MonotonicVariable
Package: sdo.requirements

Evaluate satisfaction of monotonic variable requirement

Syntax

evaluation = evalRequirement(requirement,variableData)

Description

evaluation = evalRequirement(requirement,variableData) evaluates whether the test data, 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

expand all

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.

Variable data to be evaluated, specified as a real numeric vector, matrix, or multidimensional array.

Output Arguments

expand all

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

expand all

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.

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.

Introduced in R2016b