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

2 vues (au cours des 30 derniers jours)
Torkan
Torkan le 11 Mar 2022
Commenté : Torkan le 14 Mar 2022
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

Réponse acceptée

KSSV
KSSV le 11 Mar 2022
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 commentaires
KSSV
KSSV le 12 Mar 2022
Read about colormap.
Torkan
Torkan le 14 Mar 2022
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

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by