cutline of a triangular meshed graph

1 回表示 (過去 30 日間)
Chun-Wei Wu
Chun-Wei Wu 2021 年 7 月 7 日
コメント済み: Chun-Wei Wu 2021 年 7 月 7 日
So I was trying to find a cutline at x=0 and want to plot 1D plot along it, so that I can have y vs. z. This is the scatter plot of my graph.
The dots are not arranged meaning that the x and y axis are not the same, they are kinda random, so I tried delaunay function to link all the points together.
But now the question is how do I get the plot at x=0 or any number and plot y vs. z.
Is there a way to do it? I've seen people talking about barycentric coordinates, but I just don't know how to implement it.

回答 (1 件)

Kelly Kearney
Kelly Kearney 2021 年 7 月 7 日
The simplest way to do this is to simply interpolate z for a set of points defined by x = 0 and y = the range of your y-data. For example:
x = rand(5000,1)*7 - 3;
y = rand(5000,1)*7 - 3;
z = peaks(x,y);
figure;
scatter3(x,y,z,5,z,'filled');
yi = linspace(-3,3,100);
xi = zeros(1,100);
F = scatteredInterpolant(x,y,z,'linear');
zi = F(xi,yi);
figure;
plot(yi,zi);
  1 件のコメント
Chun-Wei Wu
Chun-Wei Wu 2021 年 7 月 7 日
Thank you very much! That worked perfectly!

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

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by