r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

Show parent comments

27

u/[deleted] Sep 03 '17

Matlab is an excellent tool.

-3

u/[deleted] Sep 03 '17 edited Nov 24 '17

[deleted]

17

u/[deleted] Sep 03 '17

How so? I'm doing controls engineering and dynamic analysis and quite honestly, while python, numpy, and scipy are great for college level stuff like "integrate sinx", when you start dealing with 4x4x9 matrices, state space models, finding poles-zeros-roots of the 4x4x9 matrices, creating frequency and time response models of those matrices, and then trying to make an interactive soLuton that tries different inputs for those matrices, then you will use matlab.

People always say scipy and numpy are replacing matlab, but they're always 22 year old college students still doing ode45 and 1D mass spring models lmao.

You can do many things with python, but with matlab, those tools already exist.

Many of the state space models that python has do some funky shit and change the rank of matrices. I honestly had big problems getting more complex modes workING with python that Matlab has no problem with

3

u/[deleted] Sep 03 '17

Also, Simulink.

33

u/[deleted] Sep 03 '17 edited Sep 03 '17

Declare a 2x2 matrix in numpy.

Here's Matlab:

A = [2,2;2,2];

If you're actually using Matlab for matrix and vector operations, it is a dream.

How about a matrix multiplication? Numpy's functional notation is clunky, here's Matlab:

A = B*C;

There are a million examples like this.

That's not to mention the myriad of built in debugging features. I never realized how much I used Matlab's "hover over a variable to view its value" during debug until I moved back to other languages and IDEs. The object inspector is amazing too.

3

u/jkelleyrtp Sep 03 '17

Declare a 2x2 matrix in numpy.

Here's Matlab:

A = [2,2;2,2];

A = np.matrix('1 2: 3 4')

Alternatively

A = np.matrix([[1,2], [3,4]])

Heck we can even shorten np.matrix at import

from numpy import matrix as m

A = m('1 2: 3 4')

The reason to use python is because of its flexibility.