12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The conclusion is that most viewers find it very difficult to interpretthese sorts <strong>of</strong> images; the cognitive switch from, for example, roygbivto amplitude is very slow <strong>and</strong> nonintuitive. A way out <strong>of</strong> this isto use a palette <strong>of</strong> slightly varying, nonsaturated colours. These sorts<strong>of</strong> colours have been used to create high-quality geographic maps formany years. Most <strong>of</strong> matlab’s colour maps consist <strong>of</strong> highly saturatedcolours (including the default colour map, which is jet(64)). It is betterto forgo these sorts <strong>of</strong> colour maps <strong>and</strong> stick with the calmer onessuch as gray, bone, orsummer. The gray colour map has the addedadvantage that printed versions will reproduce easily, for example, on aphotocopier. 2 The companion m-files include some other colour maps:redblue, myjet, yellow, green, red, <strong>and</strong> blue.To distinguish adjacent patches <strong>of</strong> subtly different colours, the eyecan be helped by enclosing the patches with a thin dark edge. Thecontourf function, therefore, is an excellent way <strong>of</strong> displaying this sort<strong>of</strong> data. 37.5 Extracting Logical DomainsLet us look again at the peaks function:[x,y,z] = peaks;surfl(x,y,z)axis tightcolormap(gray(64))Suppose we want to extract the part <strong>of</strong> this surface for which the z valueslie between 2 <strong>and</strong> 4. We use exactly the same technique as was givenon page 23. The find comm<strong>and</strong> is used first to find the indices <strong>of</strong> the zvalues that satisfy the logical test:>> ind = find(2 size(ind)ans =234 1There are 234 elements in z that satisfy our condition. We can plot theseelements over the surface as follows:2 Edward R. Tufte, Visual Explanations (Graphics Press, Cheshire Connecticut,1997), pp. 76–77.3 Edward R. Tufte, Envisioning Information (Graphics Press, Cheshire Connecticut,1990), pp. 88ff.c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!