Hello, everyone,
i would like to integrate the values over a very specific square area of my surf plot to determine the volume of this area.
Does anyone have any idea how I can do that? I have scanned and obtained a matrix with 256x256 Z-values. Using surf, Matlab automatically creates the 3D plot from the z-values and assigns X and Y to the values 1-256 . Afterwards I subtracted the surfaces from each other. Now I would like to determine the volume of the surface in the middle (look at the top view picture).
I have tried it with intergal2:
Code:
I = integral2(Subtraction(85:185, 85:185), 'all')
Subtraction is the matrix of the subtracted areas, 85:185 is to indicate the X or Y area in which the integral is to be formed and with "all" I tried to tell Matlab to form the integral over the whole area.
I get the following error message:
Error using integral2 (line 67)
Not enough input arguments.
Error in program (line 39)
Integral = integral2(subtraction)
I also used trapz, but if I do this I get a vector 1x101 and not a single value
I = trapz(Subtraction(85:185, 85:185))