基于Matlab的16QAM模拟

  • i6_654608
    了解作者
  • 3.6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-16 04:12
    上传日期
基于Matlab的16QAM模拟,包含绘制眼图和误码的计算(Matlab 16QAM)
4265925716QAM.zip
  • BitToSymbolStream.m
    292B
  • www.imdn.cn.html
    66B
  • QAM_Demod.m
    556B
  • DigiTrans.m
    3.3KB
  • BitStream.m
    72B
  • GrayDecoding.m
    356B
  • QAM_Mod.m
    401B
  • www.imdn.cn.txt
    366B
  • GrayCoding.m
    400B
内容介绍
% Matlab script file: DigiTrans.m % % This file simulates a transmission of 16-QAM data. % % All functions which are called from this script file are available % from http://www.ecs.soton.ac.uk/~sw1/ez622/ez622.html % % S. Weiss, 10/11/2001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % bit stream generation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LB = 10000; % number of bits B = BitStream(LB); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % conversion to 16-QAM symbol %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nbits = 2; x = BitToSymbolStream(B,Nbits); % group Nbits successive bits % into each I and Q X = QAM_Mod(x,Nbits); % to implement 2^(2*Nbits)-QAM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % upsamling and transmit filtering %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% N = 16; % oversampling factor for transmitted data Xup = zeros(1,length(X)*N); Xup(1:N:end) = X; h = sqrt(N)*firrcos(10*N,1/N,.5,2,'rolloff','sqrt'); s = filter(h,1,Xup); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % filtering with channel impulse response %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% c = [1 0 0]; % CIR (at N x symbol rate) s_hat = filter(c,1,s); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % additive white Gaussian noise (AWGN) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SNR = 1000; sigma_x = std(s_hat); Ls = length(s_hat); noise = (randn(1,Ls) + sqrt(-1)*randn(1,Ls))*sqrt(N)/sqrt(2); s_hat = s_hat + sigma_x*10^(-SNR/20)*noise; % line above WAS: (incorrectly) s_hat = s_hat + sigma_x*10^(-SNR/20)*sqrt(N)*noise; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % receive filtering %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% s2 = filter(h,1,s_hat); % eye diagram EYE = zeros(32,200); EYE(:) = s2(N*10+1:N*10+32*200)'; figure(1); clf; plot(real(EYE)); % I-component only title('eye diagram of received data'); xlabel('wrapped time'); ylabel('I-component amplitude'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % sampling at symbol rate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Ninit = 10; % determine sampling point (0<Ninit<=N) X_hat = s2(Ninit:N:end); % "sample" the signal % plot received constellation figure(2); clf; plot(X_hat(20:end),'.'); title('constellation'); xlabel('I'); ylabel('Q'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % conversion from 16-QAM to bits stream %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% X_tilde = QAM_Slicer(X_hat,Nbits,'renorm'); X2 = QAM_Demod(X_tilde,Nbits); B2 = SymbolToBitStream(X2,Nbits); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % calculate bit errors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% delayB = 10; % to compensate dalays in channel & TX/RX diff = B(1:end-delayB) - B2(delayB+1:end); BER = sum(abs(diff))/(length(B)-delayB); disp(sprintf('bit error probability = %f',BER));
评论
    相关推荐
    • Matlab合集
      冈萨雷斯数字图像处理MATLAB版.中文版+数字图像处理第二版中文版(冈萨雷斯)+MATLAB-R2014a完全自学一本通+MATLAB R2016a完全自学一本通 素材文件+[模式识别与智能计算:MATLAB技术实现(第2版)].杨淑莹.扫描版
    • MATLAB教程
      MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程
    • MATLAB
      MATLAB 该项目是在matlab上完成的,涉及创建和移动宇宙飞船和机器人。 太空飞船和机器人是使用Matlab中的简单几何形状创建的,并通过连续变换矩阵进行移动。 这个项目教我如何使用变换矩阵(旋转,平移等)的概念...
    • MATLAB基础
      一本学习matlab的一本好书
    • MATLAB编译器
      基于MATLAB 2018b版本介绍MATLAB编译器。介绍如何利用编译器将MATLAB代码编译为独立应用程序或组件,并在没有安装MATLAB的计算机上进行部署。
    • matlabruntime
      通过奇点容器运行您的matlab项目 可以在没有MATLAB的容器中运行matlab代码。 为此,我们首先需要通过Matlab编译器在本地构建相应的Matlab代码的独立应用程序,然后使用具有Matlab运行时( 的容器)运行该应用程序 )...
    • matlab实现
      matlab实现 matlab实现matlab实现matlab实现matlab实现
    • matlab 教程
      matlab 信号处理资料,里面包含信号处理pdf文档,一些杂乱的程序和命令等
    • matlab教程
      matlab教程,PPT格式,包含 matlab基本知识、matlab入门、matlab作图、线性规划、无约束优化、非线性规划、统计工具箱、差值、微分方程等多项知识点,并且每个知识点独立成为PPT,内还含有matlab信号处理详解等文档...
    • matlab简介
      1.MATLAB 开发环境 1.1 MATLAB 的视窗环境 进入MATLAB之后,会看到一个视窗MATLAB Command Window称为指令视窗,它是你键入指令的地方同时 MATLAB也将计算结果显示在此。 1.2 简易计算 我们先从MATLAB的...