Effacer les filtres
Effacer les filtres

I have 's' domain terms in matlab function block, used in simulink. How to use it?

3 vues (au cours des 30 derniers jours)
I am doing as simulation in matlab simulink. There i am using a matlab function block which contains "s" domain terms (i want to change it to Z domain ) but it is showing error " The function 'syms' is not supported for standalone code generation". The out of that function should be a signal.

Réponses (1)

Pravarthana P
Pravarthana P le 28 Sep 2022
Hi Shubham Mandve,
I understand that you are facing an issue while using MATLAB function block in Simulink. It can be due to using the symbolic variables or functions inside the MATLAB function block. A possible workaround can be:
To place the symbolic declarations and operations in a separate .m file and call that function from MATLAB function block as an extrinsic function.
For example, create a new .m file as,
function output = Syms_in_simulink(in)
syms x y
f = x*y+x*y^2;
output = subs(f,x,in);
output = double(output);
and call this file from MATLAB function block as
out = Syms_in_simulink(in);
For more information about extrinsic functions this documentation link can be helpful.
This workaround will likely work when ‘acceleration’ or ‘normal’ mode is used during code generation, because the ‘rapid acceleration’ mode during the code generation backing MATLAB execution engine is limited which is required to execute anything inside the symbolic toolbox.
The following documentation links can be helpful to understand the same further:
I hope this information helps you.


En savoir plus sur Simulink Coder dans Help Center et File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by