sphere decode.c 西安電子科校大粤 XIDIAN UNIVERSITY M #include <stdio.h> 90 finclude <math.h> finclude "mex.h 室 /indexing into the 2D array * define R(x,y)R[(x)+(y)"n] 例2: 2134 idetine MAX n 200 n should not be more than 200!*/ /allocate space for a vector void *mallocvector(ine n,int size) 优先使用matlab内建 void t d; d -malloc(sizetn); 函数,将耗时的循环 1713 1f(d) return d: else 写进MEX-File中以获 45 mexErrMagTxt ("No enough memory.(inside sphere decoder)") return NULL: 得加速! 71329 static long int flops-0; 01 derine ADDFLOPS (x)flops+=(x) tdetine SET FLOPS (x)flops=(x) 13.15 e18e #define ADDELOPS(x) #detine SET FLOPS (x) 63 38 static double T,*S,*xi; 39 static int U,*x buffer: idetine MIN (x,y)((x)>()?(y)(x) tdefine MAX(x,Y)((x)<(y)(y)(x)) static int sphere_decode(double C,double *R,double *rho, int tmaxconst,int tminconst,int n,double *xhat) 45 6 int i,k,minconst_1[MAX_n],*x,txhat_to be; 47 double d2,dhat,temp; 119 for (k=0;k<n;k++) minconst_1[k]】-minconst[k】-1; d2=c: T[n-1]=C: 155 S[n-1]-9: x-x buffe工
宽带无线传输研究中心 Wireless Broadband Transmission Research Center 16 MATLAB通信系统仿真 例2: 优先使用matlab内建 函数,将耗时的循环 写进MEX-File中以获 得加速!
西安電子料枝大鉴 N XIDIAN UNIVERSITY 国家重点实验室 代码注释规范 MATLAB 代码命名规范 的代码规范 代码的运行速度处理 代码的健壮性测试 宽带无线传输研究中心 Wireless Broadband Transmission Research Center
宽带无线传输研究中心 Wireless Broadband Transmission Research Center 17 代码注释规范 代码命名规范 代码的运行速度处理 代码的健壮性测试 MATLAB 的代码规范
西安電子抖较方粤 XIDIAN UNIVERSITY MATLAB通信系统仿真 国家重点实验室 如何测试代码的健壮性? ①对输入参数是否有格式要求?如必须是行向量? ②如果输入不满足要求,能否给出提示信息? ③对输入数据长度是否有要求? ④有没有考虑到输入数据为空的时候? in=[]; ⑤对输入数据的取值范围有无要求? ⑥最重要的是:测试数据源的随机性、完备性! ⑦有条件时利用第三方测试! 宽带无线传输研究中心 18 Wireless Broadband Transmission Research Center
宽带无线传输研究中心 Wireless Broadband Transmission Research Center 18 MATLAB通信系统仿真 如何测试代码的健壮性? ① 对输入参数是否有格式要求?如必须是行向量? ② 如果输入不满足要求,能否给出提示信息? ③ 对输入数据长度是否有要求? ④ 有没有考虑到输入数据为空的时候?in = [ ]; ⑤ 对输入数据的取值范围有无要求? ⑥ 最重要的是: 测试数据源的随机性、完备性! ⑦ 有条件时利用第三方测试!
面安電子科校大鉴 XIDIAN UNIVERSITY 汇报提纲 国家重点实验室 MATLAB的代码规范 MATLAB用于绘图 MATLAB用于通信系统仿真 MATLAB用于论文理论推导验证 MATLAB用于Modelsim代码测试 MATLAB用于Chipscope采集数据验证 宽带无线传输研究中心 Wireless Broadband Transmission Research Center
宽带无线传输研究中心 Wireless Broadband Transmission Research Center 19 MATLAB用于Chipscope采集数据验证 MATLAB用于Modelsim代码测试 MATLAB用于通信系统仿真 汇报提纲 MATLAB用于论文理论推导验证 MATLAB的代码规范 MATLAB用于绘图
西安電子抖枝出粤 通信系统仿真 N XIDIAN UNIVERSITY 国家重点实验室 曲线图plot semilogy、subplot: 100 中 Simulation(CH I) 10 口5 Simulation(CH Il) Simulation(CH Ill) 目 Simulation(CHV)) Exact SER 10 Asymptotic SER --TDR Telay 10 3s 10 33. 10 三三三三 二 二二二二二 106 2 DF relays 三三三 10 10 15 20 25 30 35 40 45 50 究中心 SNR.dB :ion Research Center
宽带无线传输研究中心 Wireless Broadband Transmission Research Center 20 通信系统仿真 曲线图plot、 semilogy、subplot: