% CLIPS AN IMAGE
%
% like an op amp supplied with two voltage rails
%
% any values below limit_low get set to limit_low
% any values above limit_hig get set to limit_hig
%
% Y = clip(X, limit_low, limit_hig)
%
% limit_hig defaults to max(max(X)), as in the following example:
% Y = clip(X,max(max(X))/1000);    % cleans up noise in image X

function Y = dummy(X,limit_low,limit_hig) % returns nothing

if nargin == 2
  limit_hig = max(max(X));
end%if

A = X.*(X>limit_low) + limit_low*(X<=limit_low);

Y = A.*(A<limit_hig) + limit_hig*(A>=limit_hig);

