Skip to main content
gamedev.net
🔒 Locked

matlab for simulation code?

Started by thedustbustr 3 replies 800+ views
Original Post
thedustbustr
thedustbustr
I happened to show my academic advisor my pet C++ physics simulation, and he mentioned that if he were to do something like that he would use matlab to do the actual simulation math instead of C++. Anyone have any experience in matlab for a physics sim - efficiency and the like? I've only used it for trivial engineering applications in academia to date.
lonesock
lonesock
I TA'd at UC Davis for a Numerical Methods class, and the professor was big into MATLAB. The problem is that it's extremely slow for complex problems. If you are comfortable with C++ and coding good algos, I'd say stick with C++.

what MATLAB has is guaranteed nice linear solvers, etc.
Zipster
Zipster
We use the Simulink package that comes with Matlab for labs in my Systems Engineering class, and it works really well. Of course this is only an introductory course on dynamic systems so we haven't gotten into anything extremely complex yet. The reason your advisor said he's use Matlab for the simulation math instead of C++ was probably because Matlab already has a bunch of solvers for linear systems and ODEs, in addition to the whole application frontend, so you wouldn't have to worry about that stuff yourself. And you know they're robust and well-tested.
lonesock
lonesock
Quote:
Original post by Zipster
Matlab already has a bunch of solvers for linear systems and ODEs, in addition to the whole application frontend, so you wouldn't have to worry about that stuff yourself. And you know they're robust and well-tested.


exactly. if you do go the c++ route, there are plenty of libraries, for example lapack++
grhodes_at_work
grhodes_at_work
My opinion is that MATLAB is fantastic, wonderful for research for implementing simplish problems that change all the time, and to prototype new algorithms. There are a few free sort of clones:

Octave
SciLab

What I would have given to have these nice free packages available when I was in school! I paid for a super-crippled student version of MATLAB that was useless outside of the most elementary of linear algebra classes.

But, for games and real-time applications that need essentially a solid, very fast fixed functionality, you're better off with C++ or another compiled language.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.