How to a plot a surface from excel sheet XYZ

12 views (last 30 days)
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:

Accepted Answer

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

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!