How to plot 3D surface with the given points in excel

조회 수: 1 (최근 30일)
Torkan
Torkan 2022년 3월 11일
댓글: Torkan 2022년 3월 14일
Hello,
Does anybody know h ow can we plot 3D surface for points in 3 columns as a vector? I have 3 different 20 by 1 vectors and I want to get 3D plot. Two first are input and next output.
Thanks

채택된 답변

KSSV
KSSV 2022년 3월 11일
T = readtable(myexcelfile) ;
x = T.(1) ; y = T.(2) ; z = T.(3) ;
%%structured
xi = unique(x) ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = reshape(z,size(X)) ;
figure
surf(X,Y,Z)
%%unstructured
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
figure
trisurf(tri,x,y,z)
  댓글 수: 7
KSSV
KSSV 2022년 3월 12일
Read about colormap.
Torkan
Torkan 2022년 3월 14일
I used also this one to make it smooth
f = fit([x y],z,"poly23");
plot(f,[x y],z);
But the issue is for some of the data the vertical axis range is too high? Would you please check it and let me know what can I do?
x = [0.333;
0.333;
0.333;
0.2727;
0.2727;
0.2727;
0.2;
0.2;
0.2];
y= [525;
550;
500;
500;
525;
550;
500;
525;
550];
z1= [-74.6;
-21.788;
-125.444;
-124.603;
-71.143;
-17.073;
-107.754;
-52.662;
2.7513];
f = fit([x y],z,"poly23");
plot(f,[x y],z);
c = jet(20);
colormap(c);
shading interp
By the way in matlab 2022 this function does not wok

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by