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)

【PDF】通信原察野理matlab

文件格式:PDF/Adobe Acrobat - HTML版

-基于Matlab仿真计算 曾峰 zf0579@sina.com You can ...3.1.1 BASK 本节主要讨论幅度调制技晌没模术,从最简单宴缓的二...0.999%Frequency Offset df = 10%Source &BFSK...比特数.当M等于2,这时PSK通常被称为二进制相移键控(BPSK...

百度搜下。

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


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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存