close all
clear all

res = load('foo.dat');

time = res(:,1);
speed = res(:,2); 
torque = res(:,3); 
VBus = res(:,4); 
IBridge = res(:,5); 
BridgeDC = res(:,6); 
LoadDC = res(:,7);
iTemp1 = res(:,8);
iTemp2 = res(:,9);
clear res;

figure('Position',[119 210 1293 907])
ah1 = subplot(4,1,1)
plot(time,speed)
xlabel('time (s)');
ylabel('Speed (RPM)');

ah2 = subplot(4,1,2)
%plot(time,torque)
plot(time,iTemp1,'-x')
xlabel('time (s)');
ylabel('Torque (N-m)');


ah3 = subplot(4,1,3)
%plot(time,VBus)
plot(time,iTemp2,'-x')
xlabel('time (s)');
ylabel('Bus Voltage (V)');

ah4 = subplot(4,1,4)
%plot(time,VBus)
plot(time,[diff(iTemp1) ; 0],'-x')
xlabel('time (s)');

linkaxes([ah1 ah2 ah3 ah4],'x');