フィルターのクリア

Calculating distance between a point and all points of a matrix

5 ビュー (過去 30 日間)
Dario
Dario 2017 年 12 月 18 日
回答済み: Akira Agata 2017 年 12 月 18 日
In the file.mat that I upload there are the x and y coordinates of an antenna and the 2 arrays with x and y coordinates of the entire matrix. I need to compute the distance between the antenna and the other points of the matrix. In particular I need a matrix 1440000x3 with the X_Coord in the 1st column, Y_Coord in the 2nd column and the distances in the 3rd.

回答 (1 件)

Akira Agata
Akira Agata 2017 年 12 月 18 日
If you have Statistics and Machine Learning Toolbox, you can simply use pdist2 to do that.
Otherwise, you can also do that using basic MATLAB function, like:
d = sqrt((X_Coord - X_Ant).^2 + (Y_Coord - Y_Ant).^2);

カテゴリ

Help Center および File ExchangeAntenna and Array Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by