Azzera filtri
Azzera filtri

How to a plot a surface from excel sheet XYZ

17 visualizzazioni (ultimi 30 giorni)
I have an excel sheet (attached) and I want to plot a smooth XYZ surface from this data.
IMPORTANT NOTE:
Originally, both X & Y go from 0 to 0.5. However, some points were outliers and I needed to remove them, so I ended up with this data.
This is a screenshot:

Risposta accettata

KSSV
KSSV il 6 Nov 2021
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/791474/excel-surface.xlsx')
T = 2401×3 table
X Y Z ____ ____ ____ 0 0 1.5 0.01 0 1.52 0 0.01 1.52 0.01 0.01 1.55 0.02 0 1.57 0.01 0.02 1.6 0.02 0.01 1.64 0 0.02 1.64 0.02 0.02 1.67 0.03 0 1.69 0.03 0.01 1.74 0.02 0.03 1.76 0.01 0.03 1.81 0 0.03 1.82 0.04 0.01 1.85 0.03 0.02 1.85
x = T.(1) ;
y = T.(2) ;
z = T.(3) ;
xi = linspace(min(x),max(x));
yi = linspace(min(y),max(y)) ;
[X,Y] = meshgrid(xi,yi) ;
Z = griddata(x,y,z,X,Y) ;
pcolor(X,Y,Z)
shading interp
colorbar
  1 Commento
HAMID
HAMID il 6 Nov 2021
Thanks for answer, I plotted a 3D surface using surf command and it worked.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by