clc; close all;

%% Nacteni vstupnich dat

if not(exist('xpolomr'))
    clear all;
    [xpolomr,ynapt,xpolomr1,ynapt1,xpolomr2,ynapt2,xpolomr3,ynapt3,xpolomr4,ynapt4,xpolomr5,ynapt5,xpolomr6,ynapt6,xpolomr7,ynapt7] = importfile4('EXCEL_grafy_napeti_deska_vnitrni.xlsx','List1');
end

if not(exist('xpolomer'))
    
    [xpolomer,ynapeti,xpolomer1,ynapeti1,xpolomer2,ynapeti2,xpolomer3,ynapeti3,xpolomer4,ynapeti4,xpolomer5,ynapeti5,xpolomer6,ynapeti6,xpolomer7,ynapeti7] = importfile5('EXCEL_grafy_napeti_deska_vnejsi.xlsx','List1');
end

if not(exist('xradiusMKP'))
    
    [xradiusMKP,ypruhybMKP,xradiusVZTAHY,ypruhybVZTAHY1,ypruhybVZTAHY2] = importfile6('EXCEL_grafy_posuvu.xlsx','List1');
end

%% Vykresleni
%% Vnitrni strana
hold on
plot(xpolomr,ynapt,'r','LineWidth', 3, 'DisplayName', '0.7')
plot(xpolomr1,ynapt1,'color',[1 0.5 0])
plot(xpolomr2,ynapt2,'b')
plot(xpolomr3,ynapt3,'color',[0.5843 0.8157 0.9882])
plot(xpolomr4,ynapt4,'c')
plot(xpolomr5,ynapt5,'m')
plot(xpolomr6,ynapt6,'color',[0 0.6 0.2])
plot(xpolomr7,ynapt7,'g','LineWidth', 2)
grid on
legend('Radialni nap MKP','Radialni nap ANALYT','Obvodove nap MKP','Obvodove nap ANALYT','Normalove nap MKP','Normalove nap ANALYT','Redukovane nap MKP','Redukovane nap ANALYT')
%% Vnejsi strana
figure

hold on
plot(xpolomer,ynapeti,'r','LineWidth', 3, 'DisplayName', '0.7')
plot(xpolomer1,ynapeti1,'color',[1 0.5 0])
plot(xpolomer2,ynapeti2,'b')
plot(xpolomer3,ynapeti3,'color',[0.5843 0.8157 0.9882])
plot(xpolomer4,ynapeti4,'c')
plot(xpolomer5,ynapeti5,'m')
plot(xpolomer6,ynapeti6,'color',[0 0.6 0.2])
plot(xpolomer7,ynapeti7,'g','LineWidth', 2)
grid on
legend('Radialni nap MKP','Radialni nap ANALYT','Obvodove nap MKP','Obvodove nap ANALYT','Normalove nap MKP','Normalove nap ANALYT','Redukovane nap MKP','Redukovane nap ANALYT')

%% Uprava

figure

% % pom = [0; xdelka2+0.1116]
% % pom2 = [1.9e-4 ;yradposuv2-0.0000132]
% % f1 = polyfit(pom,pom2,15)
%% Pruhyb
hold on
plot(xradiusMKP,ypruhybMKP,'r')
plot(xradiusVZTAHY,ypruhybVZTAHY1,'b')
plot(xradiusVZTAHY,ypruhybVZTAHY2,'g')

grid on
legend('Posuv MKP','posuv ANALYT', 'korekce ANALYT o osovy posuv na skorepine')