Calculate the resultant vector for 3 axis of data

33 visualizaciones (últimos 30 días)
Katrina Anderson
Katrina Anderson el 4 de Sept. de 2018
Comentada: Samuel Louise el 28 de En. de 2019
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 comentario
Samuel Louise
Samuel Louise el 28 de En. de 2019
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

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 4 de Sept. de 2018
% 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 comentarios
Stephen23
Stephen23 el 4 de Sept. de 2018
Editada: Stephen23 el 4 de Sept. de 2018
"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 el 6 de Sept. de 2018
ok thankyou, that makes sense. It worked perfectly!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by