Plotting output of three MPU6050 sensors in Matlap in three different graphes

22 次查看(过去 30 天)
Hey guys.
I want to plot my programming code from the arduino/teensy in matlab to see the real time data in a diagram. So what I already have now is the programm code to read out the values of three MPU6050 sensores as a change of the angle in x-, y- and z-axis.
So, now I would like to plot three different diagrams for each axis. And in every diagram, there should be all the three sensors over the time. I am not really used to Matlab workspace, so I would like to get some help here.
I am thankful for every kind of help! :)

回答(1 个)

Gayatri Menon
Gayatri Menon 2022-1-7
Hi,
For Arduino board, you could use mpu6050() to connect MPU6050 sensor
a = arduino;
imu = mpu6050(a);
xlabel('Count');
ylabel('Acceleration (m/s^2)');
title('Acceleration values from mpu6050 sensor');
x_val = animatedline('Color','r');
y_val = animatedline('Color','g');
z_val = animatedline('Color','b');
axis tight;
legend('Acceleration in X-axis','Acceleration in Y-axis','Acceleration in Z-axis');
stop_time = 100;
count = 1;
tic;
while(toc <= stop_time)
[accel] = readAcceleration(imu);
addpoints(x_val,count,accel(:,1));
addpoints(y_val,count,accel(:,2));
addpoints(z_val,count,accel(:,3));
count = count + 1;
drawnow limitrate;
end
For more help
For more help refer MPU6050 - Arduino
or
execute
>>help mpu6050
Hope this helps
Thanks
Gayatri

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by