% clear all; close all;
load('interactionModel.mat');

ratioLeverFar=LeverSio2FarForce(:,1)./LeverSiFarForce(:,1);
ratioLeverNear=LeverSio2NearForce(:,1)./LeverSiNearForce(:,1);
ratioNoLeverFar=NoLeverSio2FarForce(:,1)./NoLeverSiFarForce(:,1);
ratioNoLeverNear=NoLeverSio2NearForce(:,1)./NoLeverSiNearForce(:,1);


figure; hold on
scatter(z/1e-9,ratioLeverFar,'k*','LineWidth',2,'DisplayName','Lever, Far','HandleVisibility','off');
plot([z(1) z(end)]/1e-9,[1,1],'k--','HandleVisibility','off')
axis([0 500 0.8 1.2]);
set(gca,'FontSize',12,'FontWeight','bold');
xlabel('Lift Height [nm]','FontSize',12);
ylabel('Ratio Response','FontSize',12);
title();

figure; hold on
scatter(z/1e-9,ratioLeverNear,'k<','LineWidth',2,'DisplayName','Lever, Near','HandleVisibility','off');
plot([z(1) z(end)]/1e-9,[1,1],'k--','HandleVisibility','off')
axis([0 500 0.8 1.2]);
set(gca,'FontSize',12,'FontWeight','bold');
xlabel('Lift Height [nm]','FontSize',12);
ylabel('Ratio Response','FontSize',12);

figure; hold on
scatter(z/1e-9,ratioNoLeverFar,'k>','LineWidth',2,'DisplayName','No Lever, Far','HandleVisibility','off');
plot([z(1) z(end)]/1e-9,[1,1],'k--','HandleVisibility','off')
axis([0 500 0.8 1.2]);
set(gca,'FontSize',12,'FontWeight','bold');
xlabel('Lift Height [nm]','FontSize',12);
ylabel('Ratio Response','FontSize',12);

figure; hold on
scatter(z/1e-9,ratioNoLeverNear,'ko','LineWidth',2,'DisplayName','No Lever, Near','HandleVisibility','off');
plot([z(1) z(end)]/1e-9,[1,1],'k--','HandleVisibility','off')
axis([0 500 0.8 1.2]);
set(gca,'FontSize',12,'FontWeight','bold');
xlabel('Lift Height [nm]','FontSize',12);
ylabel('Ratio Response','FontSize',12);

% windowSize=3;
% fRatioLeverFar=filter(ones(1,windowSize)/windowSize,1,ratioLeverFar); 
% fRatioLeverNear=filter(ones(1,windowSize)/windowSize,1,ratioLeverNear);
% fRatioNoLeverFar=filter(ones(1,windowSize)/windowSize,1,ratioNoLeverFar);
% fRatioNoLeverNear=filter(ones(1,windowSize)/windowSize,1,ratioNoLeverNear);
% 
% for i=1:windowSize
% 	fRatioLeverFar(i)=fRatioLeverFar(i)*windowSize/i;
% 	fRatioLeverNear(i)=fRatioLeverNear(i)*windowSize/i;
% 	fRatioNoLeverFar(i)=fRatioNoLeverFar(i)*windowSize/i;
% 	fRatioNoLeverNear(i)=fRatioNoLeverNear(i)*windowSize/i;
% end
% 	
% 
% figure; hold on;
% scatter(z/1e-9,ratioLeverFar,'k*','LineWidth',2,'DisplayName','Lever, Far','HandleVisibility','off');
% scatter(z/1e-9,ratioLeverNear,'k<','LineWidth',2,'DisplayName','Lever, Near','HandleVisibility','off');
% scatter(z/1e-9,ratioNoLeverFar,'k>','LineWidth',2,'DisplayName','No Lever, Far','HandleVisibility','off');
% scatter(z/1e-9,ratioNoLeverNear,'ko','LineWidth',2,'DisplayName','No Lever, Near','HandleVisibility','off');
% 
% plot(z/1e-9,polyval(fitRatioLeverFar.coeff, z/1e-9),'k--','LineWidth',2,'DisplayName','Lever, Far');
% plot(z/1e-9,polyval(fitRatioLeverNear.coeff, z/1e-9),'k--','LineWidth',2,'DisplayName','Lever, Near');
% plot(z/1e-9,polyval(fitRatioNoLeverFar.coeff, z/1e-9),'k-','LineWidth',2,'DisplayName','No Lever, Far');
% plot(z/1e-9,polyval(fitRatioNoLeverNear.coeff, z/1e-9),'k-','LineWidth',2,'DisplayName','No Lever, Near');
% 
% plot([z(1) z(end)]/1e-9,[1,1],'k--','HandleVisibility','off')
% 
% axis([0 500 0.8 1.2]);
% set(gca,'FontSize',12,'FontWeight','bold');
% xlabel('Lift Height [nm]','FontSize',12);
% ylabel('Ratio Response','FontSize',12);
