I have 's' domain terms in matlab function block, used in simulink. How to use it?
5 次查看(过去 30 天)
显示 更早的评论
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.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1122455/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1122455/image.png)
0 个评论
回答(1 个)
Pravarthana P
2022-9-28
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);
end
and call this file from MATLAB function block as
coder.extrinsic('Syms_in_simulink');
out = Syms_in_simulink(in);
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!