필터 지우기
필터 지우기

How to move random point on an arc by matlab

조회 수: 8 (최근 30일)
omar th
omar th 2021년 11월 24일
댓글: omar th 2021년 12월 4일
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

채택된 답변

Image Analyst
Image Analyst 2021년 11월 24일
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
Image Analyst
Image Analyst 2021년 12월 3일
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 2021년 12월 4일
I really appreciate your help
Please, would you give me an example, by coding, if you don't mind?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by