atenuacion_fibra_simulink.c

来自「matlab在通信原理中的应用」· C语言 代码 · 共 457 行 · 第 1/2 页

C
457
字号
          mxCreateString(
            "Run-time Error: File: str2num Line: 1 Column: "
            "1 The function \"str2num\" was called with mor"
            "e than the declared number of outputs (2)."),
          NULL);
    }
    if (nrhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: str2num Line: 1 Column:"
            " 1 The function \"str2num\" was called with m"
            "ore than the declared number of inputs (1)."),
          NULL);
    }
    for (i = 0; i < 2; ++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] = Mstr2num(&mplhs[1], nlhs, mprhs[0]);
    mlfRestorePreviousContext(0, 1, mprhs[0]);
    plhs[0] = mplhs[0];
    for (i = 1; i < 2 && i < nlhs; ++i) {
        plhs[i] = mplhs[i];
    }
    for (; i < 2; ++i) {
        mxDestroyArray(mplhs[i]);
    }
}

/*
 * The function "mlfNum2str" contains the normal interface for the "num2str"
 * M-function from file "c:\matlab6p5\toolbox\matlab\strfun\num2str.m" (lines
 * 0-0). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfNum2str(mxArray * x, mxArray * f) {
    int nargout = 1;
    mxArray * s = NULL;
    mlfEnterNewContext(0, 2, x, f);
    s = Mnum2str(nargout, x, f);
    mlfRestorePreviousContext(0, 2, x, f);
    return mlfReturnValue(s);
}

/*
 * The function "mlxNum2str" contains the feval interface for the "num2str"
 * M-function from file "c:\matlab6p5\toolbox\matlab\strfun\num2str.m" (lines
 * 0-0). The feval function calls the implementation version of num2str through
 * this function. This function processes any input arguments and passes them
 * to the implementation version of the function, appearing above.
 */
void mlxNum2str(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[2];
    mxArray * mplhs[1];
    int i;
    if (nlhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: num2str Line: 1 Column: "
            "1 The function \"num2str\" was called with mor"
            "e than the declared number of outputs (1)."),
          NULL);
    }
    if (nrhs > 2) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: num2str Line: 1 Column:"
            " 1 The function \"num2str\" was called with m"
            "ore than the declared number of inputs (2)."),
          NULL);
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    for (i = 0; i < 2 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 2; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 2, mprhs[0], mprhs[1]);
    mplhs[0] = Mnum2str(nlhs, mprhs[0], mprhs[1]);
    mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
    plhs[0] = mplhs[0];
}

/*
 * The function "mlfGcs" contains the normal interface for the "gcs" M-function
 * from file "c:\matlab6p5\toolbox\simulink\simulink\gcs.m" (lines 0-0). This
 * function processes any input arguments and passes them to the implementation
 * version of the function, appearing above.
 */
mxArray * mlfGcs(void) {
    int nargout = 1;
    mxArray * cursys = NULL;
    mlfEnterNewContext(0, 0);
    cursys = Mgcs(nargout);
    mlfRestorePreviousContext(0, 0);
    return mlfReturnValue(cursys);
}

/*
 * The function "mlxGcs" contains the feval interface for the "gcs" M-function
 * from file "c:\matlab6p5\toolbox\simulink\simulink\gcs.m" (lines 0-0). The
 * feval function calls the implementation version of gcs through this
 * function. This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
void mlxGcs(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mplhs[1];
    int i;
    if (nlhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: gcs Line: 1 Column: 1 The function \"gcs\""
            " was called with more than the declared number of outputs (1)."),
          NULL);
    }
    if (nrhs > 0) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: gcs Line: 1 Column: 1 The function \"gcs\""
            " was called with more than the declared number of inputs (0)."),
          NULL);
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    mlfEnterNewContext(0, 0);
    mplhs[0] = Mgcs(nlhs);
    mlfRestorePreviousContext(0, 0);
    plhs[0] = mplhs[0];
}

/*
 * The function mdlInitializeSizes is a Compiler-generated Simulink S-function
 * wrapper. Simulink calls this function to initialize the S-function's "sizes"
 * structure. The arguments to the -u and -y mcc options are used to initialize
 * the number of inputs and outputs the S-function accepts and returns. If -u
 * or -y was not specified, this function uses the value -1, which is the same
 * as the DYNAMICALLY_SIZED macro.
 */
void mdlInitializeSizes(SimStruct * S) {
    mclInitializeSizes(S, -1, -1);
}

/*
 * The function mdlInitializeSampleTimes is a Compiler-generated Simulink
 * S-function wrapper. Simulink calls this function to initialize the
 * S-function's sample times array. This function initializes the S-function's
 * sample time to be inherited from the block driving it.
 */
void mdlInitializeSampleTimes(SimStruct * S) {
    mclInitializeSampleTimes(S);
}

/*
 * The function mdlInitializeConditions is a Compiler-generated Simulink
 * S-function wrapper. Simulink calls this function to initialize the
 * S-function's states and work vectors. Since Compiler-generated S-functions
 * have no states and no work vectors, this function is empty.
 */
void mdlInitializeConditions(real_T * x0, SimStruct * S) {
}

/*
 * The function mdlOutputs is a Compiler-generated Simulink S-function wrapper.
 * Simulink calls this function to compute the S-function's output vector. This
 * function initializes a table for use by the feval function and initializes
 * any persistent variables. It then calls the function "mlxAtenuacion_fibra".
 * Finally it clears the feval table and exits.
 */
void mdlOutputs(real_T * y,
                real_T const * x,
                real_T const * u,
                SimStruct * S,
                int_T tid) {
    mclSimulink(y, x, u, S, tid, mlxAtenuacion_fibra, &_mex_info);
}

/*
 * The function mdlUpdate is a Compiler-generated Simulink S-function wrapper.
 * Simulink calls this function to perform major time step updates. Simulink
 * does not call this function if the S-function has no discrete states and has
 * direct feedthrough. Since Compiler-generated S-functions meet these
 * criteria, this function is never called, and is therefore left empty.
 */
void mdlUpdate(real_T * x, real_T const * u, SimStruct * S, int_T tid) {
}

/*
 * The function mdlDerivatives is a Compiler-generated Simulink S-function
 * wrapper. Simulink calls this function to compute derivatives for continuous
 * states. Since Compiler-generated S-functions are stateless, this function is
 * left empty.
 */
void mdlDerivatives(real_T * dx,
                    real_T const * x,
                    real_T const * u,
                    SimStruct * S,
                    int_T tid) {
}

/*
 * The function mdlTerminate is a Compiler-generated Simulink S-function
 * wrapper. Simulink calls this function to clean up the S-function at the
 * termination of a simulation. Since Compiler-generated S-functions need no
 * cleanup, this function is left empty.
 */
void mdlTerminate(SimStruct * S) {
}
#ifdef  MATLAB_MEX_FILE    /* Is this file being compiled as a MEX-file? */
#include "simulink.c"      /* MEX-file interface mechanism */
#else
#include "cg_sfun.h"       /* Code generation registration function */
#endif

#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

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