Plotting a Heat Map Table in MATLAB

A heat map table with the "copper" colormap
A heat map table with the “copper” colormap.

A little while ago I found myself needing to plot a heat map table in MATLAB. Such a plot is a table where the cells have background colors; the colors depend on the value in the cell, e.g. a higher value could correspond with a warmer color. I found no existing function to do this easily, so I set out to create my own solution.

The code to plot a heat map table can be found here.

Usage is pretty simple. If you have a matrix A, just pass it into the function and it will do the rest! For example:

There are a number of options available. See the documentation in the code for more information about the options. To further adjust the generated figure, such as to add labels, proceed as you would with other plotting functions. For example:

Rocket Fuel Requirements Revisited

In a previous post we looked at the fuel requirements for rockets to reach escape velocity. We calculated the fuel requirements using the rocket equation. This equation takes into account the conservation of momentum. However, momentum is not the only property influencing the velocity of the rocket during a launch.

Rockets expel their fuel over time. During this time, the rocket is pulled back due to gravity. Only if a rocket could instantaneously expel all of its fuel, and when ignoring atmospheric drag, the escape velocity would be reached instantaneously and the equation would hold.

Taking the burn-time and gravity into account yields a difficult differential equation. We can implement that equation in a computer program to simulate the launch.

Continue reading “Rocket Fuel Requirements Revisited”