integration - Calculate the volume under a gridded surface in Matlab -
i have non-uniformly spaced x,y,z data (eastings, nothings , thickness) have gridded , plotted surface using meshgrid
, griddata
, surf
.
i calculate volume under surface i'm struggling apply other answers question dataset , code in question (i complete matlab beginner).
any ideas how (on matlab version 2011b)? in advance.
load e.txt, load n.txt, load z.txt; [xi, yi] = meshgrid(25.351639:0.00025:25.426483, 36.363799:0.0005:36.458845); zi = griddata(e,n,z, xi,yi, 'linear'); surf(xi,yi,zi)
griddata
interpolates data it's uniformly spaced on xi
,yi
,zi
grid. sum zi
values , multiply result base area, dx*dy
:
dx = 0.00025; dy = 0.0005; vol = dx*dy*sum(zi(:));
if of zi
values nan, instead:
vol = dx*dy*sum(zi(~isnan(zi)));
Comments
Post a Comment