MATLAB: Mu law compressor function

MATLABmu law compressor

i have sawtooth function when i compress the function using this function
the matlab give me error
my code T = 10*(1/50); Fs = 10000; dt = 1/Fs; t = 0:dt:T-dt; x4 = sawtooth(2*pi*50*t);
Xc = (log(1 + 255*abs(x4)) / log(1+u)) * sign(x4);

Best Answer

T = 10*(1/50);
Fs = 10000;
dt = 1/Fs;
t = 0:dt:T-dt;
x4 = sawtooth(2*pi*50*t);
u=255
Xc = (log(1 + 255.*abs(x4)) ./ log(1+u)) .* sign(x4)
Related Question