필터 지우기
필터 지우기

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

조회 수: 2 (최근 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 CenterFile Exchange에서 Automotive에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by