TAGS: #javascript
Oh MatLAB…solving differential equations, graphing, plotting, and giving you exigent values in a matter of SECONDS!!! For anyone in engineering or mathematics, MatLAB makes your life instantly easier. So the best programming language for a lapsim is then MatLAB! No…Wait What?
Many people(engineers are no exception) get used to using a certain program and try to make it into a one size fit all product. A great example of this is the older generation of engineers and VBA(VBA is great but it wasn’t designed to go to space).
MatLAB is great at performing mathematical calculations and solving equations. It has programming logic that was meant to be used for very short code. MatLAB is a high-level language, which in layman terms means that the programming isn’t at a basic machine level understanding. At the very lowest level, the machine is thinking of 0’s and 1’s. The higher you go, the more the compiler interprets real language on the page into machine language. High level languages intend to make programming easier, while low level languages make it run faster and more efficiently.
Since MatLAB is a very high-level language that has a LOT of functions built into it and various files that build ontop of other files that build ontop of other files and so on, makes it run VERY inefficiently and VERY slowly.
When I first wrote my FSAE lapsim, I naturally used MatLAB because I was taking a course in the university and it just felt natural. After my lapsim grew in size(about 300-600 lines of code) it was painfully obvious that MatLAB is not designed for this kind of stuff…
So what is a good programming language then? Well it depends on your application! As with all things FSAE, you need to have a good reason to use something! Why did I choose JavaScript? Well, in my pesonal opinion, the internet is KING. By that I mean, everything is more accessible on the internet and everything is easier to use.
Why have a MatLAB file that needs to be opened in MatLAB to run when I can program the lapsim into a easy to use web interface where all you need is an internet connection? You can use your iPhone, Android, iPad, Mac, PC, or Windows phone to access the site…ANYTHING! Ontop of that it calculates in 5 seconds versus 5 minutes? Where do I sign up!!!
I will say that I had quite a bit of trouble implementing Matrix Algebra into JavaScript. Programming in basic things like multiplication is cake, but when you get into QR Decomposition and Gramm Schmidt, it starts to get fairly complex. Thankfully, I used part of Sylvesters libraries to make things easier(3D drawing script).
I hope I motivated some of you to look at other options when it comes to programming!! Remember, One size does not fit all.