Integral velocity to get angle

1 次查看(过去 30 天)
Dekel Mashiach
Dekel Mashiach 2022-5-17
编辑: Torsten 2022-5-17
I'm trying to get the angle from mpu6050... anyone can help?
clear all; clc;
port = 'COM9'; %
board = 'Uno'; %
a = arduino(port,board,'Libraries', 'I2C'); %
fprintf("Connected")
imu = mpu6050(a);
while(1)
velocity = readAngularVelocity(imu);
angle = integral(velocity,time) %need to fix
pause(3)
end
  3 个评论
Dekel Mashiach
Dekel Mashiach 2022-5-17
velocity is an array, and I need to get the angle (he is also an array)
Torsten
Torsten 2022-5-17
编辑:Torsten 2022-5-17
Maybe
angle = trapz(time,velocity)
if "angle" is the integral of "velocity" with respect to "time" and "time" is an array of the same size as "velocity".

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by