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

📄 qpsk_ber_no_noise.m

📁 这是有关matlab结课作业
💻 M
字号:
%...assume the symbol T=1
clear all
close all
bit_in = randint(1e3, 1, [0 1]);
bit_I  = bit_in(1:2:1e3);
bit_Q  = bit_in(2:2:1e3);

data_I = -2*bit_I+1;
data_Q = -2*bit_Q+1;

data_I1=repmat(data_I',20,1);
data_Q1=repmat(data_Q',20,1);

for i=1:1e4
    data_I2(i)=data_I1(i);
    data_Q2(i)=data_Q1(i);
end;

t=0:0.1:1e3-0.1;

f=0:0.1:1;
xrc=0.5+0.5*cos(pi*f);

data_I2_rc=conv(data_I2,xrc)/5.5;
data_Q2_rc=conv(data_Q2,xrc)/5.5;

f1=1;
t1=0:0.1:1e3+0.9;

I_rc=data_I2_rc.*cos(2*pi*f1*t1);
Q_rc=data_Q2_rc.*sin(2*pi*f1*t1);
QPSK_rc=(sqrt(1/2).*I_rc+sqrt(1/2).*Q_rc);

%%..demodulation
I_demo=QPSK_rc.*cos(2*pi*f1*t1);
Q_demo=QPSK_rc.*sin(2*pi*f1*t1);

I_recover=conv(I_demo,xrc);
Q_recover=conv(Q_demo,xrc);
I=I_recover(11:10010);
Q=Q_recover(11:10010);
t2=0:0.05:1e3-0.05;
t3=0:0.1:1e3-0.1;


data_recover=[];
for i=1:20:10000
    data_recover=[data_recover I(i:1:i+19) Q(i:1:i+19)];
end;


ddd = -2*bit_in+1;
ddd1=repmat(ddd',10,1);
for i=1:1e4
    ddd2(i)=ddd1(i);
end


figure(1)
subplot(4,1,1);plot(t3,I);axis([0 20 -6 6]);
subplot(4,1,2);plot(t3,Q);axis([0 20 -6 6]);
subplot(4,1,3);plot(t2,data_recover);axis([0 20 -6 6]);
subplot(4,1,4);plot(t,ddd2);axis([0 20 -6 6]);

% figure(2)
% subplot(2,1,1);plot(t1,I_rc);axis([0 1e3+0.9 -3 3]);
% subplot(2,1,2);plot(t1,Q_rc);axis([0 1e3+0.9 -3 3]);
% 
% figure(3)
% subplot(2,1,1);plot(t1,data_I2_rc);axis([0 1e3+0.9 -3 3]);
% subplot(2,1,2);plot(t1,data_Q2_rc);axis([0 1e3+0.9 -3 3]);
% 
figure(4)
subplot(2,1,1);plot(data_I2);axis([0 10000 -3 3]);
subplot(2,1,2);plot(data_Q2);axis([0 10000 -3 3]);





⌨️ 快捷键说明

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