I need help or a website explaining the best algorithm to calculate the velocity of a stream of numbers as they occur. Basically I have an animation of a spinning wheel and have access to its rotation values in an event as they occur and I want to play different sounds depending on the steepness of the speed at which the animated wheel spins.
Do I need to determine a sample size of the past X number of values and determine their slope? and just keep checking that value as some representation of the wheel's speed? Any algorithms or psuedo-code would be appreciated.
thanks!How do I determine the rate of change / velocity of an array of numbers as they occur in real-time?
鈾?angular position u =w*t; let 螖t is time step;
let max_w is proportional to highest pitch max_f,
i.e. f=r*w, where r is a constant; then
鈾?proc spin;
u2=0;
sound_off;
m: hold(螖t);
pick_up(u1);
if u1=-1 then go_to m1;
w=u1-u0;
f=r*w;
set_pich(f);
sound_on(f);
u0=u1;
go_to m;
m1: sound_off;
retutn;
proc_end;How do I determine the rate of change / velocity of an array of numbers as they occur in real-time?
That's what I thought you would do. Basically the point of a graph at any one time, is the slope or gradient.
There's a website hyperphysics, that explains a lot about phys in general. Usually there are applet's that talk about these things as well.
In my physics course, I can remeber a video showing the rate of change of y, and the rate of change of x
Basically it was just the slope at each point on the line (with a straight tangent line through it), and moving along the curve
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment