📄 eqzf.c
字号:
/* ============================================================================
Property of Freescale
Freescale Confidential Proprietary
Freescale Copyright (C) 2006 All rights reserved
----------------------------------------------------------------------------
$RCSfile: EqZF.c.rca $
Tag $Name: $
$Revision: 1.2 $
$Date: Mon Dec 11 14:46:00 2006 $
Target Processor: Matlab
============================================================================ */
#include <stdlib.h>
#include <math.h>
#include "mex.h"
#include "SBX_FPULSPK_EqZF.c"
#undef _ENTERPRISE_C_
#include "prototype.c"
#include "math_funcs.c"
// Input Arguments (not all might be used)
#define X1_IN prhs[0]
#define X2_IN prhs[1]
// Output Arguments (not all might be used)
#define Y1_OUT plhs[0]
// compatible with SBX_FPULSPK_EqZF.c version 1.9
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
/* Matlab input interface (not all might be used) */
short int *X1;
long int *X2;
unsigned long int X3;
unsigned short int *X4;
/* Matlab input dimensions (not all might be used) */
unsigned long mx1,nx1;
unsigned long mx2,nx2;
/* Matlab output dimensions (not all might be used) */
unsigned long my1,ny1;
// Others
long int status;
double *temp1,*temp2,*temp3,*temp4,*temp5,*temp6;
int i,j;
/* Check for proper number of arguments */
if (nlhs != 1)
{
mexErrMsgTxt("Error: 1 output argument required.");
}
if (nrhs != 2)
{
mexErrMsgTxt("Error: 2 input arguments required.");
}
/* Check the input format */
if ( (!mxIsDouble(X1_IN) || !mxIsComplex(X1_IN)))
{
mexErrMsgTxt("Error: Input 1 data must be complex of class 'double'.");
}
if ( (!mxIsDouble(X2_IN) || !mxIsComplex(X2_IN)))
{
mexErrMsgTxt("Error: Input 2 data must be complex of class 'double'.");
}
/* get input dimensions (not all might be used) */
mx1=mxGetM(X1_IN); nx1=mxGetN(X1_IN);
mx2=mxGetM(X2_IN); nx2=mxGetN(X2_IN);
/* collect data : X1*/
X1 = mxMalloc(sizeof(short int*)*mx1*nx1*2);
temp1 = (double *)mxGetPr(X1_IN);
temp2 = (double *)mxGetPi(X1_IN);
for(i=0;i<mx1*nx1;i++)
{
X1[2*i] = (short int) temp1[i] ;
X1[2*i+1] = (short int) temp2[i] ;
}
/* collect data : X2*/
X2 = mxMalloc(sizeof(long int*)*mx2*nx2*2);
temp3 = (double *)mxGetPr(X2_IN);
temp4 = (double *)mxGetPi(X2_IN);
for(i=0;i<mx2*nx2;i++)
{
X2[2*i] = (long int) temp3[i] ;
X2[2*i+1] = (long int) temp4[i] ;
}
X3=48;
X4=0; //Gain=0
status = SBX_FPULSPK_EqZF(X1,X2,X3,X4);
my1=mx1;ny1=nx1;
Y1_OUT = mxCreateNumericMatrix(my1, ny1, mxDOUBLE_CLASS, mxCOMPLEX);
temp5 = (double*)mxGetPr(Y1_OUT); temp6 = (double*)mxGetPi(Y1_OUT);
for(i=0;i<my1*ny1;i++)
{
temp5[i] = (double) X1[i*2] ;
temp6[i] = (double) X1[i*2+1] ;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -