How to get coordinates for a specific contour line?

23 ビュー (過去 30 日間)
Sk Zeeshan Ali
Sk Zeeshan Ali 2020 年 1 月 20 日
編集済み: Sk Zeeshan Ali 2020 年 2 月 17 日
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?

採用された回答

Claudio Iturra
Claudio Iturra 2020 年 1 月 20 日
編集済み: Image Analyst 2020 年 1 月 21 日
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 件のコメント
Sk Zeeshan Ali
Sk Zeeshan Ali 2020 年 2 月 15 日
編集済み: Sk Zeeshan Ali 2020 年 2 月 17 日
That's nice suggestion.
Now, can the contour line be made smooth without changing the meshgrid?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by