Averaging and locating data points using a 2D grid mesh
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a file with the data: x-coordinate, y-coordinate, and f(x,y). For example: 2.33124, 5.90821, 453.009374 .
I would like to use a 2-d square grid with a mesh of, say 50 x 50 boxes to find the average of the f(x,y) values that lie within each box of the grid. I need to then store the average of each box with the box's coordinates on the grid i.e., (1,1),(1,2),(1,3)...(2,1),(2,2)...into the elements of a 2d array.
Are there any functions in matlab which can be used to do this? How can I use Matlab to find out which (x,y) pairs are within which boxes of the grid? What I want to do is simple, but I'm just not sure where to begin.
Thanks!
Adam
0 commentaires
Réponses (1)
Image Analyst
le 20 Août 2013
You can use TriScatteredInterp(), or griddedInterpolant() to make a solid 2D matrix. Then just use mean2 to get the mean in any particular block
thisMean = mean2(solidArray(row1:row2, col1:col2));
0 commentaires
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!