How to calculate a gradient of a mesh created from a matrix?

Hi, I need to calculate the average and the gradient of a 3D surface made from an OBJ file. When I open this file as text it is what I see (I presume it is a matrix):
# file written by OpenSceneGraph
mtllib fran.mtl
o _Geometry_0
v 347.656 -229.91 -677.344
v 218.75 -97.6563 -637.29
v 171.875 -31.25 -614.025
v 113.281 -47.0539 -618.75
v 181.448 -183.594 -661.719
v 97.6563 27.1677 -708.594
v 212.596 -50.7813 -653.906
.
.
.
# 13583 elements written
vn 0.0387398 0.926983 -0.373098
vn 0.83673 -0.0302438 0.54678
vn 0.0452287 -0.381464 0.923277
vn -0.0127617 -0.51591 0.856547
vn 0.94213 0.00369861 0.335228
vn 0.44112 -0.694334 0.568606
vn 0.63703 -0.652082 -0.411074
.
.
.
# 13583 elements written
f 12990//12990 10802//10802 13120//13120
f 12990//12990 13120//13120 7954//7954
f 7954//7954 13120//13120 9281//9281
f 7954//7954 9281//9281 3060//3060
f 3060//3060 9281//9281 1225//1225
f 3060//3060 1225//1225 9086//9086
f 9086//9086 1225//1225 8350//8350
.
.
.
It is a summarized version of the complete file (it has 51742 lines).
How can I do that?
Thank you!

 Accepted Answer

doc gradient
doc imgradient %IPT required
doc imgradientxy %IPT required

More Answers (0)

Community Treasure Hunt

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

Start Hunting!