Calculate the resultant vector for 3 axis of data

조회 수: 30 (최근 30일)
Katrina Anderson
Katrina Anderson 2018년 9월 4일
댓글: Samuel Louise 2019년 1월 28일
I have an 9 axis sensor and I have the data in matlab. I am wanting to calculate the resultant vector of acceleration, the resultant angular velocity for gyroscope.. and magnetometer.
In excel i would simply SQRT(accx^2+accy^2+accz^2) . this would be the resultant.
My question is how do i calculate this? Then, how do I automatically calculate this for every data point?
Thankyou!!
  댓글 수: 1
Samuel Louise
Samuel Louise 2019년 1월 28일
Hi I am just wondering which MPU you are using for reading the data because i am having difficulties to read data out of the MPU 9250?
Thank you
From SAM

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2018년 9월 4일
% some random data for demo
accx = rand(10,1) ;
accy = rand(10,1) ;
accz = rand(10,1) ;
R = sqrt(accx.^2+accy.^2+accz.^2) ;
  댓글 수: 3
Stephen23
Stephen23 2018년 9월 4일
편집: Stephen23 2018년 9월 4일
"Is there a way to automatically calculate this for every row?"
That is what KSSV's answer does: it returns a 10x1 vector, each row corresponds to the same rows of the input 10x1 vectors.
Forget about how Excel works: neither MATLAB nor any other language works like a spreadsheet.
Katrina Anderson
Katrina Anderson 2018년 9월 6일
ok thankyou, that makes sense. It worked perfectly!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by