How to draw equipotential lines on surface plot?

19 visualizaciones (últimos 30 días)
Georg Senft
Georg Senft el 4 de En. de 2019
Comentada: Star Strider el 4 de En. de 2019
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.

Respuesta aceptada

Star Strider
Star Strider el 4 de En. de 2019
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 comentarios
Georg Senft
Georg Senft el 4 de En. de 2019
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 el 4 de En. de 2019
As always, my pleasure.
Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by