How can I plot a Matlab function in 3d (X, Y, Z) ?. I used the tri = delaunay (x, y) and h = trisurf (tri, x, y, z) function but I do not use it because it distorts the values. I need to get a color map of the distribution. Thank you very much, I hope you can help me.

4 Kommentare

Walter Roberson
Walter Roberson am 24 Okt. 2017
Do you have the formula for the function, or do you only have a set of discrete data points?
Yrobel Lima
Yrobel Lima am 24 Okt. 2017
Discrete data point. X(),Y(),Z() Thanks
KSSV
KSSV am 25 Okt. 2017
Attach your data.....it should be plotted as you expected.
Yrobel Lima
Yrobel Lima am 25 Okt. 2017
Bearbeitet: Walter Roberson am 25 Okt. 2017
Thanks, I attached the file with the values.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

KSSV
KSSV am 25 Okt. 2017

1 Stimme

[num,txt,raw] = xlsread('DATA.xlsx') ;
X = num(:,1) ;
Y = num(:,2) ;
Z = num(:,3) ;
N = 100 ;
x = linspace(min(X),max(X),N) ;
y = linspace(min(Y),max(Y),N) ;
[Xi,Yi] = meshgrid(x,y) ;
Zi = griddata(X,Y,Z,Xi,Yi) ;
surf(Xi,Yi,Zi)

2 Kommentare

Yrobel Lima
Yrobel Lima am 25 Okt. 2017
Thank you very much, your response was very helpful.
KSSV
KSSV am 25 Okt. 2017
Thanking is accepting the answer. :)

Melden Sie sich an, um zu kommentieren.

Walter Roberson
Walter Roberson am 25 Okt. 2017

0 Stimmen

F = scatteredInterpolant(x,y,z);
[X,Y] = ndgrid(linspace(-295,295,500),linspace(-510,510,500));
Z = F(X,Y);
surf(X, Y, Z, 'edgecolor', 'none')

1 Kommentar

Yrobel Lima
Yrobel Lima am 25 Okt. 2017
Thank you very much, your response was very helpful.

Melden Sie sich an, um zu kommentieren.

Produkte

Tags

Gefragt:

am 24 Okt. 2017

Kommentiert:

am 25 Okt. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by