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 9
(2,119 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 9
(2,116 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 9
(2,091 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 9
(2,087 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

Message 5 of 9
(1,958 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
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 6 of 9
(1,952 Views)

that was fun

projectile.png

 

0 Kudos
Message 7 of 9
(1,902 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 9
(1,883 Views)

@paul_cardinale wrote:
There are many cases where using complex numbers simplifies the math.

 


Here's my quick attempt using complex only (no explicit trigonometry!). I am sure it can be polished up a bit. 😄

 

 

 

altenbach_1-1638732250535.png

 

 

 

0 Kudos
Message 9 of 9
(1,841 Views)