How to make an overlaying xy-grid?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Hank
le 2 Mar 2020
Modifié(e) : Hank
le 2 Mar 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
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!