How to get coordinates for a specific contour line?

34 visualizaciones (últimos 30 días)
Sk Zeeshan Ali
Sk Zeeshan Ali el 20 de En. de 2020
Editada: Sk Zeeshan Ali el 17 de Feb. de 2020
I have the program as follows:
x = -2:0.2:2;
y = -2:0.2:3;
[X,Y] = meshgrid(x,y);
Z = X.*exp(-X.^2-Y.^2);
contour(X,Y,Z)
Now, I want to get a two-column matrix C that will give the (x,y) coordinates of a specific contour line, let us say for Z = 0.1. So, how to get this two-column matrix?

Respuesta aceptada

Claudio Iturra
Claudio Iturra el 20 de En. de 2020
Editada: Image Analyst el 21 de En. de 2020
x = -2:0.2:2;
y = -2:0.2:3;
[X,Y] = meshgrid(x,y);
hold on % to your meshgrid a specific value for your contour.
[x1,y1] = contour(X,Y,Z,[0.1 0.1],'*k') % x1 will be your "two-column matrix"
  1 comentario
Sk Zeeshan Ali
Sk Zeeshan Ali el 15 de Feb. de 2020
Editada: Sk Zeeshan Ali el 17 de Feb. de 2020
That's nice suggestion.
Now, can the contour line be made smooth without changing the meshgrid?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Contour 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