Matlab Mobile - Extracting my sensor data isnt working properly.
Show older comments
Hello all,
i am working with matlab mobile and i am facing a rather annoying problem. I dont even know if it is caused by Matlab Mobile/Matlab/Android or my Smartphone. I work with Matlab R2016a.
After i have created a successful connection between the smartphone and matlab and logged some data, i want to extract it via [Accel, t_Accel] = accellog(m). But the results i get seem to be corrupt/broken. The timevector isnt contiguous and i receive too few data. If i shake my phone for like 15 seconds and the contiguous party of timevec imply a frequency of ~12 Hz my Datamatrix is only 70x3 and not ~180x3 as i would expect.
Does anyone of you know where my problem occurs from? I tested 2 different smartphones and controlling matlab mobile on the smartphone and in matlab with console commands (m.Logging =1 ; m.Logging =0;) and i still get similar problems.
I hope someone has a smart idea.
Greetings
Answers (1)
Daniel Hauch
on 30 Oct 2017
1 Comment
Bushra
on 16 Dec 2023
clc;
clear all;
clear a;
a = arduino('COM5', 'Uno');
fs = 100; % Sample Rate in Hz
imu = mpu6050(a,'SampleRate',fs,'OutputFormat','matrix');
ts = tic;
stopTimer = 50;
magReadings=[];
while(toc(ts) < stopTimer)
[accel,gyro] = read(imu);
end
GyroscopeNoiseMPU9250 = 3.0462e-06; % GyroscopeNoise (variance value) in units of rad/s
AccelerometerNoiseMPU9250 = 0.0061; % AccelerometerNoise (variance value) in units of m/s^2
viewer = HelperOrientationViewer('Title',{'AHRS Filter'});
FUSE = ahrsfilter('SampleRate',imu.SampleRate, 'GyroscopeNoise',GyroscopeNoiseMPU9250,'AccelerometerNoise',AccelerometerNoiseMPU9250);
stopTimer = 100;
ts = tic;
while(toc(ts) < stopTimer)
[accel,gyro] = read(imu);
% Align coordinates in accordance with NED convention
accel = [-accel(:,2), -accel(:,1), accel(:,3)];
gyro = [gyro(:,2), gyro(:,1), -gyro(:,3)];
rotators = FUSE(accel,gyro);
for j = numel(rotators)
viewer(rotators(j));
end
end
I am reading data from mpu6050 using arduino in MATLAB. I am receiving this error
Error using mpu6050_Arduino12
Command logs are not supported for sensors. Create the hardware Object with property 'TraceOn' disabled.
Can you help me with that?
Communities
More Answers in the Distance Learning Community
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!