星尘际海 2022-04-24 16:02 采纳率: 75%
浏览 415
已结题

matlab绘制2PSK、2ASK、DPSK

要求是:发送二进制信息为1,0,0,1,1,1,0,1,码元速率为1波特,载波为cosωt,幅值为1,初始相位为0。当载波频率为2Hz,相位(或相位差)0°代表“0”,相位(或相位差)180°代表“1”。

测试结果

img

明明采用的是同一个时间长度t,为什么DPSK的X轴刻度会大10倍呢?
而且文中的.*(t>=t_begin&t<t_end)是具体什么作用,先t=0:0.01:10设置一个容器,然后再把值存储进去?

代码

fs=12                                    %采样频率,取载波频域的6倍
Ts=1/fs
fc=2                                    %载波频率
Rb=1
Tb=1/Rb                                   %传输信息速率,Rb = RB * log2M
t=0:0.01:10
binary_msg=[1 0 0 1 1 1 0 1]
len_bmsg=length(binary_msg);

%绘制调制信号
t_begin=0
t_end=1
mt=0

for i=1:len_bmsg
    if(binary_msg(i)==1)
        mt=mt+1.*(t>=t_begin&t<t_end)
    else mt=mt+0.*(t>=t_begin&t<t_end)
    end
    t_begin=t_begin+1
    t_end=t_end+1
end
figure
subplot(2,2,1)
plot(t,mt);
ylim([-0.25,1.25]);
title('调制信号')

%调制PSK
PSK=0
t_begin=0
t_end=1
for i=1:len_bmsg
    if(binary_msg(i)==1)
        PSK=PSK+cos(2*pi*fc*t).*(t>=t_begin&t<t_end)
    else PSK=PSK+cos(2*pi*fc*t+pi).*(t>=t_begin&t<t_end)
    end
    t_begin=t_begin+1
    t_end=t_end+1
end
subplot(2,2,3)
plot(t,PSK);
ylim([-1.5,1.5]);
title('2PSK信号')

%调制ASK
t_begin=0
t_end=1
ASK=0
for i=1:len_bmsg
    if(binary_msg(i)==1)
        ASK=ASK+cos(2*pi*fc*t).*(t>=t_begin&t<t_end)
    else ASK=ASK+0.*(t>=t_begin&t<t_end)
    end
    t_begin=t_begin+1
    t_end=t_end+1
end
subplot(2,2,2)
plot(t,ASK);
ylim([-1.5,1.5]);
title('2ASK信号')

%调制DPSK
md=0
ti_begin=0
ti_end=1

%码型变换-相对码
DiffBits = zeros(len_bmsg+1,1);        %码元长度增加了
for i = 2:len_bmsg+1
    DiffBits(i) =mod( DiffBits(i - 1) + binary_msg(i-1) , 2 );
end
 
%码型变换至双极性不归零码
Diffbb  = 2*DiffBits- 1; 

for j=1:length(Diffbb)
    if(Diffbb(j)==-1)
        md=md+(-1).*(t>=ti_begin&t<ti_end)
    else md=md+1.*(t>=ti_begin&t<ti_end)
    end
    ti_begin=ti_begin+1
    ti_end=ti_end+1
end
      
DBPSK = md  .* cos(2* pi * fc * t); 

subplot(2,2,4)
plot(DBPSK);
xlim([0,1000])
ylim([-1.5,1.5]);
title('DBPSK信号')

参考这两篇文章

https://blog.csdn.net/weixin_43861730/article/details/103576018

https://blog.csdn.net/weixin_43599963/article/details/103443391?ops_request_misc=&request_id=&biz_id=102&utm_term=2dpsk%E8%B0%83%E5%88%B6%E8%A7%A3%E8%B0%83matlab&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-7-103443391.nonecase&spm=1018.2226.3001.4187

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 5月2日
    • 创建了问题 4月24日

    悬赏问题

    • ¥30 为什么会失败呢,该如何调整
    • ¥50 如何在不能联网影子模式下的电脑解决usb锁
    • ¥20 服务器redhat5.8网络问题
    • ¥15 如何利用c++ MFC绘制复杂网络多层图
    • ¥20 要做柴油机燃烧室优化 需要保持压缩比不变 请问怎么用AVL fire ESE软件里面的 compensation volume 来使用补偿体积来保持压缩比不变
    • ¥15 python螺旋图像
    • ¥15 算能的sail库的运用
    • ¥15 'Content-Type': 'application/x-www-form-urlencoded' 请教 这种post请求参数,该如何填写??重点是下面那个冒号啊
    • ¥15 找代写python里的jango设计在线书店
    • ¥15 请教如何关于Msg文件解析