I have the attached equations in MATLAB FUNCTION. I want them in PLECS. I tried C script, but i don’t know C much. How to incorporate this in PLECS. Kindly suggest.

codeforplecs.m (622 Bytes)

I have the attached equations in MATLAB FUNCTION. I want them in PLECS. I tried C script, but i don’t know C much. How to incorporate this in PLECS. Kindly suggest.

codeforplecs.m (622 Bytes)

You cannot directly use a Matlab function to calculate the output of a block based on the simulation inputs. As you suggested, a C-Script block would be appropriate and is the most flexible option.

However, if you’re not familiar with C or the C-Script block, the simple arithmetic functions your example can be implemented using the “Function” block. For the sake of readability, you can break down your equation into a few Function blocks and connect them with other blocks such as multiply, sum, offset, etc.

See the attached example and screenshot.

function_example.plecs (7.53 KB)