필터 지우기
필터 지우기

Most efficient Quadratic Implementation in Simulink

조회 수: 2 (최근 30일)
Tom
Tom 2012년 9월 13일
Hi,
A general question that comes up occasionally at work is; What is the best way to implement a simple equation in Simulink?
For example, if I need to implement a quadratic equation, am I best doing this using a number of gains, product and add blocks separately, using a dedicated block like the polynomial, or using a fcn (or even Matlab fcn) block?
I generally make the decision based on other factors such as clarity and ease of use, but is there an optimal solution for fastest simulations, or do they compile down to be identical anyway?
Regards, Tom

채택된 답변

Ryan G
Ryan G 2012년 9월 13일
You can see a number of the optimizations that are performed in the Configuration Parameters -> Optimizations tab.
For modeling anything I would avoid using a MATLAB Fcn block as this will limit your ability to utilize things that involve code generation (this includes accelerator/rapid accelerator).
Unfortunately I do not believe there is an easy answer for the general questions posed. It really depends on what you are modeling, what your goals are and the effects of Simulink optimizations such as block reduction.
  댓글 수: 2
Tom
Tom 2012년 9월 13일
Thanks, I guess the best way to answer this would be to look at RTW generated code, but I imagine the block reduction would make them all pretty similar as long as I'm careful.
Ryan G
Ryan G 2012년 9월 14일
The block reduction is actually a Simulink optimization. There are more optimizations when generating code and there are even more optimizations that take place when it is compiled. Depending on your goals you may not want all of them.
For example if you are compiling the model over and over (making changes between runs/code generation) then you may want to minimize the optimizations that are performed. Once you solidify your model/controller you may want to use more optimizations to improve the performance of the compiled code.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by