可用MATLAB中的 contour函数
Create a contour plot of the function:
z = xe(–x2 – y2)
over the range –2 ≤ x ≤ 2, –2 ≤ y ≤ 3.
[X,Y] = meshgrid(-2:.2:2,-2:.2:3);
Z = X.*exp(-X.^2-Y.^2);
[C,h] = contour(X,Y,Z);
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
colormap cool