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?)

STOP!

if     you.knowledge(coding) == 1

           break;

else

          read_on = 1;        % if you already know about coding, ignore this post!

end


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. LaTex
  2. Matlab
  3. Python

%1  What is LaTex?

Screen Shot 2016-05-17 at 10.01.58 PM

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!)

  1. LaTex is Word. If you want to write a sentence, just write your sentence. NO DIFFERENCE.
  2. 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.
  3. 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.
  4. 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. 

latex-commands-table

[Source: Plotly Tutorial]

At first, LaTex is intimidating… confusing… frustrating. But I PROMISE, you will löv it too!

Sign up at https://www.sharelatex.com with your Chalmers student email address and get “Premium” for free. The beginner tutorials are probably better than what I can explain.

Fatigue

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?

Screen Shot 2016-05-17 at 9.43.47 PM


 

% 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…

A1

You can make GIF in Matlab!

giphy

You can solve very complicated math equations…

Screen Shot 2016-05-17 at 10.39.20 PM

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.

Read more here: http://www.ee.columbia.edu/~marios/matlab/MatlabStyle1p5.pdf

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.

Screen Shot 2016-05-17 at 10.45.19 PM

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!

http://ethanschoonover.com/solarized

solarized-vim


%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!

https://www.codecademy.com/learn/python

Screen Shot 2016-05-17 at 10.36.46 PM

a fun example from Wired.com


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!

 

löv,

gimmygøteborg

17 Mai 2016 – Happy birthday, Norway!


 

PS! You can make pretty 3D graphs (very easily) in Matlab too!

A3Histogram

Gimmy

Chinese-Canadian Automotive Engineering graduate from TU Chalmers. Contact me if you have questions or just want to grab a beer at gimmygoteborg (at) gmail!
Read more about Gimmy

Comments (4)

Reply or leave a comment

Study in Sweden on Instagram

Go to Instagram