Effacer les filtres
Effacer les filtres

How to move random point on an arc by matlab

8 vues (au cours des 30 derniers jours)
omar th
omar th le 24 Nov 2021
Commenté : omar th le 4 Déc 2021
I deployed 2 nodes randomly by Binomial point process and
I wanted to move them on arc for specific distance then keep moving on straight line for specific distance and so forth, instead of Only move these nodes in straight lines.
given the turingangle of arc, length of arc, speed, acceleration of that node
could someone help me with that by using Matlab ? or advice me if this can be achieved by using Matlab and how ?
thanks in adance

Réponse acceptée

Image Analyst
Image Analyst le 24 Nov 2021
Take your two points, and the angle you want to rotate them by, and construct the rotation matrix
r = [cosd(theta), -sind(theta); sind(theta), cosd(theta)];
Then multiply your x,y to get the rotated xy
x = 5;
y = 0
plot([0, x], [0, y], 'b.-', 'MarkerSize', 50, 'LineWidth', 3)
grid on;
% Construct rotation matrix
theta = 25;
r = [cosd(theta), -sind(theta); sind(theta), cosd(theta)];
% Then multiply your x,y to get the rotated xy
xyRotated = r * [x; y];
xr = xyRotated(1);
yr = xyRotated(2);
hold on
plot([0. xr], [0, yr], 'r*-', 'MarkerSize', 30, 'LineWidth', 3)
axis equal; % Need equal so the angle is not squashed.
  9 commentaires
Image Analyst
Image Analyst le 3 Déc 2021
You just have to subtract the drone position so that the drone if at the origin. Then get the incoming/prior angle. And add the desired "turn" to that angle to get a new angle. Multiply by the radius to get the new location. Then add back in the original drone position to shift the system back to its original location.
omar th
omar th le 4 Déc 2021
I really appreciate your help
Please, would you give me an example, by coding, if you don't mind?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by