close all
clear all

load('X:\707976 EPBuoyPrototypeAndTesting\Deployments\Nov2012 Deployment\DecodedResults\R00001\D000023_121113_162332.mat')

dzdt = [0 diff(PistonDistance)./diff(time)];

figure
ah1 = subplot(2,1,1)
plot(time-time(1),PistonDistance)
ah2 = subplot(2,1,2)
plot(time-time(1),ComputedPistonSpeed,time-time(1),dzdt)
xlabel('time(s)');
ylabel('Speed');
linkaxes([ah1 ah2],'x');


dPldt = [0 diff(LowerSpringPressure)./diff(time)];
dPudt = [0 diff(UpperSpringPressure)./diff(time)];
figure
ah1 = subplot(3,1,1)
plot(time-time(1),dzdt,time-time(1),dPldt,time-time(1),dPudt);
legend('Piston Rate','Lower Pressure Rate','Upper Pressure Rate')
xlabel('time(s)');
ylabel('Rate');
ah2 = subplot(3,1,2)
plot(time-time(1),sign(dzdt),time-time(1),sign(dPldt),time-time(1),sign(-dPudt));

ah3 = subplot(3,1,3)
plot(time-time(1),(sign(dzdt)+sign(dPldt)+sign(-dPudt)));

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