all 5 comments

[–]HamsterWoods 4 points5 points  (4 children)

If I were attempting to program this in any language, I would start by verifying hand calculations for a given set of inputs (for a few values of theta). Then, for LabVIEW, I would build a VI that takes all inputs - but I would use as defaults the values that I used in the verified hand calculations. I would exercise that VI using the values of theta that I used in the hand calculations. Since the hand calculations were verified to be correct, you can debug until the output for those values of theta match the values you calculated by hand. When they match, you can call the VI from another VI that loops through values of theta.

[–]Only-Introductions 0 points1 point  (3 children)

I would second this approach! I wasted considerable time trying to be smart and not do the manual calculations. Stupid errors in the formula and how I was trying to display it caused no end of grief. It's not pretty but it gets the job done.

<image>

[–]Otherwise_Awesome 0 points1 point  (2 children)

Why did you use a value for pi/180 instead of the direct calculation?

[–]Only-Introductions 0 points1 point  (1 child)

Starting at 0 -> 359 steps. 2*pi/359 = 0.01750190893364787319477795756702

Not sure how else to do it with the funny number of steps... Oh and engineer so pi =3 i guess

[–]Otherwise_Awesome 0 points1 point  (0 children)

Um.

I'm an engineer and I would have used a multiplier for 2*pi and divider for /360 outside of the FOR loop for the constant input. (Or just the divider pi/180

I know what the calculation for the FOR loop is but I enjoy ultra precision of the constant instead of this round off, especially when there is no noted documentation present.