a. Vẽ tín hiệu trước và sau khi nén
b. So sánh giá trị méo dạng trước và sau khi nén.
% Số mức lượng tử
Mu = 255;
% Tín hiệu hàm mũ
t = -4:0.1:4;
sig = exp(t);
V = max(sig);
% Lượng tử tín hiệu
partition = 0:2^6-1;
codebook = 0:2^6;
[~,~,distor1] = quantiz(sig,partition,codebook)
% Nén tín hiệu theo luật mu
compsig = compand(sig,Mu,V,'mu/compressor');
[~,quants] = quantiz(compsig,partition,codebook);
% Giải nén tín hiệu theo luật mu
newsig = compand(quants,Mu,max(quants),'mu/expander');
distor2 = sum((newsig-sig).^2)/length(sig)
plot([sig' compsig'],'linewidth',2);
legend('Tín hiệu gốc','Tín hiệu đã nén','location','nw')
set(gcf,'color','white');
Hệ số méo dạng trước và sau khi nén lần lượt là .5348 và .0397. Chúng ta thấy rằng hệ số
méo dạng giảm hơn 10 lần.
Tín hiệu trước và sau khi nén theo luật μ
Không có nhận xét nào:
Đăng nhận xét