Plot xyz point data to 3D contour
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amra Rajuli
el 28 de Mzo. de 2021
Comentada: Star Strider
el 12 de Abr. de 2021
How to plot the xyz point data (attached) into 3D contour? Thank you
Respuesta aceptada
Star Strider
el 28 de Mzo. de 2021
Try this:
D = readmatrix('data.txt');
x = D(~(any(isnan(D),2)),1);
y = D(~(any(isnan(D),2)),2);
z = D(~(any(isnan(D),2)),3);
N = 50;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[X,Y] = ndgrid(xv, yv);
Z = griddata(x, y, z, X, Y);
figure
surf(X, Y, Z)
.
4 comentarios
Star Strider
el 12 de Abr. de 2021
The shaperead function requires the Mapping Toolbox, that I do not have.
I cannot run your code.
However, removing the NaN values from the structure would likely be straightforward:
Dnonan = structfun(@(x)x(~(any(isnan(x),2))),D, 'Unif',0);
x = Dnonan.X;
y = Dnonan.Y;
z = Dnonan.Z;
See if that does what you want. (It worked with a random structure I created to test this, with the fields of ‘D’ being column vectors.)
Make appropriate changes to get thee result you want.
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!