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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 4월 14일

댓글:

2022년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by