3.m

来自「通原实验课的作业」· M 代码 · 共 50 行

M
50
字号
close all 
clear all
echo on
t=0:0.001:2;
a(1:length(t)/2)=t(1:length(t)/2);
a(length(t)/2:length(t))=-t(length(t)/2:length(t))+2;%信号样本序列 
figure(1)
plot(t,a);
title('信源序列')

mu=255;
figure(2)
[sqnr,a_quan,code]=mula_pcm(a,8,mu);%
sqnr
plot(a,a_quan,'-');%
title(' 非均匀量化级数为8的输入输出关系')

figure(3)
[sqnr,a_quan,code]=mula_pcm(a,16,mu);%
sqnr
plot(a,a_quan,'-');%
title(' 非均匀量化级数为16的输入输出关系')

figure(4)
[sqnr,a_quan,code]=mula_pcm(a,64,mu);%
sqnr
plot(a,a_quan,'-');%
title(' 非均匀量化级数为64的输入输出关系')

figure(5)
mu=255;
[sqnr,a_quan,code]=mula_pcm(a,8,mu);%
f=a-a_quan;                 %
subplot(3,1,1);
%axis([0 500 -15 15]);
plot(t,f,'-');
title('非均匀PCM量化误差,从上到下量化级数分别为8,16,64,')

[sqnr,a_quan,code]=mula_pcm(a,16,mu);%
f=a-a_quan;                 %
subplot(3,1,2);
%axis([0 500 -15 15]);
plot(t,f,'-');


[sqnr,a_quan,code]=mula_pcm(a,64,mu);%
f=a-a_quan;                 %
subplot(3,1,3);
%axis([0 500 -15 15]);
plot(t,f,'-');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?