Integrating a 2D image plotting with non-uniform mesh(spacing)

Hi,
I'm trying to calculate the net power of the surface by integrating the Poynting vector of each grid, but since the grid size isn't uniform, it's impossible to just add them up and multiply the total area. Is it possible to integrate a 2D image plotting with non-uniform mesh(spacing)?
Many thanks!

 Accepted Answer

load('P_0_swg.mat')
x = lum.x ;
y = lum.y ;
Z = lum.z ;
[X,Y] = meshgrid(x,y) ;
xi = linspace(min(x),max(x),200) ;
yi = linspace(min(y),max(y),200) ;
[Xi,Yi] = meshgrid(xi,yi) ;
Zi = griddata(X,Y,Z',Xi,Yi) ;
pcolor(Xi,Yi,Zi)
shading interp

2 Comments

Hi,
Thank you for replying, I'm thinking of is it possible to integrate the 2D plot and return a numerical number.

Sign in to comment.

More Answers (0)

Products

Release

R2022b

Asked:

on 21 Dec 2022

Commented:

on 21 Dec 2022

Community Treasure Hunt

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

Start Hunting!