Plotting 3D mesh from 3 data columns
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Sakshay
le 28 Nov 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:
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!