3D plot from excel data

조회 수: 27 (최근 30일)
Francesco Marchione
Francesco Marchione 2021년 4월 22일
댓글: Star Strider 2023년 5월 12일
Hello,
I have an excel sheet cointaining x,y,z data in three columns (see attached file).
I would like to plot a 3D graph from this data.
Thanks everyone

채택된 답변

Star Strider
Star Strider 2021년 4월 22일
Try this:
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/593500/prova_stress.xlsx', 'VariableNamingRule','preserve');
Q1 = T1(1:25,:);
VarNames = T1.Properties.VariableNames;
x = T1{:,1};
y = T1{:,2};
z = T1{:,3};
[Ux,iax,ixx] = unique(x);
[Uy,iay,ixy] = unique(y);
N = 25;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[Xm,Ym] = ndgrid(xv, yv);
Zm = griddata(x, y, z, Xm, Ym);
Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.
figure
surfc(Xm, Ym, Zm)
grid on
xlabel(VarNames{1})
ylabel(VarNames{2})
zlabel(VarNames{3})
.
  댓글 수: 6
Mohammed Saifuddin Ustad
Mohammed Saifuddin Ustad 2023년 5월 12일
okay that i have tried but do you have any idea with pchip interpolaton or any other interpolation that would make this plot better
and sure i will keep that in mind
Star Strider
Star Strider 2023년 5월 12일
I don’t. I looked at other interpolation functions, and they all have essentially the same options, with interp2 also having 'cubic' and 'makima'.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by