function y = mulaw(x, mu)
%MULAW    mu-law compression for signals with
%-----         assumed maximum value of 1
%
%   Usage:   y = mulaw(x, mu);
%
%      x : input signal, column vector with max value 1
%     mu : compression parameter (mu=255 used for telephony)
%
%  see also MULAWINV

%---------------------------------------------------------------
% copyright 1994, by C.S. Burrus, J.H. McClellan, A.V. Oppenheim,
% T.W. Parks, R.W. Schafer, & H.W. Schussler.  For use with the book
% "Computer-Based Exercises for Signal Processing Using MATLAB"
% (Prentice-Hall, 1994).
%---------------------------------------------------------------

Xmax = 1;
y = (Xmax/log(1+mu))*log(1+mu*abs(x)/Xmax).*sign(x);
