reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

powermean.m (519B)


      1 function zbar=powermean(z,eta);
      2 
      3 % function zbar=powermean(z,eta);
      4 %
      5 %  Computes the power mean of the underlying z(i):
      6 %   http://mathworld.wolfram.com/PowerMean.html
      7 %
      8 %    mean = (1/N * sum z(i)^eta )^(1/eta)
      9 %    eta=1: arithmetic mean
     10 %    eta=0: geometric mean
     11 %    eta=-1: harmonic mean
     12 %    eta=-Inf: minimum  (These two cases are allowed)
     13 %    eta=+Inf: maximum
     14 
     15 if eta==0;
     16   zbar=geomean(z);
     17 elseif eta==Inf;
     18   zbar=max(z);
     19 elseif eta==-Inf;
     20   zbar=min(z);
     21 else;
     22   zbar=(1/length(z)*sum(z.^eta))^(1/eta);
     23 end;