how to initialize distance between two users
1 回表示 (過去 30 日間)
古いコメントを表示
Suppose i have two users. i want to set the distance between them as 1 m.
0 件のコメント
回答 (1 件)
Walter Roberson
2023 年 5 月 16 日
xy0 = randi(100, 1, 2) %cm, 10 m
radius = 10; %cm, 1 m
rand_angle = rand(1,1) * 2*pi;
[dx, dy] = pol2cart(rand_angle, radius);
xy1 = xy0 + [dx, dy]
plot(xy0(1), xy0(2), 'k.', xy1(1), xy1(2), 'b*');
xlim([0 100]); ylim([0 100]);
legend({'original point', 'point 1 m away'});
xlabel('cm'); ylabel('cm')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!