0
votes

I would like to create a Symbolic function within a Simulink Matlab Function to solve the variables h and t1. Matlab produces error "The function 'syms' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation." when I try to compile the Simulink Matlab function with the following code.

syms Eq1(h,t1);
Eq1(h,t1) = h*t1;

I tried adding "coder.extrinsic('syms')" at the top, as shown below, and this generated the error "Undefined function or variable 'h'."

coder.extrinsic('syms');
syms Eq1(h,t1);
Eq1(h,t1) = h*t1;

How do I use symbolic variables and functions (Syms) in a Simulink Matlab Function?

1

1 Answers

1
votes

It might be possible to fix the "Undefined function or variable 'h'." using sym instead of syms, but then the coder will tell you it can't generate code for symbolic variables. You have to declare everything which uses the symbolic toolbox to be extrinsic. Simplest way: Put everything into a function and declare this function to be extrinsic.