Why should I use operation blocks instead of a quicker function block in simulink?

17 次查看(过去 30 天)
  • I am newbie with this, I´m just testing with the simulink features and when trying to make some operations , find it more difficult to use simple operation blocks instead of a simulink function block which could encompass all this with code and gives me straight away the output, any drawback in doing so? Btw ,i am doing just a differential equation which could be done with matlab too, and the same question regarding to matlab, why using operation blocks instead some code? . My final aim is to simulate a 3 in series reactors and then a distillation column and thats a bunch of differential equations with simple operations ,so whats is more convenient for that?. Thanks in advance.
  • Drop some pics of what i am adressing to:
  • Could use function blocks, but what is the negative side of doing this?
  • Instead of that i find cumbersome:

回答(1 个)

Jim Riggs
Jim Riggs 2022-11-10
You might want to check out this documentation on Comparison of Custom Block Functionality.
It references some limitations on Matlab function blocks being able to represent model states. In particular, the Matlab function is only able to model discrete states (using persistent variables) - i.e. no continuous states. This is because callback methods are not allowed (see the link, above)
I tried both of your model architectures, and my experience is that the one using the Matlab function block runs much slower - it takes almost double the time that the first one does. ( ~0.5 seconds compared to 0.28 seconds).

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by