⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 channel_simulatormex.c

📁 本程序利用改进的CHOW算法
💻 C
字号:
#include "mex.h"#include "mat.h"#include <math.h>#define mod_out plhs[0]#define	mod_in prhs[0]#define multipath prhs[1]#define delaysprd prhs[2]// function output_mod = channel_simulatormex(input_mod,multi_path,delay_spread);//Pass in a modulated waveform (input_mod) to be alterred by a channel.//Specify the type of channel to use (1==2-ray model 2==3-ray model)//Also, specify the delay spread.//returns modulated waveform with channel effects (output_mod)// This function was written by me, Joe Williams, a Stanford EE Grad Student. It is used for my // EE359 project (Wireless Comm). You may use this code in whatever manner you want as long as// you give me credit.void mexFunction(int nlhs,                      mxArray *plhs[],                     int nrhs,                      const mxArray *prhs[]){     double *output_mod,*input_mod,*output_temp;	double length,multi_path;    int j,delay_spread;	input_mod = mxGetPr(mod_in);	length = mxGetN(mod_in);	delay_spread=mxGetScalar(delaysprd);	multi_path=mxGetScalar(multipath);    mod_out = mxCreateDoubleMatrix(1,length,mxREAL);	output_mod = mxGetPr(mod_out);	//multipath two ray model	if(multi_path==1){	  for(j=0;j<delay_spread;j++)	    output_mod[j]=input_mod[j];	  for(j=delay_spread;j<length;j++)	    output_mod[j]=input_mod[j]+/*.5**/input_mod[j-delay_spread];	}	//multipath three ray model	else if(multi_path==2){	  for(j=0;j<delay_spread;j++)	    output_mod[j]=input_mod[j];	  for(j=delay_spread;j<length;j++)	    output_mod[j]=input_mod[j]+/*.5**/input_mod[j-delay_spread/2]+/*.5**/input_mod[j-delay_spread];	}	//invalid multipath	else{	  for(j=0;j<length;j++)  	    output_mod[j]=input_mod[j];	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -