close all
filename = 'efficiency10V_matlab.csv';
data10V= readtable(filename);
filename = 'efficiency12V_matlab.csv';
data12V = readtable(filename);
filename = 'efficiency14V_matlab.csv';
data14V = readtable(filename);
filename = 'efficiency16V_matlab.csv';
data16V = readtable(filename);

hold on
% title('\fontsize{20}Závislosť účinnosti na veľkosti výstupného prúdu pre rôzne hodnoty vstupného napätia');
xlabel('\fontsize{20}Výstupný prúd [A]')
ylabel('\fontsize{20}Účinnosť [%]');


[p,~,mu] = polyfit(data10V.Iout, data10V.eff, 4);
y = polyval(p,data10V.Iout,[],mu);
x = 0.2:0.025:2.85;
y1 = spline(data10V.Iout,y,x);
plot(x,y1, 'Color',[0 0.447 0.741], 'LineWidth',1.5);

[p,~,mu] = polyfit(data12V.Iout, data12V.eff, 10);
y = polyval(p,data12V.Iout,[],mu);
x = 0.2:0.025:3.46;
y1 = spline(data12V.Iout,y,x);
plot(x,y1, 'Color',[0.85 0.325 0.098], 'LineWidth',1.5);

[p,~,mu] = polyfit(data14V.Iout, data14V.eff, 6);
y = polyval(p,data14V.Iout,[],mu);
x = 0.2:0.025:4.075;
y1 = spline(data14V.Iout,y,x);
plot(x,y1, 'Color',[0.929 0.694 0.125], 'LineWidth',1.5);

[p,~,mu] = polyfit(data16V.Iout, data16V.eff, 6);
y = polyval(p,data16V.Iout,[],mu);
x = 0.2:0.025:4.65;
y1 = spline(data16V.Iout,y,x);
plot(x,y1, 'Color',[0.494 0.184 0.556], 'LineWidth',1.5);


% x = 0.2:0.025:2.85;
% y = interp1(data10V.Iout,data10V.eff,x, 'makima');
% plot(x, y,'Color',[0 0.447 0.741], 'LineWidth',1.5);
% 
% x = 0.2:0.025:3.46;
% y = spline(data12V.Iout,data12V.eff,x);
% plot(x, y,'Color',[0.85 0.325 0.098], 'LineWidth',1.5);
% 
% x = 0.2:0.025:4.075;
% y = spline(data14V.Iout,data14V.eff,x);
% plot(x, y,'Color',[0.929 0.694 0.125], 'LineWidth',1.5);
% 
% x = 0.2:0.025:4.65;
% y = spline(data16V.Iout,data16V.eff,x);
% plot(x, y,'Color',[0.494 0.184 0.556], 'LineWidth',1.5);


legend('\fontsize{20}10 V','\fontsize{20}12 V','\fontsize{20}14 V','\fontsize{20}16 V','Location','east');
plot(data10V.Iout,data10V.eff, 'x', 'Color',[0 0.447 0.741], 'LineWidth',1.5, 'MarkerSize',10, 'HandleVisibility','off');
plot(data12V.Iout,data12V.eff, 'x','Color',[0.85 0.325 0.098], 'LineWidth',1.5, 'MarkerSize',10, 'HandleVisibility','off');
plot(data14V.Iout,data14V.eff, 'x','Color',[0.929 0.694 0.125], 'LineWidth',1.5, 'MarkerSize',10, 'HandleVisibility','off');
plot(data16V.Iout,data16V.eff, 'x','Color',[0.494 0.184 0.556], 'LineWidth',1.5, 'MarkerSize',10, 'HandleVisibility','off');
ax = gca;
xlim([0.2, 4.8]);
ylim([70, 100]);

ax.XAxis.TickValues = 0:0.2:5;
ax.XAxis.MinorTick = 'on';
ax.XAxis.MinorTickValues = 0.2:0.1:5;
ax.YAxis.TickValues = 70:5:100;
ax.YAxis.MinorTick = 'on';
ax.YAxis.MinorTickValues = 70:1:100;
grid on;
ax.XMinorGrid = 'on';
ax.YMinorGrid = 'on';
set(gca,'XMinorTick','on','YMinorTick','on');
% set(gca,'YMinorTick',[0 0.5 1 1.5 2 2.5 3  3.5 4 4.5 5 5.5 6] );

