- You can use function blocks "constant" "add", etc.
- Interpreted MATLAB Function: http://www.mathworks.com/help/simulink/slref/interpretedmatlabfunction.html?searchHighlight=MATLAB%20Interpreted%20Function%20Block
- MATLAB Function Block: http://www.mathworks.com/help/simulink/ug/creating-an-example-model-that-uses-a-matlab-function-block.html
Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Does anyone know of a simple simulink diagram that achieves a function but can be drawn two different ways?
1 回表示 (過去 30 日間)
古いコメントを表示
I'm trying to show that a function (i.e. 2+2=4) can be achieved multiple ways and that the code that is generated by that function is different and can be larger than normal. One diagram will produce more code than the other but achieve the same function. Does anyone have such an example? Thanks.
0 件のコメント
回答 (2 件)
Ning Zhang
2016 年 9 月 19 日
編集済み: Walter Roberson
2016 年 9 月 19 日
Hi Rick,
It seems that you want to do a demo on different generated code with different models.
In terms of drawing different simulation model schematics:
However, the generated codes are hard to be compared for the above three approaches. This is because the mechanisms of code generation are different.
If you want to demonstrate the efficiency of generated code using the same Simulink model, check the following link for code optimization: http://www.mathworks.com/help/ecoder/techniques-for-code-optimizations.html?searchHighlight=Generate%20Code%20with%20Optimization Look at the session "Optimization Parameters for Code Generation" particularly.
0 件のコメント
Walter Roberson
2016 年 9 月 19 日
Version 1: use arithmetic blocks to calculate 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2
Version 2: use arithmetic blocks to calculate 2 * 2 * 2 * 2
Version 3: use an arithmetic block to calculate 2^4
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!