how to know 'y' values perpendicular to a line?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Sierra
il 30 Mag 2022
Risposto: Sai Charan Sampara
il 22 Giu 2022
I have longitude, latitude, altitude data of aircraft. and I plotted trajectoris of aircrafts(I only drawed mean trajecorty here. and drawed 2D)
a left image is what I plotted with patch(using percentile). but it's something wrong.
percentile ex) If percentile is 100, the patch contain every trajectory. In my case, I use 97.5 percentile.
I need to plot like a right image. the line between two y values should be perpendicular to a mean trajectory(black line).
I know it's because I assgin two y values(not to mean trajetroy's y value) to same value as mean trajectory's y value.
but I don't know how to get a two y values which is perpendicular to each mean trajectory point.
I will attach my code for your understanding.
Thanks.
for i = 1:length(33R)
plot3(33R(i).Longitude, 33R(i).Latitude,33R(i).BAlt)
hold on
end
hold on
xlabel('X')
ylabel('Y')
zlabel('Z')
yv = [];
yv = [yv;mean_trajectory.Latitude]; % I fixed 'y' values I think it's a problem.
for i = 1:length(trajectory) % trajectory is every trajectory of aicraft incluing mean trajectory.
xptcl = prctile(trajectory(i).Longitude,[2.5 97.5]); % I used percentile when making a patch
zptcl = prctile(trajectory(i).Altitude,[2.5 97.5]); % same
xl(i,:) = xptcl;
zl(i,:) = zptcl;
patch([xptcl flip(xptcl)], [0 0 0 0]+yv(i), [[1 1]*zptcl(1) [1 1]*zptcl(2)],'r', 'FaceAlpha',0.5)
end
plot3(xl(:,1), yv(:), zl(:,1), '-k', 'LineWidth',2)
plot3(xl(:,1), yv(:), zl(:,2), '-k', 'LineWidth',2)
plot3(xl(:,2), yv(:), zl(:,1), '-k', 'LineWidth',2)
plot3(xl(:,2), yv(:), zl(:,2), '-k', 'LineWidth',2)
grid on
0 Commenti
Risposta accettata
Sai Charan Sampara
il 22 Giu 2022
A line is defined uniquely by a point and a slope or by two points. If you are looking for a line that is perpendicular to the line segment joining the two points, the slope is already fixed in 2 Dimensional space. For three dimensional space find a line that is in the plane containing both the line segments such that it is perpendicular to the first line segment. If the slope is known from this condition then the line can be drawn from any point on the first line segment. Preferably the mid-point of the first line segment.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!