MATLAB Answers

Averaging scattered data in a 2D grid mesh

17 views (last 30 days)
Vileda on 29 Oct 2019
Answered: Sai Sri Pathuri on 6 Nov 2019
I have a file with data as x-coordinate, y-coordinate, z value.
I would like to use a 2-d square grid2-d square grid with a mesh of choosen dimension (20x20) to find the average of the z values of points that fall in the same grid cell.
I computed a mesh (using meshgrid function) that covers all my points, but I can't figure out how to average the points inside each grid cells.
Are there any functions in matlab which can be used to do this?
I'm new with matlab, so sorry if this is a very simple question.
Thanks for your help!

  1 Comment

darova on 29 Oct 2019
Maybe you are looking for griddata. It can create surface (2D matrices) for your vectors

Sign in to comment.