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

10 views (last 30 days)
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.

Accepted Answer

Torsten
Torsten on 27 Jun 2022
Edited: Torsten on 27 Jun 2022
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 Comments
Torsten
Torsten on 30 Jun 2022
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

Sign in to comment.

More Answers (0)

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!