Simulink-Blocks vs Matlab Functions
조회 수: 16(최근 30일)
I am working under Matlab/Simulink 2014b. I am building a large simulation model in Simulink. A colleague of mine suggested the use of Matlab Functions (formerly known as Embedded Matlab Functions; I am NOT talking about "Interpreted Matlab Functions") instead of building the functionality of each block with standard Simulink Block Set. For complex algorithm I totally agree that Matlab Functions are much easier to implement.
So, I am asking in a provocative way:
1. what is the drawback of a Matlab Function vs. Simulink Blocks in terms of simulation (Monte Carlo) and Code Generation? Why not using only Matlab Functions within the Simulink framework? Is the decrease in Performance so drastically (<http://de.mathworks.com/help/simulink/ug/comparing-performance.html)>?
2. Version Control: is the version control under Simulink working that well? Isn't it easier to compare code and do version control on Basis of Matlab Functions?
I would be very glad for any input or experiences concerning the mentioned topic.
Ryan Livingston 2015년 3월 18일
편집: Ryan Livingston 2015년 3월 19일
1. There is generally no reason to expect a decrease in performance, in my opinion. I interpret that link as explaining that using the accelerator simulation modes may not accelerate Stateflow charts and MATLAB Function Block substantially because those blocks always generate code for simulation. Though, that is not always true.
One consideration I've seen is that model update can be a bit slower when the model contains many MATLAB Function Blocks. The time to write code to disk and compile it can introduce a little latency.
Note that in R2015a a new feature was added that uses just-in-time (JIT) compilation to remove the need for this intermediate code generation for many MATLAB Function Blocks. Search for "JIT" in the release notes for more information.