clear fit_tot
clear y_pred_tot

%moltiplicatore passi da impostare a piacere
l=7;

for j=1:l
    [y_predk,fit_predictk,x00k] = compare(d1,m1,j*5,'Init','e');
    fit_tot(j,:)=squeeze(fit_predictk(:,:,:))';
    y_pred_tot(:,:,j)= y_predk{1}.y;
end
clear j

figure
xT=5:(l*5-5)/(l-1):l*5;
plot(xT,fit_tot)
grid on
xlabel('k passi');
ylabel('fit [%]');
title('Andamenti fit uscite per k predittori');
legend('y1','y2','y3','y4','y5','y6','y7','y8','y9','Location','SouthWest')
print(['-f',num2str(gcf)], '-depsc2', 'fit_k_volte')

%plottaggio predittori per uscita n°=?
pred_k=8;
figure
    plot(y_val(:,pred_k),'k','LineWidth',1.5)  
    grid on
    hold on
    yy= squeeze(y_pred_tot(:,pred_k,[ceil(l*(1/3)) ceil(l*(2/3)) l]));
    plot(yy)
xlabel('n° campioni');
ylabel('°C (scalati)');
title(['Confronto validazione e predittori per la' int2str(pred_k) 'uscita']);
legend('uscita di validazione', ['predittore a ' int2str(ceil(l*(1/3))*5) ' passi'], ...
['predittore a ' int2str(ceil(l*(2/3))*5) ' passi'], ['predittore a ' int2str(l*5) ' passi'], 'Location','NorthWest')
print(['-f',num2str(gcf)], '-depsc2', 'k_pred_1y')