LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Projectile motion

I am trying to create the simulation of a projectile motion in Labview. Here is vi I am using.  The formula for y I am using is this : y = (tan θ0)x – gx2/2(v0cosθ0)2  

I am using case structure to allow negative values of angles to exist too. I read here in community that for negative angles the formula needs to have + instead of - .  Parabola comes out okay for almost every angle, however for 30 degree it comes out like this: 

kimcheese_1-1637415172316.png

 

 

I suspect it is because x*tan(alpha) is smaller than the second part of the formula, therefore negative values come out. 60 degrees and 45 are okay. How can I get a simulation for 30 degrees?

0 Kudos
Message 1 of 8
(275 Views)

First of all, note that the trigonometric functions want radians (full circle is 2pi, not 360), so a value of "30" corresponds to quite a few turns. Make sure to convert it first!

 

It would be so much simpler to calculate the evolution of  x and y independently (each initialized according to angle and magnitude). Now the speed in x is constant and the speed in y is a simple acceleration. (you can even add a air friction term later if needed). No tan needed.

 

Even easier, do things using complex numbers!

 

 

0 Kudos
Message 2 of 8
(272 Views)

It seems ironic to me that "simpler" is "complex".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 8
(247 Views)

Bill,

 

     "Complex" just isn't "Real", it is also "Imaginary" (at the same time ...).  Still, it does make for a "simpler" (in some mathematical sense) mapping of a 2-Dimensional space than do "real" numbers (which take Two to Tango ...).

 

Bob Schor

Message 4 of 8
(243 Views)

I just read my previous response to my wife, and told her it had 4 Kudos.  She said I should say "If you like this response, don't thank me, thank i ".  But that would just be silly ...

 

Bob Schor

0 Kudos
Message 5 of 8
(114 Views)

4 kudos is just under-rated, these puns are worth being made historic so that someone in the future can quote it as "by Bob Schor"

-Santhosh
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
0 Kudos
Message 6 of 8
(108 Views)

that was fun

projectile.png

 

0 Kudos
Message 7 of 8
(58 Views)

@Bob_Schor wrote:

Bill,

 

     "Complex" just isn't "Real", it is also "Imaginary" (at the same time ...).  Still, it does make for a "simpler" (in some mathematical sense) mapping of a 2-Dimensional space than do "real" numbers (which take Two to Tango ...).

 

Bob Schor


There are many cases where using complex numbers simplifies the math.

In circuit analysis, Ohm's law doesn't work for AC, if you use real numbers.  But if you use complex voltage, complex current, and complex impedance, then Ohm's law does work and you can do circuit analysis without trig.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 8
(39 Views)