LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to show rotating vectors

HI,
I have to plot a vector with magnitude and phase value given at the start, and should then rotate at a certain speed. It should be shown as a arrow mark of the given magnitude and pointing at the phase angle specified. This vector should then be rotoated at certain speed (say 50 rpm etc).
Please let me know how I can do this, asap.
Thank you.
0 Kudos
Message 1 of 5
(3,140 Views)
One way: Use an X-Y graph. You probably want autoscaling OFF in both axes. Manually set the min and max values for bothe axes.

Call X0,Y0 the center point for your display. Probably 0 and 0, but you can use other values, if needed.

Given magnitude M and phase angle A, compute the endpoint of the line:
R = A * pi / 180 (compute angle in radians)
S = sin (R) (compute the sine of the angle)
C = cos (R) (compute the cosine of the angle)
X1 = X0 + C * M (compute the X endpoint)
Y1 = Y0 + S * M (compute the Y endpoint)

Assemble {X0,Y0} and {X1,Y1} into an array of X-Y clusters, and feed it to the graph.

You have a line of magnitude M, at angle A
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 5
(3,140 Views)
Thank you....I shall try this right away.
0 Kudos
Message 3 of 5
(3,140 Views)
HI,
I have to display a few vectors in the same graph. I did this by making two cluster array and then joining them. This way, I am able to display the vectors, but I am not able to display them in different colors, nor am I able to label the vectors.
I have attached the small program that is used to create two vectors and display them. Can you please suggest me ways of incorporating color and label information.
Thank you.
0 Kudos
Message 4 of 5
(3,140 Views)
Look at the help for an X-Y graph.

That says that for a multi-plot graph, you want an ARRAY of single-plot graphs.

Just take the graph you generated my way, and run it thru a BUILD ARRAY function. Stretch the BUILD ARRAY to include 2 or more inputs, and build the other plots the same way (use a subVI).

Then you can color plot #0 RED, plot #1 GREEN, whatever.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 5
(3,140 Views)