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

📄 exm1.c

📁 该程序为MATLAB对CDMA系统个部分的仿真
💻 C
字号:
/*
 * MATLAB Compiler: 2.2
 * Date: Tue Jun 25 12:31:24 2002
 * 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" "-x" "-W" "mex" "-L" "C"
 * "-t" "-T" "link:mexlibrary" "libmatlbmx.mlib" "exm1" 
 */
#include "exm1.h"
#include "libmatlbm.h"
#include "rank.h"

static mxChar _array1_[126] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'e', 'x', 'm', '1', ' ',
                                'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
                                'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
                                'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
                                'i', 'o', 'n', ' ', '"', 'e', 'x', 'm', '1',
                                '"', ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l',
                                'l', 'e', 'd', ' ', 'w', 'i', 't', 'h', ' ',
                                'm', 'o', 'r', 'e', ' ', 't', 'h', 'a', 'n',
                                ' ', 't', 'h', 'e', ' ', 'd', 'e', 'c', 'l',
                                'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b',
                                'e', 'r', ' ', 'o', 'f', ' ', 'o', 'u', 't',
                                'p', 'u', 't', 's', ' ', '(', '1', ')', '.' };
static mxArray * _mxarray0_;

static mxChar _array3_[125] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'e', 'x', 'm', '1', ' ',
                                'L', 'i', 'n', 'e', ':', ' ', '1', ' ', 'C',
                                'o', 'l', 'u', 'm', 'n', ':', ' ', '1', ' ',
                                'T', 'h', 'e', ' ', 'f', 'u', 'n', 'c', 't',
                                'i', 'o', 'n', ' ', '"', 'e', 'x', 'm', '1',
                                '"', ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l',
                                'l', 'e', 'd', ' ', 'w', 'i', 't', 'h', ' ',
                                'm', 'o', 'r', 'e', ' ', 't', 'h', 'a', 'n',
                                ' ', 't', 'h', 'e', ' ', 'd', 'e', 'c', 'l',
                                'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b',
                                'e', 'r', ' ', 'o', 'f', ' ', 'i', 'n', 'p',
                                'u', 't', 's', ' ', '(', '1', ')', '.' };
static mxArray * _mxarray2_;

static mxChar _array5_[33] = { 'A', 'n', ' ', 'i', 'n', 'p', 'u', 't', ' ',
                               'm', 'a', 't', 'r', 'i', 'x', ' ', 's', 'h',
                               'o', 'u', 'l', 'd', ' ', 'b', 'e', ' ', 'n',
                               '-', 'b', 'y', '-', 'n', '.' };
static mxArray * _mxarray4_;

static mxChar _array7_[25] = { 'T', 'h', 'i', 's', ' ', 'm', 'a', 't', 'r',
                               'i', 'x', ' ', 'i', 's', ' ', 'n', 'o', 'n',
                               's', 'i', 'g', 'u', 'l', 'a', 'r' };
static mxArray * _mxarray6_;

static mxChar _array9_[22] = { 'T', 'h', 'i', 's', ' ', 'm', 'a', 't',
                               'r', 'i', 'x', ' ', 'i', 's', ' ', 's',
                               'i', 'g', 'u', 'l', 'a', 'r' };
static mxArray * _mxarray8_;

void InitializeModule_exm1(void) {
    _mxarray0_ = mclInitializeString(126, _array1_);
    _mxarray2_ = mclInitializeString(125, _array3_);
    _mxarray4_ = mclInitializeString(33, _array5_);
    _mxarray6_ = mclInitializeString(25, _array7_);
    _mxarray8_ = mclInitializeString(22, _array9_);
}

void TerminateModule_exm1(void) {
    mxDestroyArray(_mxarray8_);
    mxDestroyArray(_mxarray6_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mexm1(int nargout_, mxArray * A);

_mexLocalFunctionTable _local_function_table_exm1
  = { 0, (mexFunctionTableEntry *)NULL };

/*
 * The function "mlfExm1" contains the normal interface for the "exm1"
 * M-function from file "D:\mywork\exm1.m" (lines 1-12). This function
 * processes any input arguments and passes them to the implementation version
 * of the function, appearing above.
 */
mxArray * mlfExm1(mxArray * A) {
    int nargout = 1;
    mxArray * y = mclGetUninitializedArray();
    mlfEnterNewContext(0, 1, A);
    y = Mexm1(nargout, A);
    mlfRestorePreviousContext(0, 1, A);
    return mlfReturnValue(y);
}

/*
 * The function "mlxExm1" contains the feval interface for the "exm1"
 * M-function from file "D:\mywork\exm1.m" (lines 1-12). The feval function
 * calls the implementation version of exm1 through this function. This
 * function processes any input arguments and passes them to the implementation
 * version of the function, appearing above.
 */
void mlxExm1(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[1];
    mxArray * mplhs[1];
    int i;
    if (nlhs > 1) {
        mlfError(_mxarray0_);
    }
    if (nrhs > 1) {
        mlfError(_mxarray2_);
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = mclGetUninitializedArray();
    }
    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] = Mexm1(nlhs, mprhs[0]);
    mlfRestorePreviousContext(0, 1, mprhs[0]);
    plhs[0] = mplhs[0];
}

/*
 * The function "Mexm1" is the implementation version of the "exm1" M-function
 * from file "D:\mywork\exm1.m" (lines 1-12). 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=exm1(A)
 */
static mxArray * Mexm1(int nargout_, mxArray * A) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_exm1);
    mxArray * y = mclGetUninitializedArray();
    mxArray * r = mclGetUninitializedArray();
    mxArray * ans = mclGetUninitializedArray();
    mxArray * n = mclGetUninitializedArray();
    mxArray * m = mclGetUninitializedArray();
    mclCopyArray(&A);
    /*
     * [m,n]=size(A);
     */
    mlfSize(mlfVarargout(&m, &n, NULL), mclVa(A, "A"), NULL);
    /*
     * if m~=n;
     */
    if (mclNeBool(mclVv(m, "m"), mclVv(n, "n"))) {
        /*
         * error('An input matrix should be n-by-n.')
         */
        mlfError(_mxarray4_);
    /*
     * end
     */
    }
    /*
     * r=rank(A);
     */
    mlfAssign(&r, mlfRank(mclVa(A, "A"), NULL));
    /*
     * if r==m
     */
    if (mclEqBool(mclVv(r, "r"), mclVv(m, "m"))) {
        /*
         * disp('This matrix is nonsigular')
         */
        mlfDisp(_mxarray6_);
    /*
     * else
     */
    } else {
        /*
         * disp('This matrix is sigular')
         */
        mlfDisp(_mxarray8_);
    /*
     * end
     */
    }
    mclValidateOutput(y, 1, nargout_, "y", "exm1");
    mxDestroyArray(m);
    mxDestroyArray(n);
    mxDestroyArray(ans);
    mxDestroyArray(r);
    mxDestroyArray(A);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return y;
}

⌨️ 快捷键说明

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