Eddie, it does not change the intention of the last example but the assignment for z should be:
z = spread(sin(x), 2, size(y)) * spread(cos(y), 1, size(x)) + &
0.5d0 * spread(sin(2.0d0*x), 2, size(y)) * spread(cos(2.0d0*y), 1, size(x))
I should have used to nested do loops! However I’m trying to keep the number of lines in these examples small – hence the use of spread.
Bands are a good idea. Here is a very slightly modified version of the example which allows the plot to be drawn with different numbers of levels:
There is a very good discussion of colour ramps to be found here: