关于matlab画等高线图的问题

2025-03-18 17:20:18
推荐回答(1个)
回答1:

可用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