Polar Surface Numerical Integration

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.

답변 (1개)

Torsten
Torsten 2022년 5월 5일
편집: Torsten 2022년 5월 5일

1 개 추천

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

Dog_Biscuit
Dog_Biscuit 2022년 5월 5일
Thank you very much! Didn't realise there was such a simple way to do this!
Torsten
Torsten 2022년 5월 5일
편집: Torsten 2022년 5월 5일
And take care to prescribe theta in radians, not in degrees as you do above.

댓글을 달려면 로그인하십시오.

카테고리

제품

릴리스

R2021b

질문:

2022년 5월 5일

편집:

2022년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by