900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > bpsk传输系统实验matlab 通信原理实验4 BPSK系统仿真matlab程序

bpsk传输系统实验matlab 通信原理实验4 BPSK系统仿真matlab程序

时间:2023-04-26 00:02:05

相关推荐

bpsk传输系统实验matlab 通信原理实验4 BPSK系统仿真matlab程序

通信原理实验4 BPSK系统仿真matlab程序,波形

实验名称:BPSK系统实验

一.程序代码

close all;clc;clear;

ts=1;fc=2;

n_sample=200;n_num=1000;

dt=ts/n_sample;t=0:dt:n_num*ts-dt;

d=2*randint(1,n_num)-1;

st_bb=rectpulse(d,n_sample);

st_2psk=st_bb.*cos(2*pi*fc*t);

figure;

subplot(2,1,1);

plot(t,st_2psk);

axis([0 13 -1 1]);title('时域波形');

nloop=20;nfft=2^16;sp_p=0;

window=boxcar(length(st_2psk));

for k=1:nloop

[px,f]=periodogram(st_2psk,window,nfft,1/dt);

sp_p=sp_p+px;

d=2*randint(1,n_num)-1;

st_bb=rectpulse(d,n_sample);

st_2psk=st_bb.*cos(2*pi*fc*t);

end

subplot(2,1,2);

plot(f,sp_p);

axis([0 7 0 20]);title('功率谱');

snr_db=20;snr=10^(snr_db/10);

s=mean(d.^2);sigma=sqrt(s/snr);

n=sigma*randn(size(d))+j*sigma*randn(size(d));

rt=d+n;

figure;

subplot(1,2,1);

plot(rt,'.');

axis([-2 2 -0.5 0.5]);title('dB=20时的星座图');

snr_db=5;snr=10^(snr_db/10);

s=mean(d.^2);sigma=sqrt(s/snr);

n=sigma*randn(size(d))+j*sigma*randn(size(d));

rt=d+n;

hold on;

subplot(1,2,2);

plot(rt,'.');

axis([-2.5 2.5 -2 2]);title('dB=5时的星座图');

二.波形图

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。