Help with reading/writing an Android to Matlab G-Force program (Android Sensors)
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Andy Keane
el 22 de Abr. de 2017
Comentada: Andy Keane
el 28 de Abr. de 2017
Hello, I am currently working on a uni project but I am having a bit of a problem. I am looking for just a x co-ordinate rotational acceleration vs time and angular velocity (on the x axis, not yaw) program. I have created a drone that rotates and I want to receive the data back to matlab. Here's what I have so far. Any tips are great. For some reason the time frames that appear on the graph go to 200 (s) when I pause for 15 s.
connector on yourpassword;
m = mobiledev;
m.AccelerationSensorEnabled = 1;
m.AngularVelocitySensorEnabled = 1;
m.Logging = 1;
pause (10)
m.Logging = 0;
[a, t] = accellog(m);
x = a(:,1);
y = a(:,2);
z = a(:,3);
%plot(t, av);
% Calculate and plot magnitude acceleration
mag = sqrt(sum(x.^2 + y.^2 + z.^2, 2));
figure
plot(t, mag);
xlabel('Time (s)');
ylabel('Acceleration (m/s^2)');
disp (mag)
0 comentarios
Respuesta aceptada
Prashant Arora
el 27 de Abr. de 2017
Hi Anthony,
This might be happening due to the fact that when using "accelog", MATLAB will give you data from all logs after it established a connection, and not just the last run. To start fresh each time you run a script, you can use the following command:
discardlogs(m);
Hope this helps!
Más respuestas (0)
Ver también
Categorías
Más información sobre Modeling en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!