showing contour values on plot

12 次查看(过去 30 天)
Hello, how can i show the contour values on the plot?
f = @(x1,x2) exp(-0.05*x1)*sin(x1)+exp(-0.05*x2)*cos(x2);
fcontour(f,[-10 10 -10 10])
colorbar

采纳的回答

Star Strider
Star Strider 2022-4-14
The fcontour function does not have a 'ShowText' property, so overplot it with a normal contour plot and set 'ShowText','on' to show the levels.
f = @(x1,x2) exp(-0.05*x1).*sin(x1)+exp(-0.05*x2).*cos(x2);
figure
hfc = fcontour(f,[-10 10 -10 10]);
Xm = hfc.XData;
Ym = hfc.YData;
Zm = hfc.ZData;
hold on
contour(Xm,Ym,Zm, 'ShowText','on')
hold off
colormap(turbo)
colorbar
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by