MATLAB Help Needed: Find Volume Under Surf/Contour Plot

  • Thread starter Thread starter Lebak
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion focuses on calculating the volume beneath a surf or contour plot in MATLAB using discrete height values from an Excel spreadsheet. The user has defined a grid with x and y coordinates ranging from 50 to 950 mm and seeks assistance in integrating these values to find the total volume of sand in a sandbox. The recommended approach involves summing the height values and multiplying by the grid cell area, utilizing methods such as the rectangle method, trapezoidal rule, or Simpson's rule for accuracy. Excel can also be employed for this calculation.

PREREQUISITES
  • Familiarity with MATLAB syntax and functions, specifically contourm and clabel.
  • Understanding of numerical integration techniques, including the rectangle method, trapezoidal rule, and Simpson's rule.
  • Basic knowledge of Excel for data manipulation and calculations.
  • Ability to interpret and manipulate data from Excel spreadsheets.
NEXT STEPS
  • Research MATLAB's integral function for advanced integration techniques.
  • Learn about the trapezoidal rule and Simpson's rule for numerical integration.
  • Explore MATLAB's data import functions to streamline reading Excel data.
  • Investigate visualization techniques in MATLAB for better representation of contour plots.
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and engineers involved in numerical analysis, particularly those working with contour plots and volume calculations in engineering or scientific projects.

Lebak
Messages
1
Reaction score
0
I need help finding the volume underneath this surf plot. Or contour plot. We have a project including a sandbox with different heights of sand at different points. So create the plot I have used

x = [50:50:950];
y = [50:50:950];
z = 'values from an xls spreadsheet. Containing every height value with 50mm spacing from 50 mm to 950 mm in both x and y directions'.

[c,h] = contourm(x,y,z)
ht=clabel(c,h);
That's all I've done so far, I need to find the volume of sand in our sand box, and I know the width and length of it and also the height at those different locations.

Please help, I'm completely lost!
 
Physics news on Phys.org
You should "integrate" the values just as you would in calculus. Since you have discrete values in your spreadsheet, sum them together and multiply by the grid cell area, according to the rectangle method of calculus. (You can be fancy and use the trapezoidal rule or Simpson's rule, but you probably don't need the extra accuracy.) You can do this in Excel.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
1
Views
3K
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
Replies
15
Views
3K
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K