This example shows how to write Simscape™ functions to compute numerical values with Simscape expressions and how to use Simscape functions to improve code reuse across components. The top two Simscape component blocks ( inside the "Use no Simscape functions" box ) are respectively created using two Simscape component files. Comparing these two component files, similar Simscape expressions can be observed on the right hand side of the equation to compute numerical values, which is essentially a modification of exp(i) to provide protection for large magnitude of i. Such expressions are common in standard diode modeling. Using Simscape functions, such expressions are abstracted out into a Simscape function file, and their usages inside the component files are replaced by calls to such Simscape functions. The bottom two Simscape component blocks ( inside the "Use Simscape functions" box ) are created using component files using Simscape functions.