samer@4: function y=rectify(x) samer@4: % rectify - 'half wave' rectification, rectify(x) x>0 ? x : 0 samer@4: % samer@4: % rectify :: [Size->real] -> [Size->nonneg]. samer@4: samer@4: y = (x>0) .* x; samer@4: % alternative implementation? samer@4: % i=(x<0); y=x; y(i)=0;