ME2400
ASSIGNMENT 2
connector on connector;
m=mobiledev;
m.AccelerationSensorEnabled = 1
pause(2)
m.logging = 1
pause(10)
m.logging = 0
figure(1)
plot(tacc, acc)
xlabel('time')
ylabel('acceleration')
legend('x component','y component','z component')
a=mean(acc)
max=max(acc)
jerk=diff(acc);
figure(2)
plot(jerk)
legend('x component','y component','z component')
xlabel('time')
ylabel('jerk')
BASKETBALL ACCELERATION
BASKETBALL JERK
1) BASKETBALL JUMP
TENNIS JERK
2) TENNIS FOREHAND
X-COMP Y-COMP Z-COMP
Mean = 5.3772 3.0198 7.4594
Max = 20.6712 6.3008 38.4641
TYPICAL DURATION= 2.0 sec
TIME FOR MAX. ACCL= 0.2 sec
CRICKET ACCELERATION
CRICKET JERK
3) CRICKET BOWLING
X-COMP Y-COMP Z-COMP
Mean = 1.0134 -1.3621 9.8970
Max = 26.0969 10.7712 38.4641
TYPICAL DURATION= 2.9 sec
TIME FOR MAX. ACCL= 0.25 sec
QUESTION 2) ALL ANGLES ARE IN DEGREES
CODE
close all
clear all
connector on connector;
m=mobiledev;
m.OrientationSensorEnabled = 1
pause(2)
m.logging = 1
pause(20)
m.logging = 0
figure(1)
plot(to, o)
xlabel('time')
ylabel('angle in degrees')
legend('azimuth','pitch','roll')
3) inverted portrait
163.8249 85.7530 -45.2689
163.2724 85.3219 -44.3301
157.6007 85.3941 -35.7948
172.2884 83.7892 -46.7105
179.1737 84.4560 -53.6001
161.5595 82.9005 -32.7839
157.7267 81.9926 -26.3452
161.0095 80.9005 -30.7839
153.7267 80.9926 -24.3082
163.5006 82.9649 -31.9327
4) inverted landscape
48.2135 5.7293 80.3898
50.4764 2.9474 81.3777
50.4832 0.7572 81.2571
49.6531 0.6990 81.8920
50.2101 0.8895 82.1950
49.3620 1.8547 81.2469
49.3298 1.7853 81.4324
47.3741 2.6390 81.8894
45.8769 3.1005 82.6418
46.1104 2.7158 83.1121
QUESTION 3)
CODE
close all
clear all
clc
connector on connector
pause(5)
final = []; ini = [];
m=mobiledev
m.AngularVelocitySensorEnabled = 1
m.OrientationSensorEnabled = 1
m.logging = 1;
pause(10)
m.logging=0;
[av,tav]=angvellog(m);
[o,to]= orientlog(m);
o = o*pi/180.0;
final = o(length(to),1:3);
ini = o(1,1:3);
figure(1)
plot(tav,av)
xlabel('time')
ylabel('angular velocity')
figure(2)
plot(to,o)
xlabel('time')
ylabel('orientation')
legend('azimuth','roll','pitch')
%Error calculation
l=length(tav);
azx=[];pix=[];rox=[];
for i=1:l
azx(i)=o(3*i-2);
pix(i)=o(3*i-1);
rox(i)=o(3*i);
end
azy = trapz(azx,tav);
piy = trapz(pix,tav);
roy = trapz(rox,tav);
az_error = azy-(final(1)-ini(1));
pi_error = piy-(final(1)-ini(1));
ro_error = roy-(final(1)-ini(1));
fprintf('Error in angles,in radians,are [%f,%f,%f]\n',
az_error,pi_error,ro_error);
ORIENTATION
m.AccelerationSensorEnabled=1
m.logging=1
m.sampleRate
m.logging=0
m.AccelerationSensorEnabled=0
pause(10)
m.AngularVelocitySensorEnabled=1
m.logging=1
m.sampleRate
m.logging=0
m.AngularVelocitySensorEnabled=0
pause(10)
m.MagneticSensorEnabled=1
m.logging=1
m.sampleRate
m.logging=0
m.MagneticSensorEnabled=0
pause(10)
m.OrientationSensorEnabled=1
m.logging=1
m.sampleRate
m.logging=0
m.OrientationSensorEnabled=0
pause(10)
m.PositionSensorEnabled=1
m.logging=1
m.sampleRate
m.logging=0
m.PositionSensorEnabled=0
pause(10)
ACCELERATION SENSOR = 10 Hz
ANGULAR VELOCITY SENSOR = 10 Hz
MAGNETIC SENSOR = 10 Hz
ORIENTATION SENSOR = 10 Hz
POSITION SENSOR = 10 Hz
RESOLUTION
ACCELERATION SENSOR= 0.002 m/sq.sec
ANGULAR VELOCITY SENSOR = 0.001 rad/sec
MAGNETIC SENSOR = 0.301 microT
QUESTION 5)
GRAY CODE
x = [0; 1];
for a=1:(n-1)
k=2^a;
y=flipud(x);
z=zeros(k,1);
o=ones(k,1);
at=[z,x];
bt=[o,y];
x=[xt;yt];
continue
end
disp(x);