close all
K=2;

y=-0.07:0.0001:0;
yy=0:0.0001:0.07;


F1y=((1+K)./abs(abs(y)-0.07))- (1./0.07);
F1y=F1y./100;

for i=1:max(size(F1y))

    F1y(:,i)=F1y(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F1y))
if y(:,i)>-0.015
    F1y(:,i)=0
end
end
  
for i=1:max(size(F1y))
if F1y(:,i)>2.5
    F1y(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K=3;
F2y=((K+1)./abs(abs(y)-0.07))- (1./0.07);
F2y=F2y./100;

for i=1:max(size(F2y))

    F2y(:,i)=F2y(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F2y))
if y(:,i)>-0.015
    F2y(:,i)=0
end
end
  
for i=1:max(size(F2y))
if F2y(:,i)>2.5
    F2y(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=4;
F3y=((K+1)./abs(abs(y)-0.07))- (1./0.07);
F3y=F3y./100;

for i=1:max(size(F3y))

    F3y(:,i)=F3y(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F3y))
if y(:,i)>-0.015
    F3y(:,i)=0
end
end
  
for i=1:max(size(F3y))
if F3y(:,i)>2.5
    F3y(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=5;
F4y=((K+1)./abs(abs(y)-0.07))- (1./0.07);
F4y=F4y./100;

for i=1:max(size(F4y))

    F4y(:,i)=F4y(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F4y))
if y(:,i)>-0.015
    F4y(:,i)=0
end
end
  
for i=1:max(size(F4y))
if F4y(:,i)>2.5
    F4y(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=6;
F5y=((K+1)./abs(abs(y)-0.07))- (1./0.07);
F5y=F5y./100;

for i=1:max(size(F5y))

    F5y(:,i)=F5y(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F5y))
if y(:,i)>-0.015
    F5y(:,i)=0
end
end
  
for i=1:max(size(F5y))
if F5y(:,i)>2.5
    F5y(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=2;

F1yy=((1+K)./abs(abs(yy)-0.07))- (1./0.07);
F1yy=F1yy./100;

for i=1:max(size(F1yy))

    F1yy(:,i)=F1yy(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F1yy))
if yy(:,i)<0.015
    F1yy(:,i)=0
end
end
  
for i=1:max(size(F1yy))
if F1yy(:,i)>2.5
    F1yy(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K=3;
F2yy=((K+1)./abs(abs(yy)-0.07))- (1./0.07);
F2yy=F2yy./100;

for i=1:max(size(F2yy))

    F2yy(:,i)=F2yy(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F2yy))
if yy(:,i)<0.015
    F2yy(:,i)=0
end
end
  
for i=1:max(size(F2yy))
if F2yy(:,i)>2.5
    F2yy(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=4;
F3yy=((K+1)./abs(abs(yy)-0.07))- (1./0.07);
F3yy=F3yy./100;

for i=1:max(size(F3yy))

    F3yy(:,i)=F3yy(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F3yy))
if yy(:,i)<0.015
    F3yy(:,i)=0
end
end
  
for i=1:max(size(F3yy))
if F3yy(:,i)>2.5
    F3yy(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=5;
F4yy=((K+1)./abs(abs(yy)-0.07))- (1./0.07);
F4yy=F4yy./100;

for i=1:max(size(F4yy))

    F4yy(:,i)=F4yy(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F4yy))
if yy(:,i)<0.015
    F4yy(:,i)=0
end
end
  
for i=1:max(size(F4yy))
if F4yy(:,i)>2.5
    F4yy(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

K=6;
F5yy=((K+1)./abs(abs(yy)-0.07))- (1./0.07);
F5yy=F5yy./100;

for i=1:max(size(F5y))

    F5yy(:,i)=F5yy(:,i)+0.5 -0.2*K;

end

for i=1:max(size(F5yy))
if yy(:,i)<0.015
    F5yy(:,i)=0
end
end
  
for i=1:max(size(F5yy))
if F5yy(:,i)>2.5
    F5yy(:,i)=2.5
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure (1)

%subplot(121)

plot(y,-F1y,'LineWidth',2)
hold on
plot(y,-F2y,'r','LineWidth',2)
hold on
plot(y,-F3y,'g','LineWidth',2)
hold on
plot(y,-F4y,'y','LineWidth',2)
hold on
plot(y,-F5y,'k','LineWidth',2)
axis([-0.062 0.062 -2.6 2.6])
legend('K=2','K=3','K=4','K=5','K=6')
hold on
xlabel('COPy','FontSize',14)
ylabel('Fz','FontSize',14)
title('|M|=0.015 |L|=2.5','FontSize',14)
%subplot(122)
hold on
plot(yy,F1yy,'LineWidth',2)
hold on
plot(yy,F2yy,'r','LineWidth',2)
hold on
plot(yy,F3yy,'g','LineWidth',2)
hold on
plot(yy,F4yy,'y','LineWidth',2)
hold on
plot(yy,F5yy,'k','LineWidth',2)
%axis([0 0.08 0 3])
%legend('K=2','K=3','K=4','K=5','K=6')
%hold off
%title('M=0.015 L=2.5 ','FontSize',14)
%xlabel('COPy','FontSize',14)
%ylabel('Fz','FontSize',14)