%
% clip.m
%
% This function limits its input to a lower and upper limit
% 
%   out = clip(in, lower_limit, upper_limit)

function [out] = clip(in, lower, upper)

   out = lower + ((in-lower) + abs(in-lower)) / 2;
   out = out - (((out-upper) + abs(out-upper)) / 2);
