close all;

clear all;

delta = [-50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50];
gram = [-27 -25 -24 -21 -19 -16 -12 -8 -5 -2 0 2 4 8 11 15 18 21 23 25 26];

for i = 1:length(gram)
    tau2(i) = gram(i)*9.81/1000;
end

for i = 1:length(gram)
    tau22(i) = gram(i)*9.81/1000/cos(pi/180*delta(i));
end

k1 = 0.005578;
k2 = 0.00741;

x1 = [-50:0.01:50];
lin = k1*x1;
lin2 = k2*x1;

figure(1);
grid on;
hold on;

plot(x1,lin2,'color', [0 0.85 0],'linewidth',4);
plot(x1,lin,'color', [0 0.4 1],'linewidth',4);

%for i = 1:length(delta)
    plot(delta,tau22,'bo','MarkerFaceColor',[0.99 0.93 0],'linewidth',2);
    plot(delta,tau2,'ro','MarkerFaceColor',[0.99 0.93 0],'linewidth',2);
%end

xlabel('\delta [°]');
ylabel('\tau_{ 2}, \tau_2 cos\delta [N]');
title('Mapa kormila');

legend('Interpolation (\tau_2)','Interpolation (\tau_2 cos\delta)','Measurements (\tau_2)','Measurements (\tau_2 cos\delta)','Location','NorthWest');



