How to draw equipotential lines on surface plot?

조회 수: 19 (최근 30일)
Georg Senft
Georg Senft 2019년 1월 4일
댓글: Star Strider 2019년 1월 4일
I created a basic surface plot using meshgrid and a function d(x,y). My plot has a global minimum < -1 and a global maximum > 1. I want to draw three equipotential lines onto my surface plot, one where d(x,y) = -1, one where d(x,y) = 0 and one where d(x,y) = 1.
What is an easy and elegant way to do that? Thanks.

채택된 답변

Star Strider
Star Strider 2019년 1월 4일
If I understand correctly what you want to do, use the contour3 (link) function.
The code would go something like this:
X = [ ... ];
Y = [ ... ];
Z = [ ... ];
figure
surf(X, Y, Z)
hold on
contour3(X, Y, Z, [-1, 0, 1])
hold off
grid on
  댓글 수: 2
Georg Senft
Georg Senft 2019년 1월 4일
Thank you very much. In general I think I find a lot of your answers when looking for stuff online, always helpful, keep up the good work!
Star Strider
Star Strider 2019년 1월 4일
As always, my pleasure.
Thank you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by