MATLAB /Simulink Fundamental question

조회 수: 8 (최근 30일)
Robbo
Robbo 2011년 8월 1일
Hey guys - just wondering, what is the best way to model a given system ? I understand matlab code may look messy and hard to follow, especially for a big model but my gut feeling is that it would run faster than a simulink equivalent (I've tested this with a dummy model).
What do you guys think ? Is there a particular set of factors that are key in making a decision as to whether a system should be modelled in matlab or simulink ? Any thoughts appreciated !
Many thanks B

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 8월 1일
I would think it dependents on the nature of your system. MATLAB is best for solving matrix problem. Simulink is best for solving differential equations. In many cases, both can be used to solve both types of problems. Personally, I prefer Simulink if differential equations are involved. Simulink obviously has better visual effect.

추가 답변 (2개)

Kaustubha Govind
Kaustubha Govind 2011년 8월 1일
Regarding speed of execution - it really depends on your solution. If your MATLAB code relies on the JIT/Accelerator, it will in most cases run faster than a Simulink equivalent. However, note that Simulink provides the Accelerator and Rapid Accelerator simulation modes which could in some cases run faster than MATLAB code, since they generate and execute C code and don't use the MATLAB interpreter.
  댓글 수: 2
Robbo
Robbo 2011년 8월 2일
Thanks for the info guys, at the moment I use both MATLAB and Simulink in 'normal mode' i.e. not the accelerated modes. Most of the equations in the model involve simple maths, and arent differential-equation intensive. My current model is wholly in MATLAB, but I would like to turn bits of it into Simulink for code gen in the future but I am nervous as to whether this would increase the execution time of the model.
Cheers !
Kaustubha Govind
Kaustubha Govind 2011년 8월 2일
FYI: Starting in R2011a, a new product called MATLAB Coder (http://www.mathworks.com/products/matlab-coder/?s_cid=global_nav) can be used to generate code from a limited subset of the MATLAB language.
Another clarification: The MATLAB JIT/Accelerator is enabled by default, it's not opt-in, like Simulink.

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


Arnaud Miege
Arnaud Miege 2011년 8월 1일
There are also a range of dedicated physical modelling tools for Simulink that allow you to model complex multi-domain physical systems.
HTH,
Arnaud

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by