Plotting 3D mesh from 3 data columns
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bendix
el 23 de Nov. de 2022
Comentada: Bendix
el 28 de Nov. de 2022
I have an excel file with 3 colums (X,Y and Z coordiantes) which i would like to plot as a surface (heat map) in 3D. Preferably I would like my x and y axis to be shown with the following lengths: x = 0 - 11.5 and y = 0 - 7.6
0 comentarios
Respuesta aceptada
Sakshay
el 28 de Nov. de 2022
Hi Bendix,
As per my understanding, you are trying to create a 3D surface plot from X,Y,Z points.
You need to interpolate the points to plot them as a surface. The points can be interpolated using the "griddata()" function. The following example will illustrates how to do that:
% Read the data points as a matrix
T = readmatrix('3DPlot.xlsx');
% Create a meshgrid for plotting
[xq,yq] = meshgrid(0:.2:11.5, 0:.2:7.6);
% Interpolate the points using griddata function
vq = griddata(t(:, 1), t(:, 2), t(:, 3),xq,yq);
% Plot the surface
mesh(xq,yq,vq);
hold on;
% Plot the points
plot3(t(:, 1), t(:, 2), t(:, 3),'o');
% Set the X and Y Limits
xlim([0 11.5]);
ylim([0 7.6]);
Please refer to the following documentation for more information on "griddata()" function:
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh 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!