How to create a contour plot from 3 vectors

19 ビュー (過去 30 日間)
Robert Jones
Robert Jones 2024 年 2 月 4 日
移動済み: Dyuman Joshi 2024 年 2 月 16 日
Hello,
I have a table with 3 columns X,Y,Z.
how do I create a contour ploy for Z(x,y)?
Thank you

採用された回答

Walter Roberson
Walter Roberson 2024 年 2 月 4 日
numcontours = 5;
[minx, maxx] = bounds(X);
[miny, maxy] = bounds(Y);
xv = linspace(minx, maxx);
yv = linspace(miny, maxy);
[XGrid, YGrid] = meshgrid(xv, yv);
F = scatteredInterpolant(X, Y, Z);
ZGrid = F(XGrid, YGrid);
contour(XGrid, YGrid, ZGrid, numcontours);
  1 件のコメント
Robert Jones
Robert Jones 2024 年 2 月 16 日
移動済み: Dyuman Joshi 2024 年 2 月 16 日
Thank you

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 2 月 4 日
numcontours = 5;
%https://www.mathworks.com/matlabcentral/fileexchange/38858-contour-plot-for-scattered-data
TRI = delaunay(X, Y, Z);
tricontour(TRI, X, Y, Z, numcontours);

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by