WOLFRAM SYSTEM MODELER
ExperimentalRelationSafe |
SystemModel["SystemModelerExtras.Experimental.Units.Examples.ExperimentalRelationSafe"]
Using inUnit to adapt a polynomial fitted to experimental data for use in a model with units. This example is a more unit-safe variant of ExperimentalRelation.
Here, the experimental relation is represented as the function fittedPolynomial, where inputs and outputs have corresponding to the experimental data. By internally converting to unit "1" inside the function, the polynomial fitted to the experimental data can easily be expressed. By keeping the sensitive conversions to and from the units of the experimental relation inside fittedPolynomial, more unit safety is obtained compared to ExperimentalRelation where conversions happen at the place of calling fittedPolynomial. For example, ExperimentalRelation would not detect a problem if the experimental relation would change from "cm2" to "mm2" without changing the code at every call site.