📄 de_16qam.c
字号:
/*
* MATLAB Compiler: 3.0
* Date: Fri Mar 24 11:31:36 2006
* Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
* "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
* "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib"
* "adptive_bitpow_allocate_systems"
*/
#include "de_16qam.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
static mxArray * _mxarray2_;
static mxArray * _mxarray3_;
static mxArray * _mxarray4_;
static mxArray * _mxarray5_;
static mxArray * _mxarray6_;
static mxArray * _mxarray7_;
static mxArray * _mxarray8_;
static double _array10_[4] = { 0.0, 0.0, 0.0, 0.0 };
static mxArray * _mxarray9_;
static mxArray * _mxarray11_;
static double _array13_[4] = { 0.0, 0.0, 1.0, 0.0 };
static mxArray * _mxarray12_;
static mxArray * _mxarray14_;
static double _array16_[4] = { 1.0, 0.0, 0.0, 0.0 };
static mxArray * _mxarray15_;
static mxArray * _mxarray17_;
static double _array19_[4] = { 1.0, 0.0, 1.0, 0.0 };
static mxArray * _mxarray18_;
static mxArray * _mxarray20_;
static double _array22_[4] = { 0.0, 1.0, 0.0, 0.0 };
static mxArray * _mxarray21_;
static mxArray * _mxarray23_;
static double _array25_[4] = { 0.0, 0.0, 0.0, 1.0 };
static mxArray * _mxarray24_;
static mxArray * _mxarray26_;
static double _array28_[4] = { 0.0, 1.0, 1.0, 0.0 };
static mxArray * _mxarray27_;
static mxArray * _mxarray29_;
static double _array31_[4] = { 0.0, 0.0, 1.0, 1.0 };
static mxArray * _mxarray30_;
static mxArray * _mxarray32_;
static double _array34_[4] = { 1.0, 0.0, 0.0, 1.0 };
static mxArray * _mxarray33_;
static mxArray * _mxarray35_;
static double _array37_[4] = { 1.0, 1.0, 0.0, 0.0 };
static mxArray * _mxarray36_;
static mxArray * _mxarray38_;
static double _array40_[4] = { 1.0, 1.0, 1.0, 0.0 };
static mxArray * _mxarray39_;
static mxArray * _mxarray41_;
static double _array43_[4] = { 1.0, 0.0, 1.0, 1.0 };
static mxArray * _mxarray42_;
static mxArray * _mxarray44_;
static double _array46_[4] = { 0.0, 1.0, 0.0, 1.0 };
static mxArray * _mxarray45_;
static mxArray * _mxarray47_;
static double _array49_[4] = { 1.0, 1.0, 0.0, 1.0 };
static mxArray * _mxarray48_;
static mxArray * _mxarray50_;
static double _array52_[4] = { 1.0, 1.0, 1.0, 1.0 };
static mxArray * _mxarray51_;
static mxArray * _mxarray53_;
static double _array55_[4] = { 0.0, 1.0, 1.0, 1.0 };
static mxArray * _mxarray54_;
void InitializeModule_de_16qam(void) {
_mxarray0_ = mclInitializeDouble(10.0);
_mxarray1_ = mclInitializeDouble(2.0);
_mxarray2_ = mclInitializeDouble(1.0);
_mxarray3_ = mclInitializeDouble(3.0);
_mxarray4_ = mclInitializeDouble(-2.0);
_mxarray5_ = mclInitializeDouble(-3.0);
_mxarray6_ = mclInitializeDouble(-1.0);
_mxarray7_ = mclInitializeDouble(0.0);
_mxarray8_ = mclInitializeComplex(1.0, 1.0);
_mxarray9_ = mclInitializeDoubleVector(1, 4, _array10_);
_mxarray11_ = mclInitializeComplex(1.0, -1.0);
_mxarray12_ = mclInitializeDoubleVector(1, 4, _array13_);
_mxarray14_ = mclInitializeComplex(-1.0, 1.0);
_mxarray15_ = mclInitializeDoubleVector(1, 4, _array16_);
_mxarray17_ = mclInitializeComplex(-1.0, -1.0);
_mxarray18_ = mclInitializeDoubleVector(1, 4, _array19_);
_mxarray20_ = mclInitializeComplex(3.0, 1.0);
_mxarray21_ = mclInitializeDoubleVector(1, 4, _array22_);
_mxarray23_ = mclInitializeComplex(1.0, 3.0);
_mxarray24_ = mclInitializeDoubleVector(1, 4, _array25_);
_mxarray26_ = mclInitializeComplex(3.0, -1.0);
_mxarray27_ = mclInitializeDoubleVector(1, 4, _array28_);
_mxarray29_ = mclInitializeComplex(1.0, -3.0);
_mxarray30_ = mclInitializeDoubleVector(1, 4, _array31_);
_mxarray32_ = mclInitializeComplex(-1.0, 3.0);
_mxarray33_ = mclInitializeDoubleVector(1, 4, _array34_);
_mxarray35_ = mclInitializeComplex(-3.0, 1.0);
_mxarray36_ = mclInitializeDoubleVector(1, 4, _array37_);
_mxarray38_ = mclInitializeComplex(-3.0, -1.0);
_mxarray39_ = mclInitializeDoubleVector(1, 4, _array40_);
_mxarray41_ = mclInitializeComplex(-1.0, -3.0);
_mxarray42_ = mclInitializeDoubleVector(1, 4, _array43_);
_mxarray44_ = mclInitializeComplex(3.0, 3.0);
_mxarray45_ = mclInitializeDoubleVector(1, 4, _array46_);
_mxarray47_ = mclInitializeComplex(-3.0, 3.0);
_mxarray48_ = mclInitializeDoubleVector(1, 4, _array49_);
_mxarray50_ = mclInitializeComplex(-3.0, -3.0);
_mxarray51_ = mclInitializeDoubleVector(1, 4, _array52_);
_mxarray53_ = mclInitializeComplex(3.0, -3.0);
_mxarray54_ = mclInitializeDoubleVector(1, 4, _array55_);
}
void TerminateModule_de_16qam(void) {
mxDestroyArray(_mxarray54_);
mxDestroyArray(_mxarray53_);
mxDestroyArray(_mxarray51_);
mxDestroyArray(_mxarray50_);
mxDestroyArray(_mxarray48_);
mxDestroyArray(_mxarray47_);
mxDestroyArray(_mxarray45_);
mxDestroyArray(_mxarray44_);
mxDestroyArray(_mxarray42_);
mxDestroyArray(_mxarray41_);
mxDestroyArray(_mxarray39_);
mxDestroyArray(_mxarray38_);
mxDestroyArray(_mxarray36_);
mxDestroyArray(_mxarray35_);
mxDestroyArray(_mxarray33_);
mxDestroyArray(_mxarray32_);
mxDestroyArray(_mxarray30_);
mxDestroyArray(_mxarray29_);
mxDestroyArray(_mxarray27_);
mxDestroyArray(_mxarray26_);
mxDestroyArray(_mxarray24_);
mxDestroyArray(_mxarray23_);
mxDestroyArray(_mxarray21_);
mxDestroyArray(_mxarray20_);
mxDestroyArray(_mxarray18_);
mxDestroyArray(_mxarray17_);
mxDestroyArray(_mxarray15_);
mxDestroyArray(_mxarray14_);
mxDestroyArray(_mxarray12_);
mxDestroyArray(_mxarray11_);
mxDestroyArray(_mxarray9_);
mxDestroyArray(_mxarray8_);
mxDestroyArray(_mxarray7_);
mxDestroyArray(_mxarray6_);
mxDestroyArray(_mxarray5_);
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray3_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mde_16qam(int nargout_, mxArray * x);
_mexLocalFunctionTable _local_function_table_de_16qam
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfDe_16qam" contains the normal interface for the "de_16qam"
* M-function from file
* "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\de_16qam.m" (lines 1-36). This
* function processes any input arguments and passes them to the implementation
* version of the function, appearing above.
*/
mxArray * mlfDe_16qam(mxArray * x) {
int nargout = 1;
mxArray * y = NULL;
mlfEnterNewContext(0, 1, x);
y = Mde_16qam(nargout, x);
mlfRestorePreviousContext(0, 1, x);
return mlfReturnValue(y);
}
/*
* The function "mlxDe_16qam" contains the feval interface for the "de_16qam"
* M-function from file
* "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\de_16qam.m" (lines 1-36). The
* feval function calls the implementation version of de_16qam through this
* function. This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxDe_16qam(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: de_16qam Line: 1 Column:"
" 1 The function \"de_16qam\" was called with m"
"ore than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: de_16qam Line: 1 Column:"
" 1 The function \"de_16qam\" was called with m"
"ore than the declared number of inputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mde_16qam(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mde_16qam" is the implementation version of the "de_16qam"
* M-function from file
* "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\de_16qam.m" (lines 1-36). It
* contains the actual compiled code for that M-function. It is a static
* function and must only be called from one of the interface functions,
* appearing below.
*/
/*
* function y=de_16qam(x) %qam解调,X1是序列长度,K1就是2^K1qam
*/
static mxArray * Mde_16qam(int nargout_, mxArray * x) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_de_16qam);
mxArray * y = NULL;
mxArray * y1 = NULL;
mclCopyArray(&x);
/*
* % for n=1:4:16
* % x=1.4+sqrt(-1)*(-2.6);
* x=x*sqrt(10);
*/
mlfAssign(&x, mclMtimes(mclVa(x, "x"), mlfSqrt(_mxarray0_)));
/*
* y=real(x);
*/
mlfAssign(&y, mlfReal(mclVa(x, "x")));
/*
* y1=imag(x);
*/
mlfAssign(&y1, mlfImag(mclVa(x, "x")));
/*
* if (y>=0)&(y<=2) y=1;
*/
{
mxArray * a_ = mclInitialize(mclGe(mclVv(y, "y"), _mxarray7_));
if (mlfTobool(a_)
&& mlfTobool(mclAnd(a_, mclLe(mclVv(y, "y"), _mxarray1_)))) {
mxDestroyArray(a_);
mlfAssign(&y, _mxarray2_);
/*
* elseif (y>2) y=3;
*/
} else {
mxDestroyArray(a_);
if (mclGtBool(mclVv(y, "y"), _mxarray1_)) {
mlfAssign(&y, _mxarray3_);
/*
* elseif (y<-2) y=-3;
*/
} else if (mclLtBool(mclVv(y, "y"), _mxarray4_)) {
mlfAssign(&y, _mxarray5_);
/*
* else y=-1;
*/
} else {
mlfAssign(&y, _mxarray6_);
}
}
/*
* end
*/
}
/*
* if (y1>=0)&(y1<=2) y1=1;
*/
{
mxArray * a_ = mclInitialize(mclGe(mclVv(y1, "y1"), _mxarray7_));
if (mlfTobool(a_)
&& mlfTobool(mclAnd(a_, mclLe(mclVv(y1, "y1"), _mxarray1_)))) {
mxDestroyArray(a_);
mlfAssign(&y1, _mxarray2_);
/*
* elseif (y1>2) y1=3;
*/
} else {
mxDestroyArray(a_);
if (mclGtBool(mclVv(y1, "y1"), _mxarray1_)) {
mlfAssign(&y1, _mxarray3_);
/*
* elseif (y1<-2) y1=-3;
*/
} else if (mclLtBool(mclVv(y1, "y1"), _mxarray4_)) {
mlfAssign(&y1, _mxarray5_);
/*
* else y1=-1;
*/
} else {
mlfAssign(&y1, _mxarray6_);
}
}
/*
* end
*/
}
/*
* x=complex(y,y1);
*/
mlfAssign(&x, mlfComplex(mclVv(y, "y"), mclVv(y1, "y1")));
/*
* if x==1+j y=[0 0 0 0];
*/
if (mclEqBool(mclVa(x, "x"), _mxarray8_)) {
mlfAssign(&y, _mxarray9_);
/*
* elseif x==1-j y=[0 0 1 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray11_)) {
mlfAssign(&y, _mxarray12_);
/*
* elseif x==-1+j y=[1 0 0 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray14_)) {
mlfAssign(&y, _mxarray15_);
/*
* elseif x==-1-j y=[1 0 1 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray17_)) {
mlfAssign(&y, _mxarray18_);
/*
* elseif x==3+j y=[0 1 0 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray20_)) {
mlfAssign(&y, _mxarray21_);
/*
* elseif x==1+3*j y=[0 0 0 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray23_)) {
mlfAssign(&y, _mxarray24_);
/*
* elseif x==3-j y=[0 1 1 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray26_)) {
mlfAssign(&y, _mxarray27_);
/*
* elseif x==1-3*j y=[0 0 1 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray29_)) {
mlfAssign(&y, _mxarray30_);
/*
* elseif x==-1+3*j y=[1 0 0 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray32_)) {
mlfAssign(&y, _mxarray33_);
/*
* elseif x==-3+j y=[1 1 0 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray35_)) {
mlfAssign(&y, _mxarray36_);
/*
* elseif x==-3-j y=[1 1 1 0];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray38_)) {
mlfAssign(&y, _mxarray39_);
/*
* elseif x==-1-3*j y=[1 0 1 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray41_)) {
mlfAssign(&y, _mxarray42_);
/*
* elseif x==3+3*j y=[0 1 0 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray44_)) {
mlfAssign(&y, _mxarray45_);
/*
* elseif x==-3+3*j y=[1 1 0 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray47_)) {
mlfAssign(&y, _mxarray48_);
/*
* elseif x==-3-3*j y=[1 1 1 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray50_)) {
mlfAssign(&y, _mxarray51_);
/*
* elseif x==3-3*j y=[0 1 1 1];
*/
} else if (mclEqBool(mclVa(x, "x"), _mxarray53_)) {
mlfAssign(&y, _mxarray54_);
/*
* end
*/
}
mclValidateOutput(y, 1, nargout_, "y", "de_16qam");
mxDestroyArray(y1);
mxDestroyArray(x);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return y;
/*
*
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -