user777021
user777021

Reputation: 73

How to find the speed using x,y,z axis values?

hai,In my application i want to calculate the spped based on x,y,z values.So How to find the speed using x,y,z axis values ?

Upvotes: 3

Views: 9690

Answers (2)

iOSDeveloperz
iOSDeveloperz

Reputation: 7

keep update interval of accelerometer to 1 i.e.

accelerometer.updateInteval=1f;

then in the following delegate method

-(void)accelerometer:(UIAccelerometer *) acc didAccelerate:(UIAcceleration *)acceleration {
}

get the acceleration value by acceleration.x

You will have to store the previous value in some variable

difference between the previous value and current value will give you the speed along x axes

Upvotes: -2

bradley.ayers
bradley.ayers

Reputation: 38382

Integrate the acceleration of each axis then add together the velocity vectors, and finally take the magnitude. You now have speed.

Upvotes: 3

Related Questions