通信工程实验报告Word文档格式.docx
《通信工程实验报告Word文档格式.docx》由会员分享,可在线阅读,更多相关《通信工程实验报告Word文档格式.docx(40页珍藏版)》请在冰豆网上搜索。
![通信工程实验报告Word文档格式.docx](https://file1.bdocx.com/fileroot1/2023-1/9/2b43f5d8-e628-4067-9e52-f6f1621f243e/2b43f5d8-e628-4067-9e52-f6f1621f243e1.gif)
2、调制器模块和解调器模块的VerilogHDL代码及注释
(1)差分编码
modulechafen(reset_n,clk,a,b);
inputreset_n;
inputclk;
inputa;
outputb;
regc;
assignb=a^c;
always@(posedgeclkornegedgereset_n)
if(!
reset_n)
c<
=0;
else
begin
c<
=b;
end
Endmodule
(2)控制器
moduleController(
clk,
reset_n,
data,
address,
clk_DA,
blank_DA_n,
sync_DA_n
);
inputclk;
inputreset_n;
inputdata;
output[4:
0]address;
outputclk_DA;
//数模转换器控制信号
outputblank_DA_n;
outputsync_DA_n;
reg[4:
0]address_data;
regc;
begin
c<
=1'
bz;
else
c<
=data;
end
address_data<
=5'
b00000;
elseif(c==data)
address_data<
=address_data+5'
b00001;
begin
case(data)
1'
b0:
address_data<
b1:
b10000;
default:
bzzzzz;
endcase
end
assignaddress=address_data;
assignclk_DA=clk;
assignblank_DA_n=1'
b1;
assignsync_DA_n=1'
(3)查找表
moduleLookUpTable(
dataout,
input[4:
0]address;
output[7:
0]dataout;
reg[7:
0]LUT[0:
31];
if(!
reset_n)
//用C编程计算出的查找表采样值填在这里
LUT[0]<
=8'
h7f;
//0°
LUT[1]<
h97;
LUT[2]<
haf;
LUT[3]<
hc5;
LUT[4]<
hd9;
LUT[5]<
he8;
LUT[6]<
hf4;
LUT[7]<
hfc;
LUT[8]<
hfe;
LUT[9]<
LUT[10]<
hf5;
LUT[11]<
hea;
LUT[12]<
hda;
LUT[13]<
hc7;
LUT[14]<
hb2;
LUT[15]<
h9a;
LUT[16]<
h81;
//180°
LUT[17]<
h69;
LUT[18]<
h51;
LUT[19]<
h3b;
LUT[20]<
h27;
LUT[21]<
h17;
LUT[22]<
hb;
LUT[23]<
h3;
LUT[24]<
h0;
LUT[25]<
h1;
LUT[26]<
h8;
LUT[27]<
h13;
LUT[28]<
h22;
LUT[29]<
h35;
LUT[30]<
h4a;
LUT[31]<
h62;
assigndataout=LUT[address];
endmodule
⒊功能仿真和时序仿真结果的波形
图1.5功能仿真
图1.6时序仿真
实验二MATLAB实验_OFDM误码率仿真(AWGN)
一、实验目的:
1、掌握OFDM的基本原理。
2、掌握用Matlab搭建OFDM系统的基本方法
3、用MATLAB进行OFDM系统在AWGN信道下误码率分析。
二、实验内容
(1)发送部分
①对产生的0、1比特流进行16QAM调制,映射到星座图上,即将数据变为复平面内的数据;
②将变换后的数据进行串并转换进行IFFT变换后在进行并串转换。
为了避免多径造传播成的ISI干扰,要对每一个OFDM符号加循环前缀(CP)。
为了避免码间干扰,CP中的信号与对应OFDM符号尾部宽度为Tg的部分相同,Tg为人为设定。
本实验中为OFDM符号长度的1/4。
③加保护间隔。
为了最大限度的消除码间干扰,该保护间隔一般大于多径信道的最大时延,这样一个符号的多径干扰就不会对下一个符号造成干扰。
将产生的OFDM符号组成一个
串行序列,即组帧。
(2)信道部分:
AWGN信道
(3)接收部分:
①解帧,将接收的序列分解为一个个独立的OFDM符号。
②去掉保护间隔,将加在每个符号前的保护间隔去掉。
③将去掉保护间隔的OFDM符号进行串并转换,为下一步快速傅里叶变换做准备。
④将并行的信号进行快速傅里叶变换得到对应的时域信号。
⑤进行并串转换,再进行QAM解调,解调之前要进行均衡处理。
解调之后得到之前生成的0、1比特流。
设计仿真方案,得到在数据传输过程中不同信噪比的BER性能结论,要求得到的BER
曲线较为平滑。
四、实验报告要求
所有程序完整的源代码(.m文件)以及注释。
仿真结果。
对于所有的图形结果(包括波形与仿真曲线等),将图形保存成.tif或者.emf的格式并插入word文档。
三、实验结果
1、所有程序完整的源代码(.m文件)以及注释
clearall;
closeall;
fprintf('
OFDM基带系统\n\n'
%%%%%%%%%%%%%%%%%%%%%%%%参数设置%%%%%%%%%%%%%%%%%%%%%%%
carrier_count=256;
%FFT数目
number_symbol=1500;
%OFDM符号数目()
Guard_count=carrier_count/4;
%循环前缀
Pilot_interval=15;
%导频间隔
Pilot_count=ceil(number_symbol/Pilot_interval);
%每一行导频的个数
modulation_mode=16;
%16QAM
SNR=-2:
35;
k=log2(modulation_mode);
%%%%%%%%%%%%%%%%%%%%%%%%主程序循环%%%%%%%%%%%%%%%%%%%%%%%
fornumber_snr=1:
length(SNR)
fprintf('
\n\n\n仿真信噪比'
SNR(number_snr));
%%%%%%%%%%%%%%%%%%%%产生发送的随机序列%%%%%%%%%%%%%%%%%%%%
Source_Bits=randi([01],1,k*(carrier_count*number_symbol));
%%%%%%%%%%%%%%%%%%%%%%%%16QAM调制%%%%%%%%%%%%%%%%%%%%%%%%
QAM_16_IQ=[-3-131];
QAM_input_I=QAM_16_IQ(Source_Bits(1:
4:
end)*2+Source_Bits(2:
end)+1);
%00:
-301:
-111:
110:
3
QAM_input_Q=QAM_16_IQ(Source_Bits(3:
end)*2+Source_Bits(4:
Modulated_Sequence_Tx1=QAM_input_I+1i*QAM_input_Q;
%%%%%%%%%%%%%%%%%%%%%串并变换%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modulated_Sequence_Tx=reshape(Modulated_Sequence_Tx1,carrier_count,number_symbol);
%%%%%%%%%%%%%%%%%%%%%产生已知的导频序列%%%%%%%%%%%%%%%%%%%
Pilot_symbols=(round(rand(carrier_count,Pilot_count))*2-1);
%%%%%%%%%%%%%%%%%%%%%%%%导频符号的插入%%%%%%%%%%%%%%%%%%%%%%%
forkk=1:
Pilot_count
Modulated_Sequence_Tx_insert(:
(kk-1)*(Pilot_interval+1)+1)=Pilot_symbols(:
kk);
(kk-1)*(Pilot_interval+1)+2:
(kk-1)*(Pilot_interval+1)+16)=Modulated_Sequence_Tx(:
(kk-1)*Pilot_interval+1:
(kk-1)*Pilot_interval+15);
end
%%%%%%%%%%%%%%%%%%%%%%%%IFFT变换%%%%%%%%%%%%%%%%%%%%%%%%%%
Time_signal_Tx1=ifft(Modulated_Sequence_Tx_insert);
%%%%%%%%%%%%%%%%%%%%%%%%加循环前缀%%%%%%%%%%%%%%%%%%%%%%%
Time_signal_Tx_cp1(1:
Guard_count,:
)=Time_signal_Tx1(carrier_count-Guard_count+1:
carrier_count,:
Time_signal_Tx_cp1(Guard_count+1:
Guard_count+carrier_count,:
)=Time_signal_Tx1(1:
%%%%%%%%%%%%%%%%%%%%%并串变换%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Time_signal_Tx_cp=reshape(Time_signal_Tx_cp1,1,(Guard_count+carrier_count)*(number_symbol+Pilot_count));
%%%%%%%%%%%%%%%%%%%%%%%%高斯信道和瑞利信道%%%%%%%%%%%%%%%%%%%%%%%
Time_signal_Tx_cp_channel1=awgn(Time_signal_Tx_cp,SNR(number_snr),'
measured'
%%%%%%%%%%%%%%%%%%%%%串并变换%%%%%%%%%%%%%%%%%%%
Time_signal_Tx_cp_channel=reshape(Time_signal_Tx_cp_channel1,carrier_count+Guard_count,number_symbol+Pilot_count);
%%%%%%%%%%%%%%%%%%%%%%%%信号接收去循环前缀%%%%%%%%%%%%%%%%%%%%%%%
Time_signal_Rx_channel(1:
)=Time_signal_Tx_cp_channel(Guard_count+1:
carrier_count+Guard_count,:
%%%%%%%%%%%%%%%%%%%%%%%%FFT变换%%%%%%%%%%%%%%%%%%%%%%%
frequence_signal_Rx_channel1=fft(Time_signal_Rx_channel);
%%%%%%%%%%%%%%%%%%%%%%%%获取导频符号处的序列信道估计%%%%%%%%%%%%%%%%%%%%%%%
Pilot_symbols_channel(:
kk)=frequence_signal_Rx_channel1(:
(kk-1)*(Pilot_interval+1)+1);
frequence_signal_Rx_channel(:
(kk-1)*Pilot_interval+15)=frequence_signal_Rx_channel1(:
(kk-1)*(Pilot_interval+1)+16);
%%%%%%%%%%%%%%%%%%%%%并串变换%%%%%%%%%%%%%%%%%%%
frequence_signal_Rx_channel_desert=reshape(frequence_signal_Rx_channel,1,(carrier_count)*number_symbol);
%%%%%%%%%%%%%%%%%%%%%%%%16QAM解调%%%%%%%%%%%%%%%%%%%%%%%
QAM_input_I=real(frequence_signal_Rx_channel_desert);
QAM_input_Q=imag(frequence_signal_Rx_channel_desert);
fora=1:
(carrier_count*number_symbol)
ifQAM_input_I(a)<
=-2
receive_Bits(a*k-3)=0;
%,a*k-1,a*k
receive_Bits(a*k-2)=0;
elseif(QAM_input_I(a)>
-2)&
&
(QAM_input_I(a)<
=0)
receive_Bits(a*k-2)=1;
0)&
=2)
receive_Bits(a*k-3)=1;
elsereceive_Bits(a*k-3)=1;
ifQAM_input_Q(a)<
=-2%&
QAM_input_Q(a)<
=-2
receive_Bits(a*k-1)=0;
receive_Bits(a*k)=0;
elseif(QAM_input_Q(a)>
(QAM_input_Q(a)<
receive_Bits(a*k)=1;
receive_Bits(a*k-1)=1;
elsereceive_Bits(a*k-1)=1;
%%%%%%%%%%%%%%%%%%%%%%%%误码率计算%%%%%%%%%%%%%%%%%%%%%%%
[Num,Rat]=biterr(Source_Bits,receive_Bits);
biterr_total(number_snr)=Rat;
\n\n误码率为%f\n\n'
biterr_total(number_snr));
%%%%%%%%%%%%%%%%%%%%%%%%画图%%%%%%%%%%%%%%%%%%%%%%%
figure
semilogy(SNR,biterr_total,'
bp-'
'
LineWidth'
2);
axis([-23510^-50.9])
xlabel('
SNR'
ylabel('
BER'
title('
OFDM基带系统(高斯信道)'
2、仿真结果
图2.1仿真结果
实验三、MATLAB实验_OFDM误码率仿真(衰落)
1、了解瑞利信道产生的原因及其特征。
2、用MATLAB进行OFDM系统在瑞利信道下误码率分析。
二、实验报告要求
1.所有程序完整的源代码(.m文件)以及注释。
2.仿真结果。
对于所有的图形结果(包括波形与仿真曲线等),将图形保存成.tif或者.emf
的格式并插入word文档。
Modulated_Sequence_Tx=reshape(Modulated_Sequence_Tx1,carrier_count,number_symbol);
%%%%%%%%%%%%%%%%%%%%%产生已知的导频序列%%%%%%%%%%%%%%%%%%%
Pilot_countModulated_Sequence_Tx_insert(:
Modulated_Sequence_