How do I find the intersection area of two bathymetry grid?

1 回表示 (過去 30 日間)
eevee
eevee 2014 年 10 月 23 日
コメント済み: Geoff Hayes 2014 年 10 月 23 日
Hi,
I have two bathymetry with different sizes.
My task is to
FIRST, find the intersected area of these two bathymetry.
p/s: Please find attached image for the illustration of my task in case I'm bad at describing it. I need to find the minimum and maximum x and y values that intersected, and from there, I've got values to define my range. Next, the shaded area in the picture contains z-values from both files that I need to subtract in order to see the difference in water level.
SECOND, define a new range and spacing
THIRD, subtract my z-values within the intersected area.
FOURTH, plot
So, I'm stuck at the subtraction part because I have different size matrices.
The following is my code
a=load('com_2014.txt');
b=load('com_2011test2.txt');
% FIND THE XY MIN AND MAX VALUES OF EACH VARIABLE
xminmin=[min(a(:,1));min(b(:,1))];
xmin=max(xminmin);
% X MAX
xmaxmax=[max(a(:,1));max(b(:,1))];
xmax=min(xmaxmax);
% Y MIN
yminmin=[min(a(:,2));min(b(:,2))];
ymin=max(yminmin);
% Y MAX
ymaxmax=[max(a(:,2));max(b(:,2))];
ymax=max(ymaxmax);
% FIND THE INDICES BETWEEN XY MIN AND MAX
% FOR MATRIX a
aInd=find((a(:,1)>=xmin) & (a(:,1)<=xmax) & (a(:,2)>=ymin) & (a(:,2)<=ymax));
xa=a(aInd,1);
ya=a(aInd,2);
za=a(aInd,3);
% FOR MATRIX b
bInd=find((b(:,1)>=xmin) & (b(:,1)<=xmax) & (b(:,2)>=ymin) & (a(:,2)<=ymax));
xb=b(bInd,1);
yb=b(bInd,2);
zb=b(bInd,3);
And I'm stuck after this. HELP! URGENT!!!
Thanks!!!!!!!!
  1 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 10 月 23 日
eevee - you may need to describe (or attach) your two data files. Are they simply just three columns of data with the first and second columns corresponding to the x and y coordinates respectively (and the third column the water level)? Are these coordinates integers or real numbers? (If the former you may be able to create matrices from your data where the (x,y) element of the matrix is the z (water level) value.)

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeOceanography and Hydrology についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by