How to make an overlaying xy-grid?
1 次查看(过去 30 天)
显示 更早的评论
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
采纳的回答
Hank
2020-3-2
编辑:Hank
2020-3-2
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!