How to get a value(z) from a specific location(x,y) on the mesh/surf in matlab

Status
Not open for further replies.

Darlis Herumurti

Newbie level 2
Joined
Jan 19, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
15
For example:

[x,y]=meshgrid(1:5:50,1:5:50); % there is a gap in the sequence: 1 6 11 ... not 1 2 3 ...
z = peaks(10); % or some other function
tri = delaunay(x,y); % create triangulation
trisurf(tri,x,y,z) % displaying the data on the surf.

<a title="trisurf.png" href="http://obrazki.elektroda.pl/1634831300_1390149309.png"><img src="http://obrazki.elektroda.pl/1634831300_1390149309_thumb.jpg" alt="trisurf.png" /></a>

Question:
I would like to store the value of the surface (z) for each location (x,y), something like image data/matrix
is there a built-in function to get the from the surface ?

Thanks for your kind help.

Sincerely,
Darlis
 

Dear all,

After some searching and reading, I think I've found the solution of my problem with the matlab built-in griddata() function.

[xq,yq]=meshgrid(1:50,1:50);
zq = griddata(x,y,z,xq,yq);

CMIIW.

Sincerely,
Darlis


 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…