Figuring out formula from graph

  • Thread starter Thread starter AluminX
  • Start date Start date
  • Tags Tags
    Formula Graph
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 12K views
AluminX
Messages
2
Reaction score
0
Hi, I'm not sure if this is the best forum to post this question but I'm going to give it a try.
I would like to be able to figure out a formula from a given graph( http://img46.imageshack.us/img46/8172/graphun4.jpg ). basically that would be the motion of a bouncing ball. Ultimately what i would like to do is figure out how to simulate those kind of motions into flash via action script to build bouncing windows, drop down menues etc.
I guess i can go and do some research on snippets and copy past but i'd rather try to understand it how it works :P.
thank you in advance.
 
Last edited by a moderator:
Physics news on Phys.org
MOST functions can't be easily defined in a formula.

I'd make it a piecewise function. The first "hump" will be a kinematic equation I'm sure, then after you analyze the collision with the ground you can keep using kinematics.
 
You can always fit a curve with N 'humps' with a polynomial with N terms
( if you're an astronomer you can fit 1 hump with N terms ;-)

For 'real world' objects you could look at Fourier series.

For a simple bouncing simulation I would just make each bounce x% smaller than the previous, adjust x to get the degree of damping you want. This prettry much models the real energy loss in a bouncing ball.
 
ohh the graph doesn't represent the trajectory of a bouncing ball, it represents height vs time. how high would the ball be at x seconds. sorry :P.
basically what i need is a simple formula, for example if i want to make a point a de-acceleration, i'll just do:
1.dist= final_x-current_x;
2.acel = .7;
3.next_x = current_x+(dist*acel)
4.repeat step 3 until dist<=0;

basically the object will move "dist" many units every tick(second).

I'm looking for a similar formula to simulate bouncing. The formula should (lets say y=100 and a tick of 5 seconds) make y=0 after 5 seconds, y=60 after 5 more seconds; than back to 0 after 5 more secs, y=40,y=0,y=20,y=0, y=7,y=0,y=1,y=0,y=0 and than y stays constant at 0.
Now i understand the concept is just that i don't have the knowledge to come up with a formula. I'm not sure if I'm making myself clear.
 
The simplest way to get something that looks like a bouncing ball would be to use y=sin(x)^2.
Not quite the correct shape ( a parabola ) but unless you are writing physics simulations it will look close enough. You can reduce Y on each round by a factor if you want to loose energy.