I need to create a 3D contour/surface plot with given points.

9 visualizaciones (últimos 30 días)
Evan
Evan el 7 de Jul. de 2022
Respondida: Walter Roberson el 25 de Jul. de 2022
I have several points with x,y,z coordinates with varying z values that I need to show the contour of. I have plotted using the contour and surf function however I am getting a really block like image and need it refined to look similar to the image attached. It is almost impossible to see the difference in z values.
What would be the best way to approach this in order to be able to visually see the difference in z values?
  1 comentario
Walter Roberson
Walter Roberson el 7 de Jul. de 2022
griddata() or scatteredInterpolant() and query at a more refined x and y grid; this will interpolate the data according to the interpolation method you specify (default would be bilinear interpolation.)

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 25 de Jul. de 2022
N = 200;
P = 20;
x = rand(1, P);
y = randn(1, P);
z = sinpi(y*2) + exp(2*x);
figure()
scatter3(x, y, z)
xvec = linspace(min(x), max(x), N);
yvec = linspace(min(y), max(y), N);
[Xq, Yq] = meshgrid(xvec, yvec);
F = scatteredInterpolant(x(:), y(:), z(:));
Zq = F(Xq, Yq);
figure()
surf(Xq, Yq, Zq);

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by