%% 1 chao
clc, clear all, close all;

GRAF=1;

[R5,T5,Y5] = expp('6.csv', 17);

for f=1:1:size(cell(T5)) 
    if GRAF ==1
    plot(T5{f},Y5{f,1},'m'); hold on; plot(T5{f},Y5{f,1},'.'); hold on; %fn
    elseif GRAF ==2
        plot(T5{f},Y5{f,2},'m'); hold on; %fhmov
    elseif GRAF ==3
        plot(T5{f},Y5{f,3},'m'); hold on; %uy
    elseif GRAF ==4
        plot(T5{f},Y5{f,4},'m'); hold on; %copx
    elseif GRAF ==5
        plot(T5{f},Y5{f,5},'m'); hold on; %copy
    end
end

[R6,T6,Y6] = expp('7.csv', 17);

for f=1:1:size(cell(T6)) 
    if GRAF ==1
    plot(T6{f},Y6{f,1},'b'); hold on; %fn
    elseif GRAF ==2
        plot(T6{f},Y6{f,2},'b'); hold on; %fhmov
    elseif GRAF ==3
        plot(T6{f},Y6{f,3},'b'); hold on; %uy
    elseif GRAF ==4
        plot(T6{f},Y6{f,4},'b'); hold on; %copx
    elseif GRAF ==5
        plot(T6{f},Y6{f,5},'b'); hold on; %copy
    end
end

[R7,T7,Y7] = expp('8.csv', 17);

for f=1:1:size(cell(T7)) 
    if GRAF ==1
    plot(T7{f},Y7{f,1},'g'); hold on; %fn
    elseif GRAF ==2
        plot(T7{f},Y7{f,2},'g'); hold on; %fhmov
    elseif GRAF ==3
        plot(T7{f},Y7{f,3},'g'); hold on; %uy
    elseif GRAF ==4
        plot(T7{f},Y7{f,4},'g'); hold on; %copx
    elseif GRAF ==5
        plot(T7{f},Y7{f,5},'g'); hold on; %copy
    end
end

[R8,T8,Y8] = expp('9.csv', 17);

for f=1:1:size(cell(T8)) 
    if GRAF ==1
    plot(T8{f},Y8{f,1},'r'); hold on; %fn
    elseif GRAF ==2
        plot(T8{f},Y8{f,2},'r'); hold on; %fhmov
    elseif GRAF ==3
        plot(T8{f},Y8{f,3},'r'); hold on; %uy
    elseif GRAF ==4
        plot(T8{f},Y8{f,4},'r'); hold on; %copx
    elseif GRAF ==5
        plot(T8{f},Y8{f,5},'r'); hold on; %copy
    end
end

[R9,T9,Y9] = expp('10.csv', 17);

for f=1:1:size(cell(T9)) 
    if GRAF ==1
    plot(T9{f},Y9{f,1},'y'); hold on; %fn
    elseif GRAF ==2
        plot(T9{f},Y9{f,2},'y'); hold on; %fhmov
    elseif GRAF ==3
        plot(T9{f},Y9{f,3},'y'); hold on; %uy
    elseif GRAF ==4
        plot(T9{f},Y9{f,4},'y'); hold on; %copx
    elseif GRAF ==5
        plot(T9{f},Y9{f,5},'y'); hold on; %copy
    end
end

 RR= [R5(:,1) R6(:,1) R7(:,1) R8(:,1) R9(:,1)]
%% 2 tapetepreto
clc, clear all, close all;
GRAF=1;
[R1,T1,Y1] = expp('2.csv', 5);


for f=1:1:size(cell(T1)) 
    if GRAF ==1
    plot(T1{f},Y1{f,1},'b'); hold on; %fn
    elseif GRAF ==2
        plot(T1{f},Y1{f,2},'b'); hold on; %fhmov
    elseif GRAF ==3
        plot(T1{f},Y1{f,3},'b'); hold on; %uy
    elseif GRAF ==4
        plot(T1{f},Y1{f,4},'b'); hold on; %copx
    elseif GRAF ==5
        plot(T1{f},Y1{f,5},'b'); hold on; %copy
    end
end

[R3,T3,Y3] = expp('4.csv', 5);

for f=1:1:size(cell(T3)) 
    if GRAF ==1
    plot(T3{f},Y3{f,1},'y'); hold on; %fn
    elseif GRAF ==2
        plot(T3{f},Y3{f,2},'y'); hold on; %fhmov
    elseif GRAF ==3
        plot(T3{f},Y3{f,3},'y'); hold on; %uy
    elseif GRAF ==4
        plot(T3{f},Y3{f,4},'y'); hold on; %copx
    elseif GRAF ==5
        plot(T3{f},Y3{f,5},'y'); hold on; %copy
    end
end

[R4,T4,Y4] = expp('5.csv', 7);


for f=1:1:size(cell(T4)) 
    if GRAF ==1
    plot(T4{f},Y4{f,1},'c'); hold on; %fn
    elseif GRAF ==2
        plot(T4{f},Y4{f,2},'c'); hold on; %fhmov
    elseif GRAF ==3
        plot(T4{f},Y4{f,3},'c'); hold on; %uy
    elseif GRAF ==4
        plot(T4{f},Y4{f,4},'c'); hold on; %copx
    elseif GRAF ==5
        plot(T4{f},Y4{f,5},'c'); hold on; %copy
    end
end
%% 3 esferovite

GRAF=1;
[R,T,Y] = expp('Force_val.csv', 7);

for f=1:1:size(cell(T)) 
    if GRAF ==1
    plot(T{f},Y{f,1},'r'); hold on; %fn
    elseif GRAF ==2
        plot(T{f},Y{f,2},'r'); hold on; %fhmov
    elseif GRAF ==3
        plot(T{f},Y{f,3},'r'); hold on; %uy
    elseif GRAF ==4
        plot(T{f},Y{f,4},'r'); hold on; %copx
    elseif GRAF ==5
        plot(T{f},Y{f,5},'r'); hold on; %copy
    end
end

%% 4 cop
clc, clear all, close all;

F0 = [0.3 8.02 17 0.43 2.7 6 0 0 0];
F1= [17 8.15 0.4 6.1 2.2 0.2 0 0 0];
F2= [ 0 0 0 0.2 2.2 6 0.4 6.18 15];
F3=  [ 0 0 0 6.1 3 0.4 13 5.95 0.2];

for h=1:1:9
    FF(h)=F0(h)+F1(h)+F2(h)+F3(h);
end
distx= 38.4;
disty=96;
for j=1:9
Copx(j)= (F0(j)*(-distx/2)+ F1(j)*(distx/2)+ F2(j)*(-distx/2) +F3(j)*(distx/2))/(F0(j)+F1(j)+F2(j)+F3(j));
Copy(j)= (F0(j)*(disty/2)+ F1(j)*(disty/2)+ F2(j)*(-disty/2) +F3(j)*(-disty/2))/(F0(j)+F1(j)+F2(j)+F3(j));
end

plot(Copx,Copy,'r*'), hold on;

CopxR= [19.2 0 -19.2 19.2 0 -19.2 19.2 0 -19.2];
CopyR= [48 48 48  0 0 0 -48 -48 -48];
plot(CopxR,CopyR,'b*');

legend('COP_e_x_p','COP_r_e_a_l');
x=ones(1,101)*-20;
x1=ones(1,101)*20;
y=ones(1,41)*50;
y1=ones(1,41)*-50;

yy=[-50:1:50];
xx=[-20:1:20];

plot(x,yy,'-.r'); plot(x1,yy,'-.r'); plot(xx,y,'-.r'); plot(xx,y1,'-.r'); 
xlim([-40 40]);
ylim([-80 80]);