Boston University's engineering program has all engineering freshmen take Engineering Computation, a class teaching the programming language MATLAB (short for Matrix Laboratory). MATLAB is a C based language that is very easy (compared to most languages) and is spectacular at data manipulation and matrix related tasks (hence the name). However, it can also be used as a "general use" language, hence this Instructable.

I finished a lab early once and decided that the most efficient use of my time was to make a program that simulated the Cat proximity XKCD, it being one of my favorites. The program prompts the user for a distance to a cat in feet, and then give the adjusted intelligence and statement inanity level (x% of normal intelligence, statement is y% inane) as well as plotting the point of both on a graph based on the one in the comic. There is also a built in limit for both extremely close and far distances.

This Instructable will show step-by-step what the program does as well as giving the code in full with my original comments. It also gives the output given by the computer for some example inputs.

Programming experience is not necessary to run the program, since I give it to you. It will help understand what's happening, however. The best source for clearing up confusion concerning what a function does or how to use it is the MATLAB website. So grab a cat and get started!
Remove these adsRemove these ads by Signing Up
kelseymh2 years ago

Disclaimer: MATLAB is the primary analysis tool used in the CDMS experiment, which I joined recently. I've been a C++ physicist for the past 15 years, and new stuff is hard :-/
yay matlab!