フィルターのクリア

How to make a contour plot with incomplete z data?

1 回表示 (過去 30 日間)
Onur Kucuktas
Onur Kucuktas 2021 年 11 月 5 日
回答済み: Sulaymon Eshkabilov 2021 年 11 月 5 日
I have a collection of intersection points of a square plane. Each intersection point has an intensity associated with it (doing light ray tracing). I need the intensity to be the elevation of the contour plot, and the points to be the x and y respectively. Areas not intersected by any rays need to have an elevation of zero. I have a vector that has x values of intersection, a vector that has y values of intersection, and a vector that has intensities. I'm not sure how to make a contour plot using this information. Using the contourf function with those vectors as an input says that Z must be at least a 2x2 matrix, and I don't know how to form this matrix when basically any point that isn't included needs to have an elevation of 0. Any guidance is appreciated!

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 11 月 5 日
As I understood your question correctly, you'd need to employ something like this one to get controurf(Z) from the values of X and Y.
X = randi(255, 25, 1);
Y = randi(255, 25, 1);
XY = [X.*(X>175), Y.*(Y>175)];
Z = XY;
contourf(Z)

カテゴリ

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