MATLAB Answers

0

How to find intersection of 2 non-equally sized arrays in matlab

Latest activity Answered by KSSV
on 5 Sep 2019
I have two non-equally sized arrays with irregular intervals. How can I find the x,y coordinate of the intersection point in MatLab?
Thanks
Please find the arrays below, so you can test it out yourself:
array1 =
15.60 957.3497697
15.64 954.640625
15.69 951.640625
15.70 950.7979703
15.73 948.640625
15.78 945.640625
15.80 944.2963459
15.83 942.640625
15.87 939.640625
15.90 937.8445259
15.92 936.640625
15.97 933.640625
array2 =
17.00 963.6833105
16.90 961.8656218
16.80 960.640625
16.79 960.048193
16.70 958.2330874
16.66 957.640625
16.60 956.4203125
16.50 954.640625
16.49 954.6077658
16.40 952.7995254
16.33 951.640625
16.30 950.9916166
16.20 949.1858369
16.17 948.640625
16.10 947.3825623
16.00 945.640625
16.99 945.5794704
15.9 943.7806081
15.87 942.640625
15.80 941.9821337
15.70 940.1857592
15.67 939.640625
15.60 938.3918982
15.50 936.640625
15.49 936.5981735
15.40 934.8087692
15.33 933.640625
15.30 933.0196404
15.20 931.2327513
15.17 930.640625
15.10 929.4482142
15.00 927.6638496
14.99 927.640625
14.90 925.8838999
14.83 924.640625
14.80 924.1040247

  0 Comments

Sign in to comment.

2 Answers

Answer by darova
on 5 Sep 2019

Use polyxpoly() or intersections
img1.png

  0 Comments

Sign in to comment.


Answer by KSSV
on 5 Sep 2019

array1 =[15.60 957.3497697
15.64 954.640625
15.69 951.640625
15.70 950.7979703
15.73 948.640625
15.78 945.640625
15.80 944.2963459
15.83 942.640625
15.87 939.640625
15.90 937.8445259
15.92 936.640625
15.97 933.640625];
array2 =[17.00 963.6833105
16.90 961.8656218
16.80 960.640625
16.79 960.048193
16.70 958.2330874
16.66 957.640625
16.60 956.4203125
16.50 954.640625
16.49 954.6077658
16.40 952.7995254
16.33 951.640625
16.30 950.9916166
16.20 949.1858369
16.17 948.640625
16.10 947.3825623
16.00 945.640625
16.99 945.5794704
15.9 943.7806081
15.87 942.640625
15.80 941.9821337
15.70 940.1857592
15.67 939.640625
15.60 938.3918982
15.50 936.640625
15.49 936.5981735
15.40 934.8087692
15.33 933.640625
15.30 933.0196404
15.20 931.2327513
15.17 930.640625
15.10 929.4482142
15.00 927.6638496
14.99 927.640625
14.90 925.8838999
14.83 924.640625
14.80 924.1040247] ;
P = InterX(array1',array2') ;
figure
hold on
plot(array1(:,1),array1(:,2))
plot(array2(:,1),array2(:,2))
plot(P(1,:),P(2,:),'*r')
untitled.bmp

  0 Comments

Sign in to comment.