Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hello everyone,
I'm currently working on a task for my marine engineering studies where I need to calculate and plot vectors in Mathcad. The task involves adding vectors and representing them as arrows in a diagram. I’ve managed to define the vectors and perform the calculations, but I’m struggling with how to effectively plot them as arrows in Mathcad.
Here’s a brief outline of what I’m trying to do:
I’m unsure how to add arrows to represent them properly. Is there a way to directly add arrows in Mathcad, or would I need to annotate the plot manually? If anyone has experience with this or any tips on the best approach, I would greatly appreciate your help!
Thanks in advance for your assistance!
Best regards,
Michael
Solved! Go to Solution.
The function "_Vec" which basically stems from Tom Gutmann shows it all.
To plot a couple of points you need to provide their x-coordinates in a vector at the abscissa and a vector with the corresponding y-coordinates for the ordinate.
Here this is done by manipulation a vector of complex numbers, where the real part would be the x-coordinates and the imaginary part the y-coordinates.
The basic vector for the arrow is
written as a row vector and then transposed for space reasons.
The first entry 0 = 0 + 0 i denotes the origin (0/0). This is the starting point and next point is (-1/0.15) etc. The polygon ends again in the origin. You can see that it forms an arrow head with length 1 pointing to the right at the origin.
The function _Vec creates a vector for a line from the start point P to the endpoint P2 and then adds this arrow head which has first to be moved to the endpoint ("P2+"), then turned in the correct direction (the multiplication by V/|V| )and scaled to the desired length (multiplication by L).
A clever use of complex numbers as otherwise especially the turning would have been much more elaborate.
You now can play with the basic arrow head, make it wider or narrower or omit the vertical line
To get a plain arrow head, _Vec needs to be slightly modified
You would need to plot the arrows 'manually', which means you have to create a plot consisting of at least 3 line segments forming the main part of the vector and its arrow heads.
Maybe this can be of some inspiration: https://community.ptc.com/t5/PTC-Mathcad-Blog/Vector-Field-Plots-in-2D-for-Mathcad-15-and-Prime-2/ba-p/448198
Here’s a brief outline of what I’m trying to do:
- Define vectors (e.g., A = [Ax, Ay], B = [Bx, By])
- Calculate the sum of the vectors (e.g., C = A + B)
- Plot these vectors on a 2D diagram with arrowheads indicating their direction.
In this outline you forgot to define which of the infinite number of vector representatives you would like to plot.
Guess it would be beneficial to provide a starting point.
Or you could define a vector by start and end point and length of the arrow head. Here is a slight modification of the arrow function in the vector field sheet - the absolute length of the arrowhead is a separate third function argument and its not relative to the vector length.
"Vec" is a wrapper for "_Vec", it awaits start and endpoint as 2x1 matrices and the arrowhead length as its arguments.
If you like it more you sure could easily modify it so that the second argument is the vector itself - simply replace P2-P1 by P2 😉
Another example
You can see in the linked worksheet for vector field plots the modification necessary for a differently shaped arrow head
P10 worksheet attached
Thank you Werner
this is some great vectors
Looking at this i think i need to go a bit backwords, to learn basic skills.
is there or can you write a basic how to or a step by step guide how to plot a vector with arrow in prime 9 0r 10. i have both.
thank you in advance.
best regards
Michael
The function "_Vec" which basically stems from Tom Gutmann shows it all.
To plot a couple of points you need to provide their x-coordinates in a vector at the abscissa and a vector with the corresponding y-coordinates for the ordinate.
Here this is done by manipulation a vector of complex numbers, where the real part would be the x-coordinates and the imaginary part the y-coordinates.
The basic vector for the arrow is
written as a row vector and then transposed for space reasons.
The first entry 0 = 0 + 0 i denotes the origin (0/0). This is the starting point and next point is (-1/0.15) etc. The polygon ends again in the origin. You can see that it forms an arrow head with length 1 pointing to the right at the origin.
The function _Vec creates a vector for a line from the start point P to the endpoint P2 and then adds this arrow head which has first to be moved to the endpoint ("P2+"), then turned in the correct direction (the multiplication by V/|V| )and scaled to the desired length (multiplication by L).
A clever use of complex numbers as otherwise especially the turning would have been much more elaborate.
You now can play with the basic arrow head, make it wider or narrower or omit the vertical line
To get a plain arrow head, _Vec needs to be slightly modified