There exists a lively debate on the internet about the goodness of Matlab as compared to Python.

That battle has not passed by my workplace. I work at X, formerly Google[x], as an aerospace guidance, navigation, and control (GNC) engineers on Project Wing. On one hand, we have a stable of talented GNC engineers who have worked on big aerospace projects for Boeing, Rockwell Collins, Blue Origin, and NAVAIR. On the other hand, we have perhaps THE best software engineers in the world, who have worked on (for example) Google Search, Youtube, Android, and Google Maps.

We aerospace engineers learned and used Matlab from our university days, continuing through our professional careers. Airbus and Boeing use Matlab to design their autopilots and use the Matlab Coder to produce C code, which flies their commercial aircraft every day. Companies like Raytheon trust Matlab to generate similar code for their missile control systems. The Matlab Aerospace Toolbox, Control Design Toolbox, and Simulink are invaluable tools that speed up the controls design and analysis process.

The Google software engineers were kind of appalled at our heavy use of Matlab. In their eyes, it’s not a “real” programming language. “The indexing is wrong.” “You can’t scale it.” “You have to buy somebody else’s software just to run yours.” Most frustrating of all is that Google’s amazing array of software development, testing, and review tools are all but incompatible with Matlab, making the codebase that much more difficult to maintain.

First, a defense of our Matlab use: If you hired a carpenter to work on your house, and he brought a funky Japanese hammer, how would you react? Would you chide him that his hammer doesn’t look or work like you’re used to? Or would you assume that as a craftsman, he’s brought the tool that can serve him best for the job you’ve hired him to do? The same with Matlab: most of the control design and analysis tasks that we’ve been hired to do, we know how to do best with Matlab + toolboxes. Yes, we COULD learn Python and re-create the calculators, etc. that power our analyses, but we’re trying to get a product out the door, and the latter choice just doesn’t seem like a wise use of our limited time.

Second, a defense of our software engineers: Matlab isn’t a great programming language; it HAS grown to be a racket, and people in my line of work probably need to move on to a better toolset.

With that in mind, I wanted to outline, after having used both a good bit, some factors why and why not a student or an organization in the aerospace GNC world would switch from Matlab to Python.

## Cons of switching to Python from Matlab:

- Plotting functionality is much less convenient:

>> x = 0:0.01:pi; >> plot(x, sin(x))

Becomes

In[0]: import numpy as np In[1]: import matplotlib.pyplot as plt In[2]: x = np.arange(0, np.pi, 0.01) In[3]: plt.plot(x, np.sin(x)) In[4]: plt.show()

## Pros of switching to Python from Matlab:

- Python is free and open-source, which means
- The direct monetary cost of switching is (near) zero.
- The number of libraries, modules, toolboxes, etc. is astoundingly high, also mostly free and open-source. This includes functionality found in many of the most popular Matlab toolboxes such as the controls toolbox and the image processing toolbox.
- The ability of aerospace engineers who use Python to integrate their work with other teams, especially ones with software engineers, is drastically improved, especially those working outside Big Aerospace.
- The quality of Python and its toolboxes aren’t dependent upon a single organization (Mathworks) and instead can draw from a very wide community.

- Python has features of a “more serious” programming language that make it much more appropriate to scale up for production purposes–for example, namespaces and mature unit testing support.
- Python is faster to load and typically runs programs faster than Matlab because it only loads modules when you need them.
- Wide variety of development environments: command line, PyCharm, Eclipse, Spyder, IPython Notebook/Jupyter, just to name a few.

## Recommendations:

- University Aerospace Engineering departments adopt Python as their language of choice for Computer Science 101 courses, and as the language that supports all their undergraduate and graduate coursework.
- Cost: while the student version of Matlab is cheap, university licenses are not. Python is free, full stop.
- Transition ability: It’s much easier to learn to program in Python and switch to Matlab than the other way around, and with the rise of the drone economy, many many more aerospace jobs will switch to startup-like companies who are much more likely to use Python as their lingua franca.
- The open source model much more closely mirrors the ideals of scholarship, academic freedom, and information sharing.

- Everyone use Matlab for what it’s really good at: things like quick & dirty prototyping, concept development, etc. Avoid trying scale or production-ize Matlab code,
*especially*if it’s not explicitly supported by the organization’s version control and testing systems.