Chap1 2
Chap1 2
%--------compression-------------
% 5. Compress the sample signal ‘mSpeech’
mu = 255; % for u-law, standard value
y_max = V_p;
x_max = V_p;
s_c_5 = sign(mSpeech(1:length(t))).*(log(1 + mu*abs(mSpeech(1:length(t)))/y_max) /
log(1 + mu)) * x_max; % Compress using mu-law
% Plot the compress signal;
plot(t,s_c_5);
% 6. Quantize the compress signal and plot the quantized signal
s_q_6 = quan_uni(s_c_5,q);
plot(t,s_q_6,'b^','MarkerSize',6,'MarkerEdgeColor','b','MarkerFaceColor','b');