Finding the coordinates of a point given the gradient, distance and one set of coordinates

조회 수: 8 (최근 30일)
Hi im trying to find the coordinates of a point given the gradient (m), distance (s) and one set of coordinates (x1,y1). I have a simultaneous equation that needs solving but cannot seem to find the numerical answers i have calulated by hand in MATLAB.
m = y2-y1/x2-x1 and s = sqrt((x2-x1)^2 + (y2-y1)^2)
given that:
m = 0.4
x1 = 10
y1 = 4
s = 15
and solving to find x2 and y2.

채택된 답변

Torsten
Torsten 2022년 6월 27일
편집: Torsten 2022년 6월 27일
m = 0.4;
x1 = 10;
y1 = 4;
s = 15;
z = [x1 y1] + s/sqrt(1+m^2)*[1 m];
x2 = z(1)
x2 = 23.9272
y2 = z(2)
y2 = 9.5709
  댓글 수: 13
Torsten
Torsten 2022년 6월 30일
v = 2; %harbor porpoises swim between 0.5 - 4.2 m/s
t = 5; %seconds
s = v*t; %metres
x0 = 0;
y0 = 0;
x1 = [1;2;3;4;5];
y1 = [6;7;8;9;10];
d = sqrt((x1-x0).^2+(y1-y0).^2); %Pythagoras Theorem for distance between the 2 (Source and Reciever) points
m = (y1-y0)./(x1-x0); %Gradient between the points
z1 = [x1,y1] + diag(s./sqrt(1+m.^2))*[ones(size(x1)),m]
z1 = 5×2
2.6440 15.8639 4.7472 16.6152 6.5112 17.3633 8.0614 18.1381 9.4721 18.9443
z2 = [x1,y1] - diag(s./sqrt(1+m.^2))*[ones(size(x1)),m]
z2 = 5×2
-0.6440 -3.8639 -0.7472 -2.6152 -0.5112 -1.3633 -0.0614 -0.1381 0.5279 1.0557

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by