www.pudn.com > WCDMA.rar > GenUplinkSIgnal.cpp


#include  
#include  
#include  
#include  
//#include "mex.h" 
 
#define CHIP_LENGTH 38400 
 
 
void GenWCDMAUplinkSignal(double *CurrentInphaseChips,double *CurrentQuadratureChips, 
						  double *PastInphaseChips,double *PastQuadratureChips, 
						  double *FutureInphaseChips,double *FutureQuadratureChips, 
						  unsigned NumChips,double *PulseShape,unsigned PulseLength, 
						  unsigned SamplesPerChip,double *InphaseSignal, 
						  double *QuadratureSignal,unsigned NumSamples) 
/************************************************************************************************* 
/void GenWCDMAUplinkSignal(double *InphaseChips,double *QuadratureChips,unsigned NumChips, 
/						   double *PulseShape,unsigned PulseLength,unsigned SamplesPerChip, 
/						   double *InphaseSignal,double *QuadratureSignal,unsigned NumSamples) 
/ 
/ Copyright 2002 The Mobile and Portable Radio Research Group 
/ 
/Takes the Inphase and Quadrature Data Stream along with the pulse shape and generates 
/the baseband representation of the transmitted signal 
/ 
/Parameters 
/   Input 
/      InphaseChips        double *   Pointer to array of length NumChips that stores  
/                                     the inphase Chip values 
/      QuadratureChips     double *   Pointer to array of length NumChips that stores  
/                                     the quadrature Chip values 
/      NumChips            unsigned   Length of Chip arrays 
/      PulseShape          double *   Pointer to array of length PulseLength that stores 
/                                     the pulse shape 
/      PulseLength         unsigned   Length of the PulseShape array 
/      SamplesPerChip      unsighed   Number of samples per Chip (oversampling factor) 
/ 
/   Output 
/      InPhaseSignal       double *   Pointer to array of length NumSamples that stores  
/                                     the inphase signal values 
/      QuadratureSignal    double *   Pointer to array of length NumSamples that stores  
/                                     the quadrature signal values 
/      NumSamples          unsigned   Length of signal arrays 
/ 
/*************************************************************************************************/ 
{ 
	unsigned k0,k1; 
	unsigned TempChipArrayLength;	//number of chips used in the singal computation 
									//Equals the length of the frame plus the length of the pulse -1 
	unsigned PulseLengthInChips;	//Length of Tx Pulse in terms of chip duration 
	unsigned Overlap;				//Number of signal samples required from previous and next frame 
	unsigned Start,Finish;			//used to determine the start and finish of certain loops 
	double *InphaseChipArray,*InphaseChipsTemp;	//Pointer and temporary pointer that contains the  
												//chips that are needed to compute the inphase signal  
												//associated with the current frame 
	double *QuadChipArray,*QuadratureChipsTemp;	//Pointer and temporary pointer that contains the  
												//chips that are needed to compute the quadrature signal  
												//associated with the current frame 
	double *PulseShapeTemp,*TempPulseTemp;	//Temporary pointer for *PuseShape 
	double *InphaseSignalTemp,*QuadratureSignalTemp;	//Temporary pointers for inphase and quadrature signals 
	double *TempInphaseTemp,*TempQuadratureTemp;		//Temporary pointers for inphase and quadrature signals 
	 
	//Determine the lenght of the pulse in terms of chips 
	PulseLengthInChips = (int) (PulseLength / SamplesPerChip); 
 
	//Determine size of output array 
	NumSamples = PulseLength + (SamplesPerChip*(NumChips-1)); 
 
	//Determine the size of temporary chip array 
	TempChipArrayLength = CHIP_LENGTH + PulseLengthInChips; 
 
	//Allocate temporary chip array 
	InphaseChipArray = (double *) mxCalloc(TempChipArrayLength,sizeof(double)); 
	if (InphaseChipArray == NULL) mexErrMsgTxt("\nArray could not be allocated\n"); 
	QuadChipArray = (double *) mxCalloc(TempChipArrayLength,sizeof(double)); 
	if (QuadChipArray == NULL) mexErrMsgTxt("\nArray could not be allocated\n"); 
 
	//Load temporary chip array 
	InphaseChipsTemp = InphaseChipArray; 
	QuadratureChipsTemp = QuadChipArray; 
 
		//Load contribution from previous frame 
	Overlap = PulseLengthInChips/2; 
	TempInphaseTemp = PastInphaseChips + CHIP_LENGTH - Overlap; 
	TempQuadratureTemp = PastQuadratureChips + CHIP_LENGTH - Overlap; 
	for (k0=0; k0