Mechanical Engineer’s Guide to Coding
You know that old fella in the machine shop that is struggling with Windows XP (and you made fun of him?)
That guy is you in …3…..month if you have no idea about coding. (don’t believe me?)
if you.knowledge(coding) == 1
read_on = 1; % if you already know about coding, ignore this post!
I am a proud Mechanical engineer with a capital “M”,
and thus I HATED the word “coding”. Coders give me that iffy feeling… ’em hipsters sipping organic brew at some strange café tabbing away on their MacBooks.
That changed after I moved to Sweden.
Today, I am going to force feed you some basic coding. (or at least tell you which software to learn before September)
%1 What is LaTex?
LaTex is essentially a Word editor for Academia. Word is great for writing essays, stories, business plans, but it is just not good enough for Engineering.
Swedes löv LaTex! (and why you should feel the löv too!)
- LaTex is Word. If you want to write a sentence, just write your sentence. NO DIFFERENCE.
- LaTex is great for writing equations, matrices, all those mathy things. Say good bye to struggle of writing 5^2 (square of 5) in Word. Just type $5^2$ and the superscript will automatically show up. $ sign means equation.
- LaTex documents is more organized… e.g. If you have a long Word file, it can take a while to scroll to the write section. In LaTex, you can create different several subfiles. You work on the particular one. Once finished you can compile the all subsections into one .pdf.
- Oh, did I forget to mention group work? ShareLaTex allow several editor to work on the same document simultaneously! It is like Google Doc, except more serious.
[Source: Plotly Tutorial]
At first, LaTex is intimidating… confusing… frustrating. But I PROMISE, you will löv it too!
This is the remark of my last assignment during Bachelors. I was too busy (with student racecar shenanigans) to type the equations in Word, so I wrote EVERYTHING by hand… So much embarrassment. DON’T BE THIS GUY! ^
So embarrassed, I rewrote this assignment after I graduated in ShareLaTex. Doesn’t it look crisp?
% 2. Matlab
During my bachelor studies I Excelled everything…. Microsoft Excel that is.
Microsoft Excel vs. Matlab for engineers is like Microsoft Paint vs. Photoshop for an advertising agency.
The things you can do in Matlab is virtually endless!
You can make pretty 2D graphs…
You can make GIF in Matlab!
You can solve very complicated math equations…
Basic Commands to get you started:
- clc – to clear the window
- close all – close all figures
- clear all – clear all variables
- control + enter = run the command in your editor
Grammar is key!
One thing that separate future Pros from amateurs is coding grammar! Yes, coding grammar exits! There is a set of general rules on how to name your variables, name your files, etc.
Let me google that for you.
It took me a while to get used to Matlab. Now I cannot live without it. If you have problem with Matlab, chances are someone has already asked the question on google.
Some links to get you started!
#PROTIP! – “Solarized”
I changed my Matlab background colour to dark blue. A lot of “coders” do that. It is easier for the eyes and looks DOPE to passerby!
%3. Python! Industry trend!
The problem with Matlab software license is that it is very very $$expensive$$. Academia usually get it for free, while companies pay big premium.
Companies like Volvo Cars have been using more and more Python instead.
Python is open-sourced, FREE!
Learn it, use it, master it & put it on your resume!
Feeling bored this summer?
If you are an engineer who has never coded, start practicing! Redo your own homework assignments! Do it with Matlab and write it up in LaTex!
17 Mai 2016 – Happy birthday, Norway!
PS! You can make pretty 3D graphs (very easily) in Matlab too!