フィルターのクリア

How do I find all the points between two contour lines

6 ビュー (過去 30 日間)
Khalid Ibne Masood
Khalid Ibne Masood 2020 年 4 月 12 日
コメント済み: Ameer Hamza 2020 年 4 月 13 日
Hello,
I have 3 equal size matrices, X, Y and Z; I can draw the contour lines for Z with the command: contour(X,Y,Z);
But I want to collect all the X and Y points that lies between two contour lines of Z. Please suggest me some idea how to solve this problem.
Thank you.
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 4 月 12 日
There can be several contour lines? Which specific one do you want?
John D'Errico
John D'Errico 2020 年 4 月 12 日
There are infinitely many points between any pair of distinct lines. Finding them all will take more time that you have.

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

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 12 日
This shows an example
[X,Y] = meshgrid(-1:0.01:1);
Z = X.^2 + Y.^2;
line1_level = 0.2;
line2_level = 0.5;
levels = [line1_level line2_level];
mask = (Z > min(levels)) & (Z < max(levels));
x_list = X(mask);
y_list = Y(mask);
X and Y are grid points and Z is the function value. The code list all x and y points lying between contour lines at 0.2 and 0.5.
  2 件のコメント
Khalid Ibne Masood
Khalid Ibne Masood 2020 年 4 月 12 日
Hello,
Thanks a lot, I have partially solved the problem with your help.
But still I have some problem. Here I have attached a picture showing the contour lines. I can get all the points between the contour lines except for the contour 2.45. Since the contour level 2.45 is discreate, I would like to collect all the points that are enclosed by each branch.
Do you have any idea for this problem?
Thanks again.
Khalid
Ameer Hamza
Ameer Hamza 2020 年 4 月 13 日
I am not clear about this question, but from your image, it appears that 2.45 is the highest level contour line, and you want to get the points between 2.45 and the edge of the mesh. If this is what you want and all the points between 2.45 and edge are higher than 2.45, then you can set the level like this
levels = [2.45 inf];

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

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by