pcmmodulation.m

来自「direct sequence spread spectrum」· M 代码 · 共 24 行

M
24
字号
clear all;
close all;
f=100;
t=0:1/f:1;
a=sin(2*pi*t);
plot(t,a)
amax=max(abs(a));
a_quan=a/amax;
b_quan=a_quan;
n=16;
d=2/n;
q=d.*[0:n-1];
q=q-((n-1)/2)*d;
for i=1:n
    a_quan(find((q(i)-d/2<=a_quan)&(a_quan<=q(i)+d/2)))=q(i).*ones(1,length(find((q(i)-d/2<=a_quan)&(a_quan<=q(i)+d/2))));
    b_quan(find(a_quan==q(i)))=(i-1).*ones(1,length(find(a_quan==q(i))));
end
a_quan=a_quan*amax;
h=de2bi(b_quan);
figure,plot(t,a_quan);
figure,stem(h);
[m n]=butter(2,1/15,'low');
g=filter(m,n,a_quan);
figure,plot(t,g);

⌨️ 快捷键说明

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