instead of using the average of your speeed values, use the length...

speed_avrg = vec_length(speed);


xXxGuitar511
- Programmer