0 votes

Hello and thank you for your question. PLECS Standalone cannot evaluate Octave functions (like fsolve) during runtime, but rather only during initialization. Further, the C-Script block cannot use a MATLAB function. In order to use the MATLAB's fsolve function here, you will need to use Simulink and PLECS Blockset. If you are PLECS student user, you have access to PLECS Blockset in addition to PLECS Standalone. Thanks!

0 votes

The problem stated in your example model looks a bit strange: Why would you want to modify the *starting point* x0 for the call to fsolve during the simulation?

I suspect that you rather want to solve a *parameterised* set of equations like the following

- C*x
_{1}- x_{2}- exp(-x_{1}) = 0 - -x
_{1}+ C*x_{2}- exp(-x_{2}) = 0

with C being a parameter that you wish to vary throughout the simulation.

This can be done using the Algebraic Constraint block introduced in PLECS 4.1. Please see the attached model. The two Function blocks implement the left hand sides of the two equations with u(1) and u(2) representing x_{1} and x_{2} and u(3) representing the parameter C. The Algebraic Constraint block finds x_{1} and x_{2} such that the Function blocks will output 0.

...