Isolate vertical acceleration with quaternion and acceleration data

6 views (last 30 days)
Hi everyone,
I got from an iPhone app : User acceleration (acceleration along the 3 axis of the iPhone without the gravity) and Quaternion.
Considering the iPhone upright:
X : right/left acceleration
Y : vertical acceleration
Z : forward/backward acceleration
I am trying to isolate the vertical acceleration assuming the device may be continuously changing (oscillation).
I am not sure how to proceed, I did that:
%create a vector with my 3 accelerations vectors
AccVector = sqrt(UserX.^2 + UserY.^2 + UserZ.^2);
%rotate the vector using the quaternion data
Acc2Reference_Frame = qvrot(Quat,User);
%rename with axis
Acc2Reference_FrameY = Acc2Reference_Frame(:,2);
Acc2Reference_FrameZ = Acc2Reference_Frame(:,3);
%compute vertical acceleration
VerticalAcceleration = sqrt(Acc2Reference_FrameY.^2 + Acc2Reference_FrameZ.^2);
When I plot the result, it does not look like the good result. I am not sure about how I proceed to achieve my goal.
I am not sure about the qvrot function which I took from the Quaternion toolbox in Mathworks.
Anyone face this problem or have an idea ?
Thank you very much for your help.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!