## Import Symbolic Math Toolbox Equations

When designing a Simscape™ language component, you can use Symbolic Math Toolbox™ software to solve the physical equations and generate code in the format appropriate for the Simscape language equation section. Then, import the results by copying and pasting them into the equation section of a component file and declaring all the symbolic variables used in these equations. Suppose, you want to generate a Simscape equation from the solution of the following ordinary differential equation. As a first step, use the `dsolve` (Symbolic Math Toolbox) function to solve the equation:

```syms a y(t) Dy = diff(y); s = dsolve(diff(y, 2) == -a^2*y, y(0) == 1, Dy(pi/a) == 0); s = simplify(s)```

The solution is:

```s = cos(a*t)```

Then, use the `simscapeEquation` (Symbolic Math Toolbox) function to rewrite the solution in the Simscape language equation format:

`simscapeEquation(s)`

`simscapeEquation` generates the following code:

```ans = s == cos(a*time);```

Copy and paste the generated code into the equation section of a component file:

```component MyComponent equations s == cos(a*time); end end ```

Make sure the declaration section of the component file contains all the symbolic variables used in these equations. You can declare these symbolic variables as Simscape language variables, parameters, inputs, or outputs, depending on their physical function and your intended block design.

```component MyComponent inputs a = {1,'m/s'}; end outputs s = {0,'m'}; end equations s == cos(a*time); end end ```