How to a plot a surface from excel sheet XYZ

17 Ansichten (letzte 30 Tage)
HAMID
HAMID am 6 Nov. 2021
Kommentiert: HAMID am 6 Nov. 2021
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:

Akzeptierte Antwort

KSSV
KSSV am 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 Kommentar
HAMID
HAMID am 6 Nov. 2021
Thanks for answer, I plotted a 3D surface using surf command and it worked.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by