MATLAB Answers

Need help finding the cartesian coordinates of a projectile in flight.

5 views (last 30 days)
Evan Wray
Evan Wray on 21 Feb 2020
Commented: Evan Wray on 22 Feb 2020
I am given the location of 2 observers on the ground (xy-plane, so z=0), and an azimuth angle (in degrees) as well as an elevation angle (in degrees) from each observer to a projectile in flight. How do I find where these 2 lines of sight intersect? (which would be the x,y,z location of the projectile)
Given Info:
x_obs1 = 671.4971
y_obs1 = 717.2387
z_obs1 = 0
az_obs1 = 75.1148
el_obs1 = 9.3679
x_obs2 = -1.2075*10^3
y_obs2 = 1.6302*10^3
z_obs2 = 0
az_obs2 = -6.4515
el_obs2 = 3.2086
My main problem is that due to the fact that the number have decimals the lines of sight never perfectly intersect. How do I tell if they intersect within 1 or 2 units? (basically if the projectile had a finite volume)

  3 Comments

Jacob Wood
Jacob Wood on 21 Feb 2020
I would convert the az-el numbers into a direction vector, then determine the closest point between the two vectors: http://morroworks.palitri.com/Content/Docs/Rays%20closest%20point.pdf

Sign in to comment.

Accepted Answer

David Goodmanson
David Goodmanson on 22 Feb 2020
Edited: David Goodmanson on 22 Feb 2020
Hi Evan,
Assume the two ground positions are p1 and p2. This method uses the 3d triangle p1,p2,and p3 (the intersection point), assumes that the triangle is closed, and calculates the distances {p1 to p3) and (p2 to p3). Then p3 itself can be calculated two different ways, based on starting from either p1 or p2. These agree reasonably well. For the final result you might consider the average of those two calculations of p3..
x1 = 671.4971;
y1 = 717.2387;
z1 = 0;
az1 = 75.1148;
el1 = 9.3679;
x2 = -1.2075*10^3;
y2 = 1.6302*10^3;
z2 = 0;
az2 = -6.4515;
el2 = 3.2086;
p1 = [x1 y1 0];
p2 = [x2 y2 0];
u1 = [cosd(el1)*cosd(az1) cosd(el1)*sind(az1) sind(el1)];
u2 = [cosd(el2)*cosd(az2) cosd(el2)*sind(az2) sind(el2)];
vgrd = p2-p1;
dgrd = norm(vgrd);
ugrd = vgrd/dgrd;
theta1 = acosd(dot(u1,ugrd));
theta2 = acosd(dot(u2,-ugrd));
phi = 180 - theta1 - theta2;
d2 = dgrd*sind(theta1)/sind(phi);
d1 = dgrd*sind(theta2)/sind(phi);
p3_1 = p1 + d1*u1 % these should agree
p3_2 = p2 + d2*u2
p3_1 - p3_2 % difference is fairly small
norm((p3_1 - p3_2))*2/(d1 + d2) % relative error

More Answers (1)

darova
darova on 21 Feb 2020
Here is what i invented
clc,clear
x1 = 671.4971;
y1 = 717.2387;
z1 = 0;
az1 = 75.1148*pi/180;
el1 = 9.3679*pi/180;
[u1,v1,w1] = sph2cart(az1,el1,1); % create a vector1
x2 = -1.2075*10^3;
y2 = 1.6302*10^3;
z2 = 0;
az2 = -6.4515*pi/180;
el2 = 3.2086*pi/180;
[u2,v2,w2] = sph2cart(az2,el2,1); % create a vector1
plot3([x1 x2],[y1 y2],[z1 z2],'.-b')
hold on
quiver3(x1,y1,z1,u1,v1,z1,1e3)
quiver3(x2,y2,z2,u2,v2,z2,3e3)
hold off
axis equal
view(2)

  1 Comment

Evan Wray
Evan Wray on 22 Feb 2020
this helps to visualize the problem but doesn't return the coordinates of the intersection point

Sign in to comment.

Sign in to answer this question.