Plots a surface coloring by layers (using contour curves) (Scripts) Publisher's description
from Rafael Palacios
Different elevations cannot be identified with standard matlab functions such as surf, even changing FaceColor attribute to activate interpolation.
Different elevations cannot be identified with standard matlab functions such as surf, even changing FaceColor attribute to activate interpolation. In contrast, with this function alows one can define contour levels and different colors are applied to each level.
Instead of using surf(x,y,z), you use surflayers(x,y,z,[5 10 15 20]);
The quality of the results may depende on the layer falues that you select. Sometimes surflayers is not very accurate, but in general produces very good results.
% [s m]=surflayers2(X,Y,Z,layers)
% Plots a surface coloring by layers (using contour curves).
% This function creates a surface using different colors for contours
% values defined in arguments layers, and a transparent mesh with black
% lines on top.
% Input Arguments
% X,Y: Vectors or matrices with oordinates of the grid (if unknow see
% Example2 below)
% Z: Matrix of elevations
% layers: vector of contour values
% Optional Outputs
% s: handler of the colored surface
% m: handler of the mesh
% (This handlers allow to chage image properties using set(s, ...) call)
% [s m]=surflayers(x,y,z,[-6.25 -3 -1.5 0 1.75 3.5 6 8]);
% [s m]=surflayers(x,y,L,[-0.15, 0, 0.25 .5 .75 .98]);
% Author: Rafael Palacios,
% Universidad Pontificia Comillas, Massachusetts Institute of Technology
% Version 1, April 2010
System Requirements:MATLAB 7.9 (2009b)
Program Release Status: New Release
Program Install Support: Install and Uninstall