How to surfplot from xyz coordinates?

2 Ansichten (letzte 30 Tage)
Thomas Lu
Thomas Lu am 30 Jan. 2019
Kommentiert: KSSV am 30 Jan. 2019
Use surf to plot the following points:
(1, 1, 1), (2, 1, 2), (3, 1, 3)
(1.1, 2, 4), (2.2, 2, 5), (3.3, 2, 4)
(1.2,3,3), (2.4, 3, 2), (3.6, 3, 1)

Akzeptierte Antwort

KSSV
KSSV am 30 Jan. 2019
A = [1, 1, 1
2, 1, 2
3, 1, 3
1.1, 2, 4
2.2, 2, 5
3.3, 2, 4
1.2,3,3
2.4, 3,2
3.6, 3, 1] ;
x = A(:,1); y = A(:,2) ; z = A(:,3) ;
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
trisurf(tri,x,y,z)
  2 Kommentare
Thomas Lu
Thomas Lu am 30 Jan. 2019
Thank you for your answer! Can it be plotted using surf only?
I guess this is the correct way though the generated figure is a bit different from the sample output. But anyway millions thanks!! :D
KSSV
KSSV am 30 Jan. 2019
A = [1, 1, 1
2, 1, 2
3, 1, 3
1.1, 2, 4
2.2, 2, 5
3.3, 2, 4
1.2,3,3
2.4, 3,2
3.6, 3, 1] ;
x = A(:,1); y = A(:,2) ; z = A(:,3) ;
m = 10 ; n = 10 ;
xi = linspace(min(x),max(x),m) ;
yi = linspace(min(y),max(y),n) ;
[X,Y] = meshgrid(xi,yi) ;
F = scatteredInterpolant(x,y,z) ;
Z = F(X,Y) ;
surf(X,Y,Z) ;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by