![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537526/image.png)
How to calculate the projection of point onto a line
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I would like to calculate the trajectory volatility (TV) defined as the standard deviation between the real trajectory and the ideal trajectory.
The formula is the following:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537376/image.png)
where xi (i= 1,2,3...N, the order of point on the trajectory) is the actual measurement point sampled from the trajectory, and pi is the corresponding projection onto the ideal trajectory as shown in the pic
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537381/image.png)
Both actual and ideal trajectories are 100x3 matrices of x,y and z coordinate.
Here a pic for a better understanding:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537386/image.png)
(purple one actual, green line ideal)
Do you have any suggestion on how to do calculate pi, so the projection on the ideal trajectory given xi?
Thanks!
4 Kommentare
Antworten (2)
darova
am 4 Mär. 2021
Here are some exaplanations
Let
be some point on the line
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538751/image.png)
cross product: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538756/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538756/image.png)
distance you want:
→ ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538766/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538761/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538766/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/538771/image.png)
Let me know if you need more explanations or some example
2 Kommentare
darova
am 5 Mär. 2021
- Yes,
is any point on a real trajectory
- No, you don't need to choose another
- What do you mean by "each axis separately"?
Sorry, i forgot you to explain:
component is needed to create unit vector. So
point here is another point on the line
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/539996/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/540001/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/540006/image.png)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!