Integral velocity to get angle
古いコメントを表示
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 件のコメント
Torsten
2022 年 5 月 17 日
"integral" expects a function as first input argument. You supply "velocity" which is an array, a matrix ...?
Look up if the MATLAB function "trapz" is better suited for your purpose.
Dekel Mashiach
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 件)
カテゴリ
ヘルプ センター および File 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!