Subtraction of gravity from accerelometer data
9 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm having some trouble subtracting the gravitation from my accelerometer data. I'm following the implementation from this site http://www.owen-lu.com/program-accel-grav , but Matlab gives me this error code
"Error using quatmultiply (line 36)
First input elements are not real."
even when I'm using
quatmultiply(quat2(i+1,:),conj(quat2(i,:))
The section in my coding is the following:
%%
e_1 = [1 0 0];
e_2 = [0 1 0];
e_3 = [0 0 1];
e_1rot = zeros(height(T),3);
e_2rot = zeros(height(T),3);
e_3rot = zeros(height(T),3);
i = 1;
while i < height(T)
%I also used quatmultiply(quat2(i+1,:),conj(quat2(i,:)), but there was the error message
e_1rot(i,:) = quat2(i+1,:)*conj(quat2(i,:))*e_1*quat2(i,:)*conj(quat2(i+1,:));
e_2rot(i,:) = quat2(i+1,:)*conj(quat2(i,:))*e_2*quat2(i,:)*conj(quat2(i+1,:));
e_3rot(i,:) = quat2(i+1,:)*(conjquat2(i,:))*e_3*quat2(i,:)*conj(quat2(i+1,:));
i = i + 1;
end
where quat2 is the pure quaternion (without the real part) and conj(quat2) is the conjugation. Could it be that the basis vectors should be 4 dimensional, just like the quaternion? How do I solve then my 3 dimensional gravity problem?
I hope you guys can help me, if needed, I'll post the whole code for better understanding.
4 个评论
采纳的回答
Bruce Rogers
2021-2-8
1 个评论
Simon
2024-7-12
Hey @Bruce Rogers, awesome that it worked out for you. I also want to get rid of the gravity component in my data. Unfortunately "http://www.owen-lu.com/program-accel-grav" doesnt exist anymore. Is there any chance you could share your complete code?
Many thanks!
Simon
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Satellite Mission Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!