- You can add a model callback function (Initialization/PreLoad/PostLoad) which solves the non linear equation you have using the 'fzero' function. You can then assign the solution to a variable which can then be assigned to a runtime parameter of your custom Simscape block. The Simscape parameter can be used in the equations section. You can refer to the help documentation for "model callbacks" to learn how to add a model callback function.
- If you are using R2019b or newer version of Simulink and Simscape, you can also use initial equations in the Simscape language. Initial equations in Simscape lets you specify additional equations that are executed during model initialization only. You can obtain the solution for the non-linear equation through the initial equations and use the solution with other equations. However, there might be some limitations to the equations that can be solved. Your code for the custom Simscape block might look like this
