Main Content

jc_0803: Passing values to library functions

Since R2020a

Guideline Publication

Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®

Sub ID Recommendations

  • NA-MAAB — a1/a2, b1/b2, c1/c2,

  • JMAAB — a1/a2, b1/b2, c1/c2, d1/d2

MATLAB Versions

All

Rule

Sub ID a1

A minimum value for the signed integer type shall not be provided when using the abs library function.

Custom Parameter

Not Applicable

Example — Correct

Example — Incorrect

Sub ID a2

The abs library function shall not be used.

Custom Parameter

Not Applicable

Sub ID b1

A negative number shall not be entered when using the sqrt library function.

Custom Parameter

Not Applicable

Example — Correct

Example — Incorrect

Sub ID b2

The sqrt library function shall not be used.

Custom Parameter

Not Applicable

Sub ID c1

A negative number shall not be entered when using the log and log10 library functions.

Custom Parameter

Not Applicable

Example — Correct

Example — Incorrect

Sub ID c2

The log and log10 library functions shall not be used.

Custom Parameter

Not Applicable

Sub ID d1

Zero shall not be entered for the second argument when using the fmod library function.

Custom Parameter

Not Applicable

Example — Correct

Example — Incorrect

Sub ID d2

The fmod library function shall not be used.

Custom Parameter

Not Applicable

Rationale

Sub IDs a1, b1, c1, d1:

  • The behavior of a library function when an invalid value has been passed is dependent on the processing system and may result in unintended behavior.

Sub IDs a2, b2, c2, d2:

  • To avoid duplicate modelling of the same guard process in Simulink and Stateflow, use Simulink to perform arithmetic operations

Verification

Model Advisor check: Adherence to this modeling guideline cannot be verified by using a Model Advisor check.

Last Changed

R2020a

See Also

Version History

Introduced in R2020a