古詩詞大全網 - 成語經典 - matlab如何在等高線圖中顯示等高線數值

matlab如何在等高線圖中顯示等高線數值

代碼:% By lyqmath

clc; clear all; close all;

[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

title('By lyqmath', 'FontWeight', 'Bold', 'Color', 'r');結果