⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bdpsk.m

📁 自己编写的MATLAB对调制解调的仿真
💻 M
字号:
%****************modulation*******************
D=[1 0 1 1 0 0 1 0];
N=length(D);%基带信号符号数目
t=0:0.01:7.99;
y=cos(2*pi*t);
d0=D;
bn=[];bn(1)=1;%bn是差分码,设bn的第一个符号为1
for i=1:N,
    bn(i+1)=xor(d0(i),bn(i));
end%差分编码
d1=2*bn-1;%单极性信号变双极性
D0=[];
x=ones(1,100);%100个1
for k=2:N+1,
        D0=[D0,d1(k)*x];
end%开关信号
z=y.*D0;%bdpsk的表达式
%************demodulation**********************
demo=[];
demo0=[];
recos=z.*y;
meg=find(recos>0);
ch(meg)=1;
meg=find(recos<0);
ch(meg)=-1;
K=(ch+1)/2;
%----抽样
j=50;
for i=1:N,
    ch1(i)=K(j);
    j=j+100;
end
%----差分译码
demo(1)=xor(ch1(1),1);
for i=2:N,
    demo(i)=xor(ch1(i),ch1(i-1));
end
%------仅仅为了便于观察
K=[];
for k=1:N,
    K=[K,demo(k).*x];
end
%***************drawing************************
subplot(2,1,1);plot(z);grid ;title('BDPSK modulation');axis([0,800,-2,2]);
subplot(2,1,2);plot(K);grid ;title('BDPSK demodulation');axis([0,800,-2,2]);
xlabel('1 0 1 1 0 0 1 0');

⌨️ 快捷键说明

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