MATLAB仿真 BPSK调制解调器

MATLAB仿真 BPSK调制解调器,第1张

clc

clear

fc=4800fs=12000fb=2400

%要调制的数字信号

a=randint(1,12,2)%随机产生12个“0”,“1”

s=zeros(1,60)

for i=1:12

for j=1:5

if(a(i)==0)

s(j+(i-1)*5)=0

else

s(j+(i-1)*5)=1

end

end

end

plot(s)xlabel('基带信号')

figure

pwelch(s)%功率谱

figure

%波形成形滤波器(平方根升余弦滚降)

h=firrcos(14,1200,1200,4800,'sqrt')

figure

stem(h)xlabel('成形滤波器的单位冲击响应')

[H,W]=freqz(h,1)

H=abs(H)

figure

plot(H)xlabel('成形滤波器的频率响应')

s=fftfilt(h,s)

figure

plot(s)xlabel('通过成形滤波器后的基带信号')

figure

pwelch(s)%经波形成形滤波器后的功率谱

%已调信号

e=dmod(a,4800,2400,12000,'psk',2)%调制

figure

plot(e)xlabel('已调信号')

enoise=e+randn(1,60)%enoise=e+.1*randn(1,60)不同功率的高斯白噪声

aa=ddemod(enoise,4800,2400,12000,'psk',2)%解调

figure

stem(aa)xlabel('解调后的数字信号')%解调后的数字信号

p=symerr(a,aa)/12 %误码率

%误码率曲线

figure

r=-6:3:12

rr=10.^(r/10)

pe1=1/2*exp(-rr)%相干解调的误码率曲线

hold on

plot(r,pe1,'r')grid on

pe2=(1-1/2*erfc(sqrt(rr))).*erfc(sqrt(rr))%差分相干解调的误码率曲线

plot(r,pe2,'b')xlabel('bpsk,dpsk误码率曲线')

set(gca,'XTick',-6:3:18)

function output_frame = demodulation(input_modu, index)

% demodulation for IEEE802.11a

% Input:input_modu, complex values representing constellation points

% index

% Output: output_frame, output bit stream (data unit is one bit)

% In this version, increase the quatilization levels into 8.

% note: Matlab index starts from 1

Q_length=length(input_modu)

QAM_input_I = real(input_modu)

QAM_input_Q = imag(input_modu)

output_frame = zeros(1,length(input_modu)*index)

switch index

case 1,

BPSK_Demodu_I = [0 1] %f(m)=(m+1)/2 + 1, so I=-1 --->1, I=1 --->2

idx = find(QAM_input_I>1)

QAM_input_I(idx) = 1

idx = find(QAM_input_I<-1)

QAM_input_I(idx) = -1

output_frame = BPSK_Demodu_I(round((QAM_input_I+1)/2) + 1)

case 2,

QPSK_Demodu_IQ = [0 1]%f(m)=(m+1)/2 + 1, so I=-1 --->1, I=1 --->2

idx = find(QAM_input_I>1)

QAM_input_I(idx) = 1

idx = find(QAM_input_I<-1)

QAM_input_I(idx) = -1

idx = find(QAM_input_Q>1)

QAM_input_Q(idx) = 1

idx = find(QAM_input_Q<-1)

QAM_input_Q(idx) = -1

output_frame(1:2:end) = QPSK_Demodu_IQ(round((QAM_input_I+1)/2) + 1)

output_frame(2:2:end) = QPSK_Demodu_IQ(round((QAM_input_Q+1)/2) + 1)

case 3,

remapping=[0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1].'

for i=1:Q_length

phase_det=[2<QAM_input_I(i)&0<QAM_input_Q(i) 0<QAM_input_I(i)&QAM_input_I(i)<2&0<QAM_input_Q(i) QAM_input_I(i)<-2&0<QAM_input_Q(i) -2<QAM_input_I(i)&QAM_input_I(i)<0&0<QAM_input_Q(i) QAM_input_I(i)<-2&QAM_input_Q(i)<0 QAM_input_I(i)<0&-2<QAM_input_I(i)&QAM_input_Q(i)<0 2<QAM_input_I(i)&QAM_input_Q(i)<0 0<QAM_input_I(i)&QAM_input_I(i)<2&QAM_input_Q(i)<0]

a=find(phase_det)

output_frame((1+(i-1)*3):(3+(i-1)*3))=remapping((1+(a-1)*3):(3+(a-1)*3))

end

case 4,

QAM_16_Demodu_IQ = [0 1 3 2] %f(m)=(m+3)/2 + 1, so I=-3 --->1, I=1 --->3

idx = find(QAM_input_I>3)

QAM_input_I(idx) = 3

idx = find(QAM_input_I<-3)

QAM_input_I(idx) = -3

idx = find(QAM_input_Q>3)

QAM_input_Q(idx) = 3

idx = find(QAM_input_Q<-3)

QAM_input_Q(idx) = -3

tmp = round((QAM_input_I+3)/2) + 1

output_frame(1:4:end) = bitget(QAM_16_Demodu_IQ(tmp),2)

output_frame(2:4:end) = bitget(QAM_16_Demodu_IQ(tmp),1)

tmp = round((QAM_input_Q+3)/2) + 1

output_frame(3:4:end) = bitget(QAM_16_Demodu_IQ(tmp),2)

output_frame(4:4:end) = bitget(QAM_16_Demodu_IQ(tmp),1)

case 5,

remapping=[0 0 0 0 00 0 0 0 10 0 0 1 00 0 0 1 10 0 1 0 00 0 1 0 10 0 1 1 00 0 1 1 1

0 1 0 0 00 1 0 0 10 1 0 1 00 1 0 1 10 1 1 0 00 1 1 0 10 1 1 1 00 1 1 1 1

1 0 0 0 01 0 0 0 11 0 0 1 01 0 0 1 11 0 1 0 01 0 1 0 11 0 1 1 01 0 1 1 1

1 1 0 0 01 1 0 0 11 1 0 1 01 1 0 1 11 1 1 0 01 1 1 0 11 1 1 1 01 1 1 1 1].'

for i=1:Q_length

phase_det=[4<QAM_input_I(i)&0<QAM_input_Q(i)&QAM_input_Q(i)<22<QAM_input_I(i)&QAM_input_I(i)<4&0<QAM_input_Q(i)&QAM_input_Q(i)<20<QAM_input_I(i)&QAM_input_I(i)<2&0<QAM_input_Q(i)&QAM_input_Q(i)<24<QAM_input_I(i)&2<QAM_input_Q(i)&QAM_input_Q(i)<4

2<QAM_input_I(i)&QAM_input_I(i)<4&2<QAM_input_Q(i)&QAM_input_Q(i)<40<QAM_input_I(i)&QAM_input_I(i)<2&2<QAM_input_Q(i)&QAM_input_Q(i)<42<QAM_input_I(i)&QAM_input_I(i)<4&4<QAM_input_Q(i)0<QAM_input_I(i)&QAM_input_I(i)<2&4<QAM_input_Q(i)

QAM_input_I(i)<-4&0<QAM_input_Q(i)&QAM_input_Q(i)<2-4<QAM_input_I(i)&QAM_input_I(i)<-2&0<QAM_input_Q(i)&QAM_input_Q(i)<2-2<QAM_input_I(i)&QAM_input_I(i)<0&0<QAM_input_Q(i)&QAM_input_Q(i)<2QAM_input_I(i)<-4&2<QAM_input_Q(i)&QAM_input_Q(i)<4

-4<QAM_input_I(i)&QAM_input_I(i)<-2&2<QAM_input_Q(i)&QAM_input_Q(i)<4-2<QAM_input_I(i)&QAM_input_I(i)<0&2<QAM_input_Q(i)&QAM_input_Q(i)<4-4<QAM_input_I(i)&QAM_input_I(i)<-2&4<QAM_input_Q(i)-2<QAM_input_I(i)&QAM_input_I(i)<0&4<QAM_input_Q(i)

QAM_input_I(i)<-4&-2<QAM_input_Q(i)&QAM_input_Q(i)<0-4<QAM_input_I(i)&QAM_input_I(i)<-2&-2<QAM_input_Q(i)&QAM_input_Q(i)<0-2<QAM_input_I(i)&QAM_input_I(i)<0&0<QAM_input_Q(i)&QAM_input_Q(i)<0QAM_input_I(i)<-4&-4<QAM_input_Q(i)&QAM_input_Q(i)<-2

-4<QAM_input_I(i)&QAM_input_I(i)<-2&-4<QAM_input_Q(i)&QAM_input_Q(i)<-2-2<QAM_input_I(i)&QAM_input_I(i)<0&-4<QAM_input_Q(i)&QAM_input_Q(i)<-2-4<QAM_input_I(i)&QAM_input_I(i)<-2&QAM_input_Q(i)<-4-2<QAM_input_I(i)&QAM_input_I(i)<0&QAM_input_Q(i)<-4

4<QAM_input_I(i)&-2<QAM_input_Q(i)&QAM_input_Q(i)<02<QAM_input_I(i)&QAM_input_I(i)<4&-2<QAM_input_Q(i)&QAM_input_Q(i)<00<QAM_input_I(i)&QAM_input_I(i)<2&0<QAM_input_Q(i)&QAM_input_Q(i)<04<QAM_input_I(i)&-4<QAM_input_Q(i)&QAM_input_Q(i)<-2

2<QAM_input_I(i)&QAM_input_I(i)<4&-4<QAM_input_Q(i)&QAM_input_Q(i)<-20<QAM_input_I(i)&QAM_input_I(i)<2&-4<QAM_input_Q(i)&QAM_input_Q(i)<-22<QAM_input_I(i)&QAM_input_I(i)<4&QAM_input_Q(i)<-40<QAM_input_I(i)&QAM_input_I(i)<2&QAM_input_Q(i)<-4]

a=find(phase_det)

output_frame((1+(i-1)*5):(5+(i-1)*5))=remapping((1+(a-1)*5):(5+(a-1)*5))

end%5+i 3+i 1+i 5+3*i 3+3*i 1+3*i 3+5*i 1+5*i -5+i -3+i -1+i -5+3*i -3+3*i -1+3*i -3+5*i -1+5*i -5-i -3-i -1-i -5-3*i -3-3*i -1-3*i -3-5*i -1-5*i 5-i 3-i 1-i 5-3*i 3-3*i 1-3*i 3-5*i 1-5*i

case 6,

QAM_64_Demodu_IQ = [0 1 3 2 6 7 5 4] %f(m)=(m+7)/2 + 1, so I=-7 --->1, I=1 --->5

idx = find(QAM_input_I>7)

QAM_input_I(idx) = 7

idx = find(QAM_input_I<-7)

QAM_input_I(idx) = -7

idx = find(QAM_input_Q>7)

QAM_input_Q(idx) = 7

idx = find(QAM_input_Q<-7)

QAM_input_Q(idx) = -7

tmp = round((QAM_input_I+7)/2) + 1

output_frame(1:6:end) = bitget(QAM_64_Demodu_IQ(tmp),3)

output_frame(2:6:end) = bitget(QAM_64_Demodu_IQ(tmp),2)

output_frame(3:6:end) = bitget(QAM_64_Demodu_IQ(tmp),1)

tmp = round((QAM_input_Q+7)/2) + 1

output_frame(4:6:end) = bitget(QAM_64_Demodu_IQ(tmp),3)

output_frame(5:6:end) = bitget(QAM_64_Demodu_IQ(tmp),2)

output_frame(6:6:end) = bitget(QAM_64_Demodu_IQ(tmp),1)

end

姓名:甄文晔; 学号:20181214260; 学院:通信工程学院

【嵌牛导读】调制的目的是把要传输的模拟信号或数字信号变换成适合信道传输的信号,这就意味着把基带信号(信源)转变为一个相对基带频率而言频率非常高的带通信号。该信号称为已调信号,而基带信号称为调制信号。调制可以通过使高频载波随信号幅度的变化而改变载波的幅度、相位或者频率来实现。调制过程用于通信系统的发端。在接收端需将已调信号还原成要传输的原始信号,也就是将基带信号从载波中提取出来以便预定的接受者(信宿)处理和理解的过程。

【嵌牛鼻子】BPSK、QPSK、16QAM调制解调原理及仿真分析

【嵌牛提问】BPSK、QPSK、16QAM调制解调原理是什么?

【嵌牛正文】

    BPSK调制的理论分析如下:设载波为 ,基带信号为:

    则一路 BPSK信号经调制后可表示为:

    BPSK调制原理图如图2.4所示

    BPSK信号调制框图如图2.5所示:

    BPSK信号的解调通常都采用相干解调,解调器原理如图2.6所示,在相干解调过程中需要用到和接收的2PSK信号同频同相的想干载波。

        

    4个已调信号中都有 和 ,完全可以采用IQ调制来实现,只要在IQ调制之前增加一个映射即可。QPSK调制实现原理框图如图2.7所示。

    输入数据、IQ数据和4个载波相位之间的映射关系如表2.1所示。

    假定输入数据为0110110001101100,对应的波形图如图2.8所示。

    QPSK调制星座图如图2.9所示。

    QPSK解调原理如图2.10所示。

    根据前面所讲IQ调制原理,低通滤波后,IQ信号波形就可以恢复出来,只要在每个码元的中间时刻进行采样判决,就可以恢复出数据。

    16QAM调制原理如图2.11所示。

    输入数据与IQ数据的映射关系如表7.2所示。

    假设输入信号为10000110101111011100,对应的16QAM波形图如图。

    16QAM解调原理如图2.13所示。

    根据前面所讲的IQ调制的解调原理,低通滤波后,IQ信号波形就可以被恢复出来,只要在每个码元的中间时刻进行采样判决,就可以恢复出数据。

    本次性能仿真主要针对上述三种不同的调制方式即BPSK、QPSK和16QAM在叠加高斯白噪声情况下,三者的误码率情况。由图2.14所示,不同条件下三种调制方式的星座图,从上到下依次为BPSK调制、QPSK调制和16QAM调制,由于收到噪声的影响,星座点开始发散。

    从图2.15可以看出,BPSK的误码率性能最好,16QAM的误码率性能最差。结合图2.14的星座图可以发现,随着数字信号调制阶数的提高,星座图中点间距变小,数字抗干扰能力变差,对信道质量要求也变高。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8138515.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-13
下一篇 2023-04-13

发表评论

登录后才能评论

评论列表(0条)

保存