function thApply
input Real u[:] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} "Input vector";
input Real th = 5 "Threshold value";
input Boolean sorh = true "Soft (false) or hard (true) thresholding";
output Real y[:] = zeros(size(u, 1)) "Vector after thresholding";
end thApply;