Spara först ned datafilen kanonen_mitt. Datafilen innehåller 7 kolumner med:
Time [s] | Acceleration x [g] | Acceleration y [g] | Acceleration z [g] | Angular rate x [rad/s] | Angular rate y [rad/s] | Angular rate z [rad/s] |
Ladda in data i matlab genom kommandot
load kanonen_mitt -ascii
Du kan direkt rita grafer i matlab,
t.ex. dem i figuren till höger, genom
kommandona nedan
tid=kanonen_mitt(:,1);
ax =kanonen_mitt(:,2)/9.82;
ay =kanonen_mitt(:,3)/9.82;
az =kanonen_mitt(:,4)/9.82;
figure (1)
wx =kanonen_mitt(:,5);
wy =kanonen_mitt(:,6);
wz =kanonen_mitt(:,7);
subplot (3,1,1)
plot(tid,ax)
axis([0 35 -1.3 1.7])
ylabel ('ax (g)')
grid on
subplot (3,1,2)
plot(tid,ay)
axis([0 35 -1.1 1.1])
grid on
ylabel ('ay (g)')
subplot (3,1,3)
plot(tid,az)
ylabel ('az (g)')
axis([0 35 -1.1 5])
grid on
figure (2)
subplot (3,1,1)
plot(tid,wx)
axis([0 35 -2.5 2.5])
ylabel ('\omega_x (rad/s)')
grid on
subplot (3,1,2)
plot(tid,wy)
axis([0 35 -2.5 2.5])
grid on
ylabel ('\omega_y (rad/s)')
subplot (3,1,3)
plot(tid,wz)
axis([0 35 -2.5 2.5])
grid on
ylabel ('\omega_z (rad/s)')
För att skriva ut grafen till en fil kan du använda kommandot
print -depsc kanonenm
Filen kanonenm.eps kan sedan konverterats till
.gif genom att
använda programmet xv.