matching two matrix with minimum tolerance
Mostrar comentarios más antiguos
a=[0.151418289466622,0.157550272879153,0.164969442201943,0.178618980283435,0.184038910507376,0.185170768702784,0.180965222444822,0.179417614182600,0.179080801809376,0.189674592213221,0.189079438297340,0.192627792926085,0.190608065770002,0.189569497576109,0.184750857017359,0.184783149710191,0.187491320783671,0.184663702765154,0.183614370340317,0.180119836866292,0.174400015443593,0.169373266419925,0.170556398097724,0.167830286639338,0.169045711009969,0.171532461715258,0.173317923462902,0.173278454616107,0.171399702866948,0.171331529404303,0.166964519682180,0.160400926627234,0.158990705694957,0.155009701019144,0.153790688571531,0.151699199875820,0.151418289466622;0.0925151027059182,0.106398906195851,0.117220826258827,0.112729741110032,0.108506254467163,0.102562931866968,0.0961151976800784,0.0905363516643052,0.0744918456113631,0.0565818997125352,0.0553377707260530,0.0523153561458900,0.0502238674501794,0.0508226094430418,0.0441585502326185,0.0423085030993110,0.0402995401741714,0.0373714560001764,0.0385868803708079,0.0385258830621250,0.0363698089807500,0.0416282757405304,0.0445276552986745,0.0475644221867627,0.0486137546115995,0.0710701140816177,0.0748025010410647,0.0770636697595516,0.0786758634074373,0.0825815184666419,0.0853840199462896,0.0844469583125276,0.0827773554329403,0.0870259586146789,0.0861821869824317,0.0882019141385156,0.0925151027059182]
b=[0.174533001196354,0.169958671196354,0.171137641196354,0.168542901196354,0.169521061196354,0.172020101196354,0.173819901196354,0.173774461196354,0.171895711196354,0.171826781196354,0.167078011196354,0.160141801196354,0.158971341196354,0.155079701196354,0.153843161196354,0.152185581196354,0.151925201196354,0.157988931196354,0.165169641196354,0.178380181196354,0.183582971196354,0.184641891196354,0.180504121196354,0.178919041196354,0.178577921196354,0.189108411196354,0.188462391196354,0.191898401196354,0.190519581196354,0.189428551196354,0.184248021196354,0.184287511196354,0.186736071196354,0.184684371196354,0.183839791196354,0.180024511196354,0.174533001196354;0.0369542876197883,0.0417394776197883,0.0446286576197883,0.0475190876197883,0.0483635876197883,0.0709308076197883,0.0746932176197883,0.0772968876197883,0.0789090776197883,0.0828577976197883,0.0859052876197883,0.0849150276197883,0.0835292876197883,0.0876825076197883,0.0868265876197883,0.0884272976197883,0.0924252276197883,0.106154487619788,0.116628577619788,0.112281937619788,0.108227657619788,0.102667327619788,0.0963234876197883,0.0906095576197883,0.0743599076197883,0.0565569976197883,0.0552065576197883,0.0522798276197883,0.0508520176197883,0.0514810176197883,0.0443164776197883,0.0420536176197883,0.0402372476197883,0.0381126376197883,0.0390908976197883,0.0390242976197883,0.0369542876197883]
ww=[];
tol=0.0001;
for j=1:length(a)
th=a(j,1);
[ii,jj]=find(abs(b-th)<tol); %points of polygons 1 in polygon 2
if length(ii)>1
tol1=0.00001;
th1=a(j,2);
c=b(ii,:);
[ii,jj]=find(abs(c-th1)<tol1);
end
w=[a(j,:),b(ii,:)];
ww=[ww;w];
end
i m trying to campare two matrics(x y coordinates) and make a new with high precision . i first took the x coordinates of a but it found those coordinates twice in b so i tried to campare there y coordinates as well but some thing is wrong with the tolerance is guess.. i just want to campare matrix a with b and make new matrix say "ww" which has matching b infront of a for every x y coordinate. i aslo tried" ismembertol " but it also founds some values twice instead of finding them only once due to tolerance
5 comentarios
Walter Roberson
el 15 de Mayo de 2019
?? Your a and b matrices are bit-for-bit identical.
Kevin Phung
el 15 de Mayo de 2019
Editada: Kevin Phung
el 15 de Mayo de 2019
can you be more clear? My understanding is that you want to compare each element in a with b, so a(1) with b(1) , a(2) with b(2), etc. What do you want to do if they match within tolerance? Are you trying to store that index into a matrix W?
Also, your vector a is the same as b..
jahanzaib ahmad
el 15 de Mayo de 2019
jahanzaib ahmad
el 15 de Mayo de 2019
Kevin Phung
el 16 de Mayo de 2019
you say (x,y) of a, but a is a one dimensional vector
Respuestas (0)
Categorías
Más información sobre Vector Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!