close all; clear all; clc

xL1=0.0:0.001:0.085; 
x1L1=(xL1-0)/0.085;
FL1L1 = xlsread('flappingshangL1.xlsx','Sheet2','F2:F87');
FL2L1 = xlsread('flappingshangL1.xlsx','Sheet3','F2:F87');
FL3L1 = xlsread('flappingshangL1.xlsx','Sheet4','F2:F87');
FL4L1 = xlsread('flappingshangL1.xlsx','Sheet5','F2:F87');
FL5L1 = xlsread('flappingshangL1.xlsx','Sheet6','F2:F87');
FL6L1 = xlsread('flappingshangL1.xlsx','Sheet7','F2:F87');
FLR1L1 = xlsread('flappingshangL1.xlsx','Sheet8','F2:F87');
FLR2L1 = xlsread('flappingshangL1.xlsx','Sheet9','F2:F87');
FLupL1 = FL1L1+FL2L1+FL3L1+FL4L1+FL5L1+FL6L1;
FLRup1L1 = FLupL1+FLR2L1;
FLRup2L1 = FLupL1+FLR1L1+FLR2L1;

FL11L1 = xlsread('flappingxiaL1.xlsx','Sheet2','F2:F87');
FL22L1 = xlsread('flappingxiaL1.xlsx','Sheet3','F2:F87');
FL33L1 = xlsread('flappingxiaL1.xlsx','Sheet4','F2:F87');
FL44L1 = xlsread('flappingxiaL1.xlsx','Sheet5','F2:F87');
FL55L1 = xlsread('flappingxiaL1.xlsx','Sheet6','F2:F87');
FL66L1 = xlsread('flappingxiaL1.xlsx','Sheet7','F2:F87');
FLR11L1 = xlsread('flappingxiaL1.xlsx','Sheet8','F2:F87');
FLR22L1 = xlsread('flappingxiaL1.xlsx','Sheet9','F2:F87');
FLdownL1 = FL11L1+FL22L1+FL33L1+FL44L1+FL55L1+FL66L1;
FLRdown1L1 = FLdownL1+FLR22L1;
FLRdown2L1 = FLdownL1+FLR11L1+FLR22L1;
FLML1 = 2*(FLupL1+FLdownL1);
FLM1L1 = 2*(FLRup1L1+FLRdown1L1);
FLM2L1 = 2*(FLRup2L1+FLRdown2L1);

xL2=0.0:0.001:0.085; 
x1L2=(xL2-0)/0.085;
FL1L2 = xlsread('flappingshangL2.xlsx','Sheet2','F2:F87');
FL2L2 = xlsread('flappingshangL2.xlsx','Sheet3','F2:F87');
FL3L2 = xlsread('flappingshangL2.xlsx','Sheet4','F2:F87');
FL4L2 = xlsread('flappingshangL2.xlsx','Sheet5','F2:F87');
FL5L2 = xlsread('flappingshangL2.xlsx','Sheet6','F2:F87');
FL6L2 = xlsread('flappingshangL2.xlsx','Sheet7','F2:F87');
FLR1L2 = xlsread('flappingshangL2.xlsx','Sheet8','F2:F87');
FLR2L2 = xlsread('flappingshangL2.xlsx','Sheet9','F2:F87');
FLupL2 = FL1L2+FL2L2+FL3L2+FL4L2+FL5L2+FL6L2;
FLRup1L2 = FLupL2+FLR2L2;
FLRup2L2 = FLupL2+FLR1L2+FLR2L2;

FL11L2 = xlsread('flappingxiaL2.xlsx','Sheet2','F2:F87');
FL22L2 = xlsread('flappingxiaL2.xlsx','Sheet3','F2:F87');
FL33L2 = xlsread('flappingxiaL2.xlsx','Sheet4','F2:F87');
FL44L2 = xlsread('flappingxiaL2.xlsx','Sheet5','F2:F87');
FL55L2 = xlsread('flappingxiaL2.xlsx','Sheet6','F2:F87');
FL66L2 = xlsread('flappingxiaL2.xlsx','Sheet7','F2:F87');
FLR11L2 = xlsread('flappingxiaL2.xlsx','Sheet8','F2:F87');
FLR22L2 = xlsread('flappingxiaL2.xlsx','Sheet9','F2:F87');
FLdownL2 = FL11L2+FL22L2+FL33L2+FL44L2+FL55L2+FL66L2;
FLRdown1L2 = FLdownL2+FLR22L2;
FLRdown2L2 = FLdownL2+FLR11L2+FLR22L2;
FLML2 = 2*(FLupL2+FLdownL2);
FLM1L2 = 2*(FLRup1L2+FLRdown1L2);
FLM2L2 = 2*(FLRup2L2+FLRdown2L2);

xL3=0.0:0.001:0.085; 
x1L3=(xL3-0)/0.085;
FL1L3 = xlsread('flappingshangL3.xlsx','Sheet2','F2:F87');
FL2L3 = xlsread('flappingshangL3.xlsx','Sheet3','F2:F87');
FL3L3 = xlsread('flappingshangL3.xlsx','Sheet4','F2:F87');
FL4L3 = xlsread('flappingshangL3.xlsx','Sheet5','F2:F87');
FL5L3 = xlsread('flappingshangL3.xlsx','Sheet6','F2:F87');
FL6L3 = xlsread('flappingshangL3.xlsx','Sheet7','F2:F87');
FLR1L3 = xlsread('flappingshangL3.xlsx','Sheet8','F2:F87');
FLR2L3 = xlsread('flappingshangL3.xlsx','Sheet9','F2:F87');
FLupL3 = FL1L3+FL2L3+FL3L3+FL4L3+FL5L3+FL6L3;
FLRup1L3 = FLupL3+FLR2L3;
FLRup2L3 = FLupL3+FLR1L3+FLR2L3;

FL11L3 = xlsread('flappingxiaL3.xlsx','Sheet2','F2:F87');
FL22L3 = xlsread('flappingxiaL3.xlsx','Sheet3','F2:F87');
FL33L3 = xlsread('flappingxiaL3.xlsx','Sheet4','F2:F87');
FL44L3 = xlsread('flappingxiaL3.xlsx','Sheet5','F2:F87');
FL55L3 = xlsread('flappingxiaL3.xlsx','Sheet6','F2:F87');
FL66L3 = xlsread('flappingxiaL3.xlsx','Sheet7','F2:F87');
FLR11L3 = xlsread('flappingxiaL3.xlsx','Sheet8','F2:F87');
FLR22L3 = xlsread('flappingxiaL3.xlsx','Sheet9','F2:F87');
FLdownL3 = FL11L3+FL22L3+FL33L3+FL44L3+FL55L3+FL66L3;
FLRdown1L3 = FLdownL3+FLR22L3;
FLRdown2L3 = FLdownL3+FLR11L3+FLR22L3;
FLML3 = 2*(FLupL3+FLdownL3);
FLM1L3 = 2*(FLRup1L3+FLRdown1L3);
FLM2L3 = 2*(FLRup2L3+FLRdown2L3);

xL4=0.007:0.001:0.069; 
x1L4=(xL4-0.007)/0.062;
FL1L4 = xlsread('flappingshangL4.xlsx','Sheet2','F9:F71');
FL2L4 = xlsread('flappingshangL4.xlsx','Sheet3','F9:F71');
FL3L4 = xlsread('flappingshangL4.xlsx','Sheet4','F9:F71');
FL4L4 = xlsread('flappingshangL4.xlsx','Sheet5','F9:F71');
FL5L4 = xlsread('flappingshangL4.xlsx','Sheet6','F9:F71');
FL6L4 = xlsread('flappingshangL4.xlsx','Sheet7','F9:F71');
FLR1L4 = xlsread('flappingshangL4.xlsx','Sheet8','F9:F71');
FLR2L4 = xlsread('flappingshangL4.xlsx','Sheet9','F9:F71');
FLupL4 = FL1L4+FL2L4+FL3L4+FL4L4+FL5L4+FL6L4;
FLRup1L4 = FLupL4+FLR2L4;
FLRup2L4 = FLupL4+FLR1L4+FLR2L4;

FL11L4 = xlsread('flappingxiaL4.xlsx','Sheet2','F9:F71');
FL22L4 = xlsread('flappingxiaL4.xlsx','Sheet3','F9:F71');
FL33L4 = xlsread('flappingxiaL4.xlsx','Sheet4','F9:F71');
FL44L4 = xlsread('flappingxiaL4.xlsx','Sheet5','F9:F71');
FL55L5 = xlsread('flappingxiaL4.xlsx','Sheet6','F9:F71');
FL66L4 = xlsread('flappingxiaL4.xlsx','Sheet7','F9:F71');
FLR11L4 = xlsread('flappingxiaL4.xlsx','Sheet8','F9:F71');
FLR22L4 = xlsread('flappingxiaL4.xlsx','Sheet9','F9:F71');
FLdownL4 = FL11L4+FL22L4+FL33L4+FL44L4+FL55L5+FL66L4;
FLRdown1L4 = FLdownL4+FLR22L4;
FLRdown2L4 = FLdownL4+FLR11L4+FLR22L4;
FLML4 = 2*(FLupL4+FLdownL4);
FLM1L4 = 2*(FLRup1L4+FLRdown1L4);
FLM2L4 = 2*(FLRup2L4+FLRdown2L4)

xL5=0.006:0.001:0.131; 
x1L5=(xL5-0.006)/0.125;
FL1L5 = xlsread('flappingshangL5.xlsx','Sheet2','F8:F133');
FL2L5 = xlsread('flappingshangL5.xlsx','Sheet3','F8:F133');
FL3L5 = xlsread('flappingshangL5.xlsx','Sheet4','F8:F133');
FL4L5 = xlsread('flappingshangL5.xlsx','Sheet5','F8:F133');
FL5L5 = xlsread('flappingshangL5.xlsx','Sheet6','F8:F133');
FL6L5 = xlsread('flappingshangL5.xlsx','Sheet7','F8:F133');
FLR1L5 = xlsread('flappingshangL5.xlsx','Sheet8','F8:F133');
FLR2L5 = xlsread('flappingshangL5.xlsx','Sheet9','F8:F133');
FLupL5 = FL1L5+FL2L5+FL3L5+FL4L5+FL5L5+FL6L5;
FLRup1L5 = FLupL5+FLR2L5;
FLRup2L5 = FLupL5+FLR1L5+FLR2L5;


FL11L5 = xlsread('flappingxiaL5.xlsx','Sheet2','F8:F133');
FL22L5 = xlsread('flappingxiaL5.xlsx','Sheet3','F8:F133');
FL33L5 = xlsread('flappingxiaL5.xlsx','Sheet4','F8:F133');
FL44L5 = xlsread('flappingxiaL5.xlsx','Sheet5','F8:F133');
FL55L5 = xlsread('flappingxiaL5.xlsx','Sheet6','F8:F133');
FL66L5 = xlsread('flappingxiaL5.xlsx','Sheet7','F8:F133');
FLR11L5 = xlsread('flappingxiaL5.xlsx','Sheet8','F8:F133');
FLR22L5 = xlsread('flappingxiaL5.xlsx','Sheet9','F8:F133');
FLdownL5 = FL11L5+FL22L5+FL33L5+FL44L5+FL55L5+FL66L5;
FLRdown1L5 = FLdownL5+FLR22L5;
FLRdown2L5 = FLdownL5+FLR11L5+FLR22L5;
FLML5 = 2*(FLupL5+FLdownL5);
FLM1L5 = 2*(FLRup1L5+FLRdown1L5);
FLM2L5 = 2*(FLRup2L5+FLRdown2L5)


xL6=0.0:0.001:0.085; 
x1L6=(xL6-0)/0.085;
FL1L6 = xlsread('flappingshangL6.xlsx','Sheet2','F2:F87');
FL2L6 = xlsread('flappingshangL6.xlsx','Sheet3','F2:F87');
FL3L6 = xlsread('flappingshangL6.xlsx','Sheet4','F2:F87');
FL4L6 = xlsread('flappingshangL6.xlsx','Sheet5','F2:F87');
FL5L6 = xlsread('flappingshangL6.xlsx','Sheet6','F2:F87');
FL6L6 = xlsread('flappingshangL6.xlsx','Sheet7','F2:F87');
FLR1L6 = xlsread('flappingshangL6.xlsx','Sheet8','F2:F87');
FLR2L6 = xlsread('flappingshangL6.xlsx','Sheet9','F2:F87');
FLupL6 = FL1L6+FL2L6+FL3L6+FL4L6+FL5L6+FL6L6;
FLRup1L6 = FLupL6+FLR2L6;
FLRup2L6 = FLupL6+FLR1L6+FLR2L6;

FL11L6 = xlsread('flappingxiaL6.xlsx','Sheet2','F2:F87');
FL22L6 = xlsread('flappingxiaL6.xlsx','Sheet3','F2:F87');
FL33L6 = xlsread('flappingxiaL6.xlsx','Sheet4','F2:F87');
FL44L6 = xlsread('flappingxiaL6.xlsx','Sheet5','F2:F87');
FL55L6 = xlsread('flappingxiaL6.xlsx','Sheet6','F2:F87');
FL66L6 = xlsread('flappingxiaL6.xlsx','Sheet7','F2:F87');
FLR11L6 = xlsread('flappingxiaL6.xlsx','Sheet8','F2:F87');
FLR22L6 = xlsread('flappingxiaL6.xlsx','Sheet9','F2:F87');
FLdownL6 = FL11L6+FL22L6+FL33L6+FL44L6+FL55L6+FL66L6;
FLRdown1L6 = FLdownL6+FLR22L6;
FLRdown2L6 = FLdownL6+FLR11L6+FLR22L6;
FLML6 = 2*(FLupL6+FLdownL6);
FLM1L6 = 2*(FLRup1L6+FLRdown1L6);
FLM2L6 = 2*(FLRup2L6+FLRdown2L6);


lowpass1 = lowpass_butterworth1;
lowpass2 = lowpass_butterworth2;
lowpass3 = lowpass_butterworth3;
lowpass4 = lowpass_butterworth4;
lowpass5 = lowpass_butterworth5;
filter_output_1 = filter(lowpass1,FLM1L1);
filter_output_2 = filter(lowpass2,FLM1L2);
filter_output_3 = filter(lowpass3,FLM1L3);
filter_output_4 = filter(lowpass4,FLM1L4);
filter_output_5 = filter(lowpass5,FLM1L5);
filter_output_6 = filter(lowpass5,FLM1L6);

figure(1);
plot(x1L1,filter_output_1,'Color',[1,0,0],'linewidth',1);
hold on
plot(x1L2,filter_output_2,'Color',[0,1,0],'linewidth',1);
hold on
plot(x1L3,filter_output_3,'Color',[0,0,1],'linewidth',1);
hold on
plot(x1L4,filter_output_4,'Color',[0,0,0],'linewidth',1);
hold on
plot(x1L5,filter_output_5,'Color',[0.5,0.5,0.5],'linewidth',1);
hold on
plot(x1L6,filter_output_6,'Color',[0.25,0.25,0.25],'linewidth',1);
hold off
legend('L1','L2','L3','L4','L5','L6','Fontsize',10);
xlabel('T* (t/T)','FontName','Times New Roman','FontSize',10);
ylabel('Force (N)','FontName','Times New Roman','FontSize',10);
title('Lift evolution','FontName','Times New Roman','FontSize',10);


L1=mean (filter_output_1);
L2=mean (filter_output_2);
L3=mean (filter_output_3);
L4=mean (filter_output_4);
L5=mean (filter_output_5);
L6=mean (filter_output_6);
