how to create matrix with coordinates and calculate distance?
3 ビュー (過去 30 日間)
古いコメントを表示
n = 3; ri=0.9
source = 1;
destination = 3;
Link=(n*(n-1))/2;
c=2^Link;
NN = toeplitz(Link+1:-1:2)
mask = logical(fliplr(diag(ones(1,Link-1),-1)));
NN(mask) = 1;
for c = 0:2^Link-1
l = bitget(c, NN)
end
i have this type matrix code. l is the matrix.how to calculate distance.
i = 1 :n
j = i+1:n
D(i,j) = sqrt((x(i)-x(j))^2 + (y(i)-y(j))^2);
please help to calculate distance.
0 件のコメント
採用された回答
Simon Chan
2021 年 7 月 9 日
[Ny, Nx] = size(l);
[X,Y]=meshgrid(1:Nx,1:Ny);
D = sqrt(X.^2 + Y.^2)
6 件のコメント
Simon Chan
2021 年 7 月 9 日
Sorry, no idea about interference. You may search previous questions to see whether you can get any solution from others.
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!