필터 지우기
필터 지우기

showing contour values on plot

조회 수: 12 (최근 30일)
Mahmoud Abbas
Mahmoud Abbas 2022년 4월 14일
댓글: Star Strider 2022년 4월 14일
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
.
  댓글 수: 2
Mahmoud Abbas
Mahmoud Abbas 2022년 4월 14일
You are a superhero, thank you!
Star Strider
Star Strider 2022년 4월 14일
Thank you!
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (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