16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)

上传人:s9****2 文档编号:507928721 上传时间:2023-12-07 格式:DOCX 页数:8 大小:107.52KB
返回 下载 相关 举报
16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)_第1页
第1页 / 共8页
16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)_第2页
第2页 / 共8页
16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)_第3页
第3页 / 共8页
16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)_第4页
第4页 / 共8页
16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)》由会员分享,可在线阅读,更多相关《16QAM_星形和矩形星座图调制解调MATLAB代码(最新整理)(8页珍藏版)》请在金锄头文库上搜索。

1、% %软件无线电课程设计%方形、星形 16QAM 调制解调仿真%-%主程序clcclear% 定义参数fd=250*106;%码元速率 250Mfs=2500*106;%滤波器采样率fc=2500*106;%载波频率 2.5Gf=10000*106;%对载波采样data_len=200000;%数据长度sym_len=data_len/4; %码元序列长度M_QAM=16;%QAM 数k=log2(M_QAM); SNR=1:12;%白噪声信噪比,% bit_tx=randint(1,data_len);%产生随机序列echo off;rec_qam16=QamMod(bit_tx,16);%

2、方形 16QAM 调制star_qam16=SrarQamMod(bit_tx);%星形 16QAM 调制base_rec=base_shape(fd,fs,f,rec_qam16);%基带成型滤波base_star=base_shape(fd,fs,f,star_qam16);%基带成型滤波for i=1:length(SNR)%信噪比从 1dB 到 12dB 计算误码率SNR_=i%方形映射 16QAMrf_rec_qam16=CarrierMod(fc,f,base_rec);%载波调制rf_rec_qam16_n=awgn(rf_rec_qam16,SNR(i),measured);%

3、 加 噪 声 rec_qam16_rx base_rec_rx=CarrierDemod(fd,fs,fc,f,rf_rec_qam16_n);%载波解调bit_rec_rx=QamDemod(rec_qam16_rx,16);%MQAM 解调num_qam16,perr_qam16_rec(i)=biterr(bit_tx,bit_rec_rx);%误码率qam16_data_rec(i,:)=rec_qam16_rx;%scatterplot(rec_qam16_rx);%星形映射 16QAMrf_star_qam16=CarrierMod(fc,f,base_star);%载波调制rf_

4、star_qam16_n=awgn(rf_star_qam16,SNR(i),measured);%加噪声star_qam16_rx base_star_rx=CarrierDemod(fd,fs,fc,f,rf_star_qam16_n);%载波解调bit_star_rx=StarQamDemod(star_qam16_rx);%MQAM 解调num_qam16,perr_qam16_star(i)=biterr(bit_tx,bit_star_rx);%误码率qam16_data_star(i,:)=star_qam16_rx;%scatterplot(star_qam16_rx);end

5、% 理论误码率计算SNRtheo=0:0.1:length(SNR); for i=1:length(SNRtheo)SNRdec=10.(SNRtheo(i)/10); theo_perr_qam16(i)=(3/8)*erfc(sqrt(SNRdec*2/5);end% 基带波形N=200; n=1:N; t=1:N*10;%发送端波形figure;stem(n,bit_tx(n);title(发送序列);%发送序列figure(Name,发送端基带信号); subplot(411);plot(t,real(base_rec(t);title(方形映射-Q 路); subplot(412)

6、;plot(t,imag(base_rec(t);title(方形映射-I 路); subplot(413);plot(t,real(base_star(t);title(星形映射-Q 路); subplot(414);plot(t,imag(base_star(t);title(星形映射-I 路);%接收端波形figure; subplot(211);stem(n,bit_rec_rx(n);title(方形接收序列); subplot(212);stem(n,bit_star_rx(n);title(星形接收序列); figure(Name,接收端基带信号);subplot(411);pl

7、ot(t,real(base_rec_rx(t);title(方形映射-Q 路); subplot(412);plot(t,imag(base_rec_rx(t);title(方形映射-I 路); subplot(413);plot(t,real(base_star_rx(t);title(星形映射-Q 路); subplot(414);plot(t,imag(base_star_rx(t);title(星形映射-I 路);%基带眼图N1=20000;Tn=f/fd; eye_rex=base_rec(1:N1);eyediagram(eye_rex,Tn*4,Tn);title(方形基带眼图

8、); eye_star=base_star(1:N1); eyediagram(eye_star,Tn*4,Tn);title(星形基带眼图);% 接收端星座图%scatterplot(qam16_data_rec(12,:); figure(Name,方形 16QAM 接收端星座图); for i=3:3:12subplot(2,2,i/3); plot(real(qam16_data_rec(i,:),imag(qam16_data_rec(i,:),.); xmax=5;axis(-xmax xmax -xmax xmax) title(Snr=,num2str(SNR(i), dB);

9、endfigure(Name,星形 16QAM 接收端星座图); for i=3:3:12subplot(2,2,i/3); plot(real(qam16_data_star(i,:),imag(qam16_data_star(i,:),.); xmax=3;axis(-xmax xmax -xmax xmax)grid on; title(Snr=,num2str(SNR(i), dB);end% 功率谱密度f_plot;% 误码率分析%16QAM 误码率曲线figure(Name,16QAM 误码性能对比);% semilogy(SNRtheo,theo_perr_qam16);% ho

10、ld on; semilogy(SNR,perr_qam16_rec,*); hold on; semilogy(SNR,perr_qam16_star,o); xlabel(SNR in dB);ylabel(Prb of Err);legend(方形 16QAM,星形 16QAM); title(16QAM 误码性能对比);%-% 基带成型function base_info=base_shape(fd,fs,f,seq_16QAM)%平方根升余弦滤波器,滚降系数 0.5,延迟 3 个采样点flt=rcosine(fd,fs,sqrt,0.5);%I 路和 Q 路seq_Q=real(se

11、q_16QAM); seq_I=imag(seq_16QAM);%增采样R=fs/fd;up_seq_Q=upsample(seq_Q,R); up_seq_I=upsample(seq_I,R);%升余弦调制rcos_Q=conv(up_seq_Q,flt); rcos_I=conv(up_seq_I,flt);%提升rcos_Q_up=interp(rcos_Q,f/fs); rcos_I_up=interp(rcos_I,f/fs);base_info=rcos_Q_up+j*rcos_I_up;%-% 载波解调function data_rx base_rx=CarrierDemod(

12、fd,fs,fc,f,receive)% 分两路乘正交高频载波rc_length=length(receive); flt=rcosine(fd,fs,sqrt,0.5);t=0:rc_length-1;rc_Q=receive .* sin(2*pi*fc*t/f); rc_I=receive .* cos(2*pi*fc*t/f);%减采样后根升余弦匹配滤波,注意对齐采样点down_Q=downsample(0 rc_Q,f/fs); down_I=downsample(rc_I,f/fs); low_Q_rcos=conv(down_Q,flt); low_I_rcos=conv(dow

13、n_I,flt); base_rx=low_Q_rcos(1:length(low_I_rcos)+j*low_I_rcos;%两次根升余弦滤波延迟,定位初始信号位置%delay+1:end-delay-1 R=fs/fd; delay=3*R*2;rc_Q_seq=(downsample(low_Q_rcos(delay+1:end-delay-1),R); rc_I_seq=(downsample(low_I_rcos(delay+1:end-delay-1),R);%类型转换data_rx=rc_Q_seq+j*rc_I_seq;%-% 载波调制function transmit=CarrierMod(fc,f,base)%载波调制t=0:length(base)-1;high_freq_Q=real(base) .* sin(2*pi*fc*t/f); high_freq_I=imag(base) .* cos(2*pi*fc*t/f);transmit=high_freq_Q+high_freq_I;%-%QAM 解调程序,将 MQAM 码元还原为二进制数据%入口参数:data_QAM:QAM 码元数据%M_QAM:MQAM 中 M 的大小%出口参数:二进制数据比特流%-

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 机械/制造/汽车 > 设备维修与保养

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号