How to a plot a surface from excel sheet XYZ

조회 수: 11 (최근 30일)
HAMID
HAMID 2021년 11월 6일
댓글: HAMID 2021년 11월 6일
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:

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by