Refer to this question for a solution:https://ch.mathworks.com/matlabcentral/answers/154695-how-to-use-symbolic-variables-and-functions-syms-in-a-simulink-matlab-function.
In short: with a matlab function block + one of the methods cited in the linked question