Filter löschen
Filter löschen

How to move random point on an arc by matlab

8 Ansichten (letzte 30 Tage)
omar th
omar th am 24 Nov. 2021
Kommentiert: omar th am 4 Dez. 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

Akzeptierte Antwort

Image Analyst
Image Analyst am 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 Kommentare
Image Analyst
Image Analyst am 3 Dez. 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 am 4 Dez. 2021
I really appreciate your help
Please, would you give me an example, by coding, if you don't mind?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by