How to make an overlaying xy-grid?

4 visualizaciones (últimos 30 días)
Wout Depoot
Wout Depoot el 2 de Mzo. de 2020
Editada: Hank el 2 de Mzo. de 2020
Hi,
I want to calculate difference in volumes of the sea bed over the years. For that I got txt-files with xyz-coordinates of difference areas over the years.
I have made variables from the txt-files for all datasets, e.g. x_GLLWS00 y_GLLWS00 z_GLLWS00 (all 2740061x1 double).
Now I have to make an equidistant grid (xy-grid) with steps of 50m, than I'll calculate the 'mean' z-value for each of these 50x50 surface areas. The difference with a reference plane will be calculated and multiplied by the area size to obtain the volume (between surface and reference plane). Afterwards I'll check the difference in volume over the years of bigger sections to in the end obtain and volume change m³/year within the sections.
My question is how to make this 50x50 grid overlaying the irregular xyz coordinates and is it possible to plot the xy coordinates together with this grid?
Thanks in advance
  3 comentarios
Wout Depoot
Wout Depoot el 2 de Mzo. de 2020
I want to interpolate the z-values of all the points within the 50mx50m grid into 1 'mean' z-value (linear regression, located in the middle of the 50x50 grid).
So in the end I want to obtain a 50x50m grid with a single z-value which I'll compare to z-values from bathymetries over the years.
Hank
Hank el 2 de Mzo. de 2020
I'll respond as an 'answer'

Iniciar sesión para comentar.

Respuesta aceptada

Hank
Hank el 2 de Mzo. de 2020
Editada: Hank el 2 de Mzo. de 2020
Since your grid is symmetric, create a vector describing the mesh points along one dimension.Then use meshgrid grid to make matrixies that describe the X and Y location.
xm = 0:50:50*50; % 50 points from 0 to 2450, in steps of 50
[X,Y] = meshgrid(xm,xm);; % use xm twice for symmetric grid.
I'm not sure what your dataset looks like, but conditioning a 2d linear regression may be overly complicated.
Maybe to sample nearby meshpoints you say:
Z = zeros(50); % blank elevation data
for m = 1:numel(X); % for each index in X (this loops over the whole matrix)
xrng = XDATA < X(m)+25 & XDATA > X(m) - 25; % points where x data withing 25 meters
yrng = YDATA < Y(m)+25 & YDATA > Y(m) - 25; % y data withing 25 meters
Z(m) = mean(ZDATA( xrng & yrng)); % take the mean of elevation points within grid range
end

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by