Polar Surface Numerical Integration

5 views (last 30 days)
Dog_Biscuit
Dog_Biscuit on 5 May 2022
Edited: Torsten on 5 May 2022
Hi,
I have a 2D polar surface stored as a 2D matrix, where the values in a given row correspond to the value at a given r (in identical increments i.e. r=0,0.1,0.2 etc. up to a limit) and the values in a given column correspond to the value of the surface at a given θ (also in identical increments i.e. θ = 0, 0.5 ... 359.5). I would like to perform a 2D numerical integration of the surface i.e. calculate the volume under the surface. I do not have an analytical expression for the surface; the surface is somewhat complex.
I've come across methods for 2D integration for a regular grid, but of course a uniform polar-coordinate grid is not uniform in cartesian coordinates. I've seen some methods posted from 10+ years ago involving interpolation for non-uniform grids, but I wondered if there was a cleaner way to do it now.
Essentially, does anyone know of a method or file exchange function either to perform numerical 2D integration for a surface in polar co-ordinates, or a method/file exchange function whereby you input a 2D matrix of surface values, then 2 meshgrids for corresponding x and y values (in cartesian coordinates) that are non-uniform/arbitrary, and the output is the integral under the surface? I have searched the file exchange and not found anything like this.
e.g.
2D_nonuniform_integration_function(2D_surface_matrix,x_mesh_grid,y_mesh_grid)
or
2D_polar_integration_function(2D_surface_matrix,radius_values_vector, theta_values_vector)
Thank you in advance for your help.

Answers (1)

Torsten
Torsten on 5 May 2022
Edited: Torsten on 5 May 2022
If your matrix for the surface values is S = s_ij with s_ij = s(r(i),theta(j)) you can get the volume under the surface as
V = trapz(r,r.*trapz(theta,S,2))
  2 Comments
Dog_Biscuit
Dog_Biscuit on 5 May 2022
Thank you very much! Didn't realise there was such a simple way to do this!
Torsten
Torsten on 5 May 2022
Edited: Torsten on 5 May 2022
And take care to prescribe theta in radians, not in degrees as you do above.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!