function [ml,cl,acc,ph] = Esnorm2(iter,th,n,method,s,x_start,n_init,th2,p);
% Calls Esnorm iter times and computes the average value of the output
% parameters ml, cl, acc and ph.
% The input parameters are the same as for snorm, except that iter,
% the number of iterations, is added first in the list.

ml = 0;
cl = 0;
acc = 0;
ph = 0;
for i=1:iter
  if nargin <= 4
   [X,ml_temp,cl_temp]=Esnorm(th,n,method);
  elseif nargin == 5
   [X,ml_temp,cl_temp,acc_temp]=Esnorm(th,n,method,s);
  elseif nargin == 6
   [X,ml_temp,cl_temp,acc_temp]=Esnorm(th,n,method,s,x_start);
  elseif nargin == 7
  
[X,ml_temp,cl_temp,acc_temp]=Esnorm(th,n,method,s,x_start,n_init);
  elseif nargin >= 8
  
[X,ml_temp,cl_temp,acc_temp,ph_temp]=Esnorm(th,n,method,s,x_start,n_init,th2,p);
   ph = ph + ph_temp;
  end
  ml = ml + ml_temp;
  cl = cl + cl_temp;
  if strcmp(method,'MH')
    acc = acc + acc_temp;
  end
end;
ml = ml/iter;
cl = cl/iter;
acc = acc/iter;
ph = ph/iter;


