matlab - Merging Two Data set -
my question related merging 2 matrices different spacing on field both matrices in (frequency space domain (f-x)) , illustrate lets consider : matrix 1 (a x b) matrix 2 (a x c) (a = 1500) frequency samples (they both share same frequency samples number). (b = 168 ) number of receivers first data set (recording stations in field) spacing of 12 meters between b(1) , b(2), 12 meters between b(2) , b(3) , on (c = 196 ) number of receivers second data set (recording stations in field) different spacing b. c(1) c(2) 48 , c(2) c(3) 48 , on.
the total length of receiver line in matrix 1 (168*12) = 2016 m. total length of receiver line in matrix 2 (196*48) = 9408 m.
the line matrix (one) sits on middle part of line two. meaning on lap in many locations both present.(every forth receiver shorter line overlapped receiver longer line) want merge them (add them together) in way final result represent courser spacing (matrix two) added matrix in location overlap.
i hope made somehow clear
if a
, b
2 matrices merged
merged matrix. used size of 196x100 , 168x100 matrices because lazy use 1500 ;). c,d
integers ranging 1 size of first dimension.
a= randi(100, 168 ,100)+20; b= randi(10, 196, 100); c= 1:168; %ranging 1 number of receiver in matrix 1(a) d= 1:196; %ranging 1 number of receiver in matrix 2(b) c= c*12+4704; %distance of each receiver 0 , shifted middle of 2nd matrix d= d*48; %distance of each receiver 0 a= [c', a]; %adding distance first column matrix 1 b= [d', b]; %adding distance first column matrix 2 c= [a;b]; %adding 2 matrices c=sortrows(c,1); %sorting new matrix merged = c(:,2:end); %deleting first column (distance)
what doing generating distance (c,d
) appending them in column 1 appending 2 matrices rowwise , sorting rowwise regarding distance (new column 1). @ end delete distance because didn't ask it.
realized matrix not 168x1500 1500x168, convert it, using (a=a';
)
Comments
Post a Comment