Changeset 21240


Ignore:
Timestamp:
09/30/16 15:20:17 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added nmedian

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plot_gridded.m

    r20670 r21240  
    9292options=addfielddefault(options,'axis','xy equal'); % default axis
    9393applyoptions(md,data,options);
     94
     95function y = nmedian(x,n)
     96%NMEDIAN Generalized median filter
     97%  NMEDIAN(X,N) sorts elemets of X and returns N-th value (N normalized).
     98%  So:
     99%     N = 0 is minimum value
     100%     N = 0.5 is median value
     101%     N = 1 is maximum value
     102
     103if nargin < 2
     104        n = 0.5;
     105end
     106y = sort(x(:));
     107y = interp1(sort(y),n*(length(y)-1) + 1);
Note: See TracChangeset for help on using the changeset viewer.