%%% Function grafici % input: stima delle posizioni del nodo mobile rispetto l'asse x (stima_x) % e asse y (stima_y), relative varianze (St2_x, St2_y), % algoritmo distribuito utilizzato function [] = grafici(stima_x, stima_y, St2_x, St2_y, metodo, raggio) load posizioniNM % Residui, errore medio, errore massimo res_x = stima_x-test_Y_x; res_y = stima_y-test_Y_y; mse_x = mean(res_x.^2); mse_y = mean(res_y.^2); em_x = mean(abs(res_x)); % errore medio em_y = mean(abs(res_y)); % errore medio pll_x = -0.5*mean(log(2*pi*St2_x)+res_x.^2./St2_x); pll_y = -0.5*mean(log(2*pi*St2_y)+res_y.^2./St2_y); max_x = max(abs(res_x)); max_y = max(abs(res_y)); disp(' ') disp(['Risultati relativi all`asse x utilizzando il metodo ' num2str(metodo) ' con un raggio di ' num2str(raggio) ' metri.']); fprintf(1,'The mean squared error is %10.6f\n', mse_x); fprintf(1,'Errore medio è %10.6f\n', em_x); fprintf(1,'L errore massimo è %10.6f\n', max_x); fprintf(1,'and the mean predictive log likelihood is %6.4f.\n', pll_x); disp(' ') disp(' ') disp(['Risultati relativi all`asse y utilizzando il metodo ' num2str(metodo) 'con un raggio di' num2str(raggio) ' metri.']); fprintf(1,'The mean squared error is %10.6f\n', mse_y); fprintf(1,'Errore medio è %10.6f\n', em_y); fprintf(1,'L errore massimo è %10.6f\n', max_y); fprintf(1,'and the mean predictive log likelihood is %6.4f.\n', pll_y); disp(' ') a = round(max(max(abs(res_x),abs(res_y)))); b = round(max(max(sqrt(St2_x),sqrt(St2_y)))); figure subplot(2,2,1), plot(res_x,'.'), grid minor ,ylim([-a a]), xlim([0 105]), ylabel('residui asse x'), xlabel('test case') subplot(2,2,2), plot(sqrt(St2_x),'.'), grid minor, ylim([0 b]), xlim([0 105]), ylabel('deviazione standard asse x'), xlabel('test case') subplot(2,2,3), plot(res_y,'.'), grid minor, ylim([-a a]), xlim([0 105]),ylabel('residui asse y'), xlabel('test case') subplot(2,2,4), plot(sqrt(St2_y),'.'), grid minor , ylim([0 b]), xlim([0 105]),ylabel('deviazione standard asse y'), xlabel('test case') end