How to make an overlaying xy-grid?
조회 수: 4 (최근 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
댓글 수: 3
채택된 답변
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!