close all
clear all

data = load('EffTest_101414.log');

time = data(:,1);
RPM = data(:,2);
Torque = data(:,3);
Voltage = data(:,5);
Current = data(:,6);
Pout = data(:,7);
eff = data(:,8);
BoostDC = data(:,9);



figure('Position',[  64         299        1431         992])
subplot(4,1,1)
plot(time,RPM)
ylabel('RPM');
subplot(4,1,2)
plot(time,Torque)
ylabel('Torque (N-m)');
subplot(4,1,3)
plot(time,Voltage)
ylabel('Load Voltage');
subplot(4,1,4)
plot(time,Current)
xlabel('time (seconds)');
ylabel('Load Current (Amps)');

WattsPerRPM = 0.3;
idx = find(abs(Voltage.*Current-RPM*WattsPerRPM)<5);

figure('Position',[  64         299        1431         992])
ah1 = subplot(2,1,1)
plot(RPM(idx),Pout(idx),'x');
xlabel('RPM');
ylabel('Power Out (W)');
title('Oct 14 Eff Test at 0.3 W/RPM');
ah2 = subplot(2,1,2)
plot(RPM(idx),eff(idx),'x');
xlabel('RPM');
ylabel('Eff');
ylim([50 100]);
linkaxes([ah1 ah2],'x');
print('-dpdf','Eff');