How to create a contour plot from 3 vectors

12 Ansichten (letzte 30 Tage)
Robert Jones
Robert Jones am 4 Feb. 2024
Verschoben: Dyuman Joshi am 16 Feb. 2024
Hello,
I have a table with 3 columns X,Y,Z.
how do I create a contour ploy for Z(x,y)?
Thank you

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 4 Feb. 2024
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);

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 4 Feb. 2024
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);

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by