Unleashing the true power of Matlab

Posted by mazimadu on Feb. 2, 2016, 3:18 p.m.

If you ever had to use Matlab in college raise you hand! Go on, show of hands in the comments!

MATLAB is far and away the single most powerful piece of software I have ever used. It is responsible for doing everything from solving very complex equations to simulating the aircraft controls. It can be used to design and test multicore CPU circuits and output the whole design into C++ code. It can even make windows programs that have fancy 3D animations.

And it can plot fancy graphs!

Yet sadly, very few people can tap into the potential of this piece of software. Despite it being used by every Engineering and Computer Science major, not that many people know how to plot some of those fancy graphs it is so good at making. I recall many a day when I helped 3.5 GPA students on scholarships properly type in the code "plot(x,y)". ROCKET SCIENCE!

But right now, I an not doing rocket science with the software. I am doing something related to robotics. You see, finding the position of a device using an accelerometer is very, VERY hard to do. In fact it is so hard you need a gyroscope and compass just to correct the errors in angle and velocity. This is the reason so many Wii games had such bad controls. Despite almost every phone having these 3 sensors, there is still some research to be done in this area. As I mentioned in an earlier post, google is using this technology along side others in their Project Tango initiative.

So what does this have to do with Matlab? Since the sensors are only good for getting raw data, you will need to find a means to process, verify and experiment with that data before you start making apps with them. Linear acceleration and Euler angles are really cool and all, but how can you be sure some guys fancy equations make sense, or work as intended. You don't want to be making an app to find that out.

Below is a Matlab simulation taken from an IMU (Inertial Motion Unit) which is basically the 3 motion sensors of a phone, without the phone. This is the most impressive demo I have seen in this field and the results speak for themselves.

In the project I am trying to do I needed to get the sensor data from my phone to the program so I can calculate the position. The above video uses logged data stored on the IMU which has to be processed after it is reconnected to the computer. Luckily, my phone and work station are connected to the same WiFi signal. All I needed to do was know my PC and phones IP then I could send data from the sensors. Results are below:

With this working I can now use what I have learned to make a tracking app using QT. This makes my life a whole lot easier. It is amazing what this program can do, my college needs to teach it more effectively so we a can unleash its true power.

Comments

Jani_Nykanen 8 years, 3 months ago

Quote:
You are a math major and you never used matlab? What does your college teach you to use? Mathematica? GNU Octave? Excel? Lol
Well, this is my first year (and probably the last, how I hate this shit already), so we don't anything very complex. One teacher has recommended Maxima for calculating matrix things, but we don't use much software yet, mostly because we are supposed to be able to do everything with pen and paper (you cannot use devices during exams).

Quote:
Also, Don't try to make a game with matlab. Unless you are making hardware, what you may make may resemble a BASIC program.
Don't worry, I wasn't going to, C++ and Allegro (or OpenGL) is good enough for me.