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

📄 wcdmacubicinterp.cpp

📁 用matlab程序实现WCDMA系统的仿真
💻 CPP
字号:
#include <malloc.h>
#include "mex.h"
//#include <math.h>
#include "matrix.h"
#include <stdlib.h>
#include "Cubic.cpp"

extern void Cubic(double *,double *,double *,unsigned,
		   double *, double *,double *,unsigned );

void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
/***************************************************************************************
* void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
*
* Gateway function for WCDMACubicInterp.  Supports that passing of three input parameters
* and one output parameter.  The five input parameters are
*		Data Abcissa Values			Array containing the abcissa values associated 
*									with the data to be interpolated
*		DataValues					Array containing the data to be interpolated
*		Interpolated Abcissa Values	Array containing the abcissa values of points to 
*									be interpolated
*
* The output parameter is
*		Interpolated Curve			Interpolated data points
***************************************************************************************/
{
	const mxArray *tprhs;
	unsigned mexDataAbcissaLength,mexDataLength,mexAbcissaLength,mrows,ncols;
	double *mexDataAbcissaValues,*mexRealDataValues,*mexImagDataValues;
	double *mexAbcissaValues;
	double *mexRealInterp,*mexImagInterp;
	
	
	//Check for the proper number of input and output arguments
	if (nrhs != 3) mexErrMsgTxt("\nExactly THREE input arguemnts are required!!\n");
	else if (nlhs != 1 ) mexErrMsgTxt("\nExactly ONE output arguement is required!!\n");

	
	//Data Abcissa Values
	//Must be a double vector
	tprhs = *prhs;
	mrows = mxGetM(tprhs);
	ncols = mxGetN(tprhs);
	if ( !mxIsDouble(tprhs) || mxIsComplex(tprhs) || (mrows ==1 && ncols ==1) || (mrows >1 && ncols >1))
		mexErrMsgTxt("\nX must be a real-valued vector\n");
	if (mrows > ncols) mexDataAbcissaLength = (unsigned ) mrows;
	else mexDataAbcissaLength = (unsigned) ncols;
	mexDataAbcissaValues = mxGetPr(tprhs);
	
	

	//Data Values
	//Must be a double, complex and a vector
	tprhs = *(prhs+1);
	mrows = mxGetM(tprhs);
	ncols = mxGetN(tprhs);
	if ( !mxIsDouble(tprhs) || !mxIsComplex(tprhs) || (mrows ==1 && ncols ==1) || (mrows >1 && ncols >1))
		mexErrMsgTxt("\nY must be a complex vector\n");
	if (mrows > ncols) mexDataLength = (unsigned) mrows;
	else mexDataLength = (unsigned) ncols;
	if (mexDataLength != mexDataAbcissaLength)
		mexErrMsgTxt("\nBoth X and Y must have the same length!\n");
	mexRealDataValues = mxGetPr(tprhs);
	mexImagDataValues = mxGetPi(tprhs);

	//Interpolated Abcissa Values
	//Must be a double vector
	tprhs = *(prhs+2);
	mrows = mxGetM(tprhs);
	ncols = mxGetN(tprhs);
	if ( !mxIsDouble(tprhs) || mxIsComplex(tprhs) || (mrows ==1 && ncols ==1) || (mrows >1 && ncols >1))
		mexErrMsgTxt("\nXI must be a real-valued vector\n");
	if (mrows > ncols) mexAbcissaLength = (unsigned) mrows;
	else mexAbcissaLength = (unsigned) ncols;
	mexAbcissaValues = mxGetPr(tprhs);
	
	

	//Allocate output Array for interpolated curve
	*plhs = mxCreateDoubleMatrix(mexAbcissaLength,1,mxCOMPLEX);
	mexRealInterp = mxGetPr(*plhs);
	mexImagInterp = mxGetPi(*plhs);

	//Call Cubic interpoaltor
	Cubic(mexDataAbcissaValues,mexRealDataValues,mexImagDataValues,mexDataAbcissaLength,
		  mexAbcissaValues,mexRealInterp,mexImagInterp,mexAbcissaLength);

}

⌨️ 快捷键说明

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