coordinates - MATLAB - Correlation with Vectors -
i have 2 vectors xyz different sizes. can call data1 , data2, where:
data1 = [1000 3:55 2000; ... 950 2200 4.5; ... 1050 2350 5.5; ... 1025 2500 6; ... 1075 2600 7; ... 1000 2700 8]; data2 = [1000 2650 7.95; ... 1000 2750 8.16; ... 1000 2700 9; ... 1025 3000 10];
the minimum acceptable difference between points 100 meters position (x, y) , 0.2 depth (z).
in case, points between vectors p_data1 = [1000 2700 8] , p_data2 = [1000 2650 7.95], because distance acceptable , depth nearest.
does know function can correlation me? think in matalab there function problem , high performance, calculation thousands of points.
i'm using nested loop, performance bad, because calculate distances, differences between depths every point , filter matrix.
in short, want find points lower , lower depths between 2 vectors of different sizes defined ranges.
i thank help!
data1 = [950 2200 4.5; ... 1050 2350 5.5; ... 1025 2500 6; ... 1075 2600 7; ... 1000 2700 8]; data2 = [1000 2650 7.95; ... 1000 2750 8.16; ... 1000 2700 9; ... 1025 3000 10]; vec1 = data1(:,3); vec2 = data2(:,3); [p,q] = meshgrid(vec1, vec2); output1 = 0; %initial set while output1 == 0 sub = [abs(p(:)-q(:))]; [m,i] = min(sub); inddata1 = floor(i/4); inddata2 = mod(i,inddata1); %this computes smallest possible z %check if works condition 2: checkcolumn1 = abs(data1(inddata1,1) - data2(inddata2,1)); checkcolumn2 = abs(data1(inddata1,2) - data2(inddata2,2)); if checkcolumn1 < 200 && checkcolumn2 <200 output1 = data1(inddata1,:); output2 = data2(inddata2,:); else min(sub) = 1000000 %huge high number remove min end end
so program should ask, basically, first calculates minimum of z column, can add condition has less 0.2 way, assumed there has value smaller 0.2. tries see if first condition can fulfilled. although uses loop search, efficient, jump out of loop finds correct values.
Comments
Post a Comment