フィルターのクリア

Find intersection of two matrices of data.

3 ビュー (過去 30 日間)
Andrew Wiebe
Andrew Wiebe 2016 年 1 月 24 日
コメント済み: Walter Roberson 2016 年 1 月 25 日
I have 2 matrices of data, each two dimensions, and I want to find the points at which the lines from these matrices would intersect. Neither matrix is derived from an equation, simply arbitrary points that form a line. What command or process must i use in order to find these Points of Intersection?

回答 (1 件)

Star Strider
Star Strider 2016 年 1 月 24 日
One possibility:
A = randi(99, 10, 15); % Create Data
B = randi(50, 15, 10); % Create Data
[C,ia,ib] = intersect(A,B); % Intersection Indices
[Ar,Ac] = ind2sub(size(A), ia); % Convert Indices To Matrix Subscripts
[Br,Bc] = ind2sub(size(b), ib); % Convert Indices To Matrix Subscripts
This works, but I haven’t rigorously checked it with the matrices.
  2 件のコメント
Andrew Wiebe
Andrew Wiebe 2016 年 1 月 25 日
Will the intersect command only find shared points that are already established or will it interpolate the intersection if it is in-between some defined points?
Walter Roberson
Walter Roberson 2016 年 1 月 25 日
intersect() will not interpolate.
Your question is not generally solvable as you give no information about the intended shape of the lines. For any given finite set of points, there is an infinite number of continuous functions that would exactly match those values at the given location, but each of those continuous functions is a different line.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by