필터 지우기
필터 지우기

How to make an overlaying xy-grid?

조회 수: 1 (최근 30일)
Wout Depoot
Wout Depoot 2020년 3월 2일
편집: Hank 2020년 3월 2일
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
Wout Depoot
Wout Depoot 2020년 3월 2일
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 2020년 3월 2일
I'll respond as an 'answer'

댓글을 달려면 로그인하십시오.

채택된 답변

Hank
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개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by