main_incal_vs_emnenmf.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. clear
  2. close all
  3. clc
  4. %% Adding every files in the path
  5. addpath(genpath(pwd))
  6. %% Simulation parameters
  7. s_width = 50; % Scene width
  8. s_length = 50; % Scene length
  9. N_Ref = 4; % Nb. of reference measurements
  10. N_Cpt = 100; % Nb. of mobile sensors
  11. Mu_beta = .9; % Mean sensors gain
  12. Mu_alpha = 5; % Mean sensors offset
  13. Bound_beta = [.01;1.5]; % Gain boundaries
  14. Bound_alpha = [3.5;6.5]; % Offset boundaries
  15. MV = .5; % Missing Value prop.
  16. RV = 0.3; % RendezVous prop.
  17. var_n = 0; % Noise variance
  18. M_loop = 50; % Number of M loop per E step
  19. runs = 1; % Total number of runs
  20. %% Nesterov parameters
  21. InnerMinIter = 5;
  22. InnerMaxIter = 50;
  23. Tmax = 30;
  24. %%
  25. delta_measure = 1;
  26. iter_max = round(Tmax / delta_measure);
  27. %% Allocation for the RMSE values
  28. % emnenmf
  29. RMSE_offset_emnenmf = nan(runs, iter_max);
  30. RMSE_gain_emnenmf = nan(runs, iter_max);
  31. % Incal
  32. RMSE_offset_incal = nan(runs, iter_max);
  33. RMSE_gain_incal = nan(runs, iter_max);
  34. for run = 1:runs
  35. % data generation
  36. [X, X_theo, W, F_theo, Omega_G, Omega_F, Phi_G, Phi_F, Ginit, Finit] = data_gen(s_width, s_length, run, N_Ref, N_Cpt, Mu_beta, Mu_alpha, Bound_beta, Bound_alpha, MV, RV, var_n);
  37. % emnenmf
  38. [T_emnenmf, RMSE] = emnenmf( W , X , Ginit , Finit, Omega_G, Omega_F, Phi_G, Phi_F , InnerMinIter , InnerMaxIter , Tmax , M_loop, F_theo, delta_measure);
  39. RMSE_offset_emnenmf(run,:) = RMSE(1,:);
  40. RMSE_gain_emnenmf(run,:) = RMSE(2,:);
  41. % incal
  42. [T_incal, RMSE] = IN_Cal( W , X , Ginit , Finit , Omega_G , Omega_F , Phi_G , Phi_F , F_theo , Tmax, delta_measure );
  43. RMSE_offset_incal(run,:) = RMSE(1,:);
  44. RMSE_gain_incal(run,:) = RMSE(2,:);
  45. end
  46. % emnenmf
  47. min_offset_emnenmf = min(RMSE_offset_emnenmf,[],1,'omitnan');
  48. med_offset_emnenmf = median(RMSE_offset_emnenmf,1,'omitnan');
  49. max_offset_emnenmf = max(RMSE_offset_emnenmf,[],1,'omitnan');
  50. min_gain_emnenmf = min(RMSE_gain_emnenmf,[],1,'omitnan');
  51. med_gain_emnenmf = median(RMSE_gain_emnenmf,1,'omitnan');
  52. max_gain_emnenmf = max(RMSE_gain_emnenmf,[],1,'omitnan');
  53. subplot(121)
  54. semilogy(T_emnenmf,min_offset_emnenmf,'b')
  55. hold on
  56. semilogy(T_emnenmf,med_offset_emnenmf,'b')
  57. o_e = semilogy(T_emnenmf,max_offset_emnenmf,'b');
  58. hold off
  59. subplot(122)
  60. semilogy(T_emnenmf,min_gain_emnenmf,'b')
  61. hold on
  62. semilogy(T_emnenmf,med_gain_emnenmf,'b')
  63. g_e = semilogy(T_emnenmf,max_gain_emnenmf,'b');
  64. hold off
  65. % incal
  66. min_offset_incal = min(RMSE_offset_incal,[],1,'omitnan');
  67. med_offset_incal = median(RMSE_offset_incal,1,'omitnan');
  68. max_offset_incal = max(RMSE_offset_incal,[],1,'omitnan');
  69. min_gain_incal = min(RMSE_gain_incal,[],1,'omitnan');
  70. med_gain_incal = median(RMSE_gain_incal,1,'omitnan');
  71. max_gain_incal = max(RMSE_gain_incal,[],1,'omitnan');
  72. subplot(121)
  73. hold on
  74. semilogy(T_incal,min_offset_incal,'r')
  75. semilogy(T_incal,med_offset_incal,'r')
  76. o_i = semilogy(T_incal,max_offset_incal,'r');
  77. hold off
  78. subplot(122)
  79. hold on
  80. semilogy(T_incal,min_gain_incal,'r')
  81. semilogy(T_incal,med_gain_incal,'r')
  82. g_i = semilogy(T_incal,max_gain_incal,'r');
  83. hold off
  84. % adding title and labels
  85. subplot(121)
  86. title('RMSE offset')
  87. legend([o_e o_i],'EMNeNMF','IN\_Cal')
  88. subplot(122)
  89. title('RMSE gain')
  90. legend([g_e g_i],'EMNeNMF','IN\_Cal')
  91. med_offset_incal(end)
  92. med_offset_emnenmf(end)