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

📄 bpsk.m

📁 bpsk二进制相位调制
💻 M
字号:
a=[0 0 1 0 1 1 0]
l=linspace(0,2*pi,50);
f=sin(2*l);
t=linspace(0,14*pi,350);
out=1:350;
b=1:350;
d=1:350;
c=1:7;
w=1:350;
for i=1:7  %编码
    if a(i)==0
      for j=1:50
          out(j+50*(i-1))=f(j);
      end
    else
      for j=1:50
          out(j+50*(i-1))=-f(j);
      end
    end
end
for i=1:7  %解码
    for j=1:50
        m=0;n=0;
        if out(j+50*(i-1))-f(j)==0
            m=m+1;
        end
        if out(j+50*(i-1))+f(j)==0
              n=n+1;
        end
    end
    if m>n
        c(i)=0;
    else 
        c(i)=1;
    end
end
c
for i=1:7  %周期延拓
    for j=1:50
        b(j+50*(i-1))=a(i);
        d(j+50*(i-1))=c(i);
        w(j+50*(i-1))=f(j);
    end
end
  %画图
subplot(4,1,1),plot(t,b),axis([0 14*pi -0.2 1.2]), xlabel('t'),ylabel('原码');
subplot(4,1,2),plot(t,w),axis([0 14*pi -1.2 1.2]), xlabel('t'),ylabel('编码前');
subplot(4,1,3),plot(t,out),axis([0 14*pi -1.2 1.2]),xlabel('t'),ylabel('编码后');
subplot(4,1,4),plot(t,d),axis([0 14*pi -0.2 1.2]),xlabel('t'),ylabel('解码后');
[Num,Rat]=biterr(a,c)   %误码率分析

        
    

⌨️ 快捷键说明

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