Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi,
I have a piece of programming but I'm having trouble understanding all the steps and the programming to reach the product graph. Can someone document what is happening in the attached? I hope it will be a step to understanding more complex programs.
Solved! Go to Solution.
Which part do you have problems with?
I guess the redefinition od "arg" should be clear - it just avoids an error in case the argument is zero (and so the argument/angle of that complex number is by definition undefined.
"AHd" stands for "ArrowHead" and forms an arrowhead pointing to the right using the length given by variable "AHdSize". AHdAspect controls the width (or height in this position) of the arrow head. 1/4 means that the width of the head is 25% of its length. try different values like 0.1 or 0.5 to see the difference.
The function Vec was originally meant to draw an arrow in an xy-plot using real and imaginary parts (as in the pic above), but of course the result can equally well be used in polar plot with magnitude and arg as you did.
In the xy-plot (complex Gauß plane) your example would look like this
The function uses two arguments, the first one (P) specifies the starting point of the arrow and the second the direction and length.
P2 is calculated in the function and is the end point of the arrow. So the first line stacks starting point and end point in "r" (see it as "result" or "return value"). So far this would just draw a straight line.
Then the arrow head AHd is rotated in the correct position by multiplying it with the normalized V and added to "r" to finish the full arrow.
This is then returned after a NaN is attached. Reason for doing the latter is to enable you to stack multiple arrows which are then separated - like you did with your two arrows in "voltages".
BTW, this method of drawing arrows is based on (was stolen from) a sheet created by the legendary collab Tom Gutman.
Which part do you have problems with?
I guess the redefinition od "arg" should be clear - it just avoids an error in case the argument is zero (and so the argument/angle of that complex number is by definition undefined.
"AHd" stands for "ArrowHead" and forms an arrowhead pointing to the right using the length given by variable "AHdSize". AHdAspect controls the width (or height in this position) of the arrow head. 1/4 means that the width of the head is 25% of its length. try different values like 0.1 or 0.5 to see the difference.
The function Vec was originally meant to draw an arrow in an xy-plot using real and imaginary parts (as in the pic above), but of course the result can equally well be used in polar plot with magnitude and arg as you did.
In the xy-plot (complex Gauß plane) your example would look like this
The function uses two arguments, the first one (P) specifies the starting point of the arrow and the second the direction and length.
P2 is calculated in the function and is the end point of the arrow. So the first line stacks starting point and end point in "r" (see it as "result" or "return value"). So far this would just draw a straight line.
Then the arrow head AHd is rotated in the correct position by multiplying it with the normalized V and added to "r" to finish the full arrow.
This is then returned after a NaN is attached. Reason for doing the latter is to enable you to stack multiple arrows which are then separated - like you did with your two arrows in "voltages".
BTW, this method of drawing arrows is based on (was stolen from) a sheet created by the legendary collab Tom Gutman.
Thank you very much! Big help.
