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

📄 ex0802.c

📁 使用须知 1. 文件夹 两个文件夹:Mbook和Mfiles。 Mbook文件夹:存放可以用于教学或自学的Mbook形式的文档。 MFiles文件夹:存放所有例题的M文件
💻 C
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Tue Dec 02 11:44:05 2003
 * 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" "Ex0802" 
 */
#include "ex0802.h"
#include "libmatlbm.h"

static double _array1_[63] = { 0.0, .1, .2, .30000000000000004, .4, .5,
                               .6000000000000001, .7000000000000001, .8, .9,
                               1.0, 1.1, 1.2000000000000002, 1.3,
                               1.4000000000000001, 1.5, 1.6, 1.7000000000000002,
                               1.8, 1.9000000000000001, 2.0, 2.1, 2.2,
                               2.3000000000000003, 2.4000000000000004, 2.5, 2.6,
                               2.7, 2.8000000000000003, 2.9000000000000004, 3.0,
                               3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0,
                               4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0,
                               5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0,
                               6.1000000000000005, 6.2 };
static mxArray * _mxarray0_;

void InitializeModule_ex0802(void) {
    _mxarray0_ = mclInitializeDoubleVector(1, 63, _array1_);
}

void TerminateModule_ex0802(void) {
    mxDestroyArray(_mxarray0_);
}

static void Mex0802(void);

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

/*
 * The function "mlfEx0802" contains the normal interface for the "ex0802"
 * M-function from file "c:\my documents\caoyi\bookmatlab\exe\ex0802\ex0802.m"
 * (lines 1-6). This function processes any input arguments and passes them to
 * the implementation version of the function, appearing above.
 */
void mlfEx0802(void) {
    mlfEnterNewContext(0, 0);
    Mex0802();
    mlfRestorePreviousContext(0, 0);
}

/*
 * The function "mlxEx0802" contains the feval interface for the "ex0802"
 * M-function from file "c:\my documents\caoyi\bookmatlab\exe\ex0802\ex0802.m"
 * (lines 1-6). The feval function calls the implementation version of ex0802
 * through this function. This function processes any input arguments and
 * passes them to the implementation version of the function, appearing above.
 */
void mlxEx0802(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    if (nlhs > 0) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: ex0802 Line: 1 Column: "
            "1 The function \"ex0802\" was called with mor"
            "e than the declared number of outputs (0)."),
          NULL);
    }
    if (nrhs > 0) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: ex0802 Line: 1 Column: "
            "1 The function \"ex0802\" was called with mor"
            "e than the declared number of inputs (0)."),
          NULL);
    }
    mlfEnterNewContext(0, 0);
    Mex0802();
    mlfRestorePreviousContext(0, 0);
}

/*
 * The function "Mex0802" is the implementation version of the "ex0802"
 * M-function from file "c:\my documents\caoyi\bookmatlab\exe\ex0802\ex0802.m"
 * (lines 1-6). 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 Ex0802
 */
static void Mex0802(void) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_ex0802);
    mxArray * ans = NULL;
    mxArray * y = NULL;
    mxArray * x = NULL;
    /*
     * % Ex0802 绘制正弦信号波形
     * x=0:0.1:2*pi;
     */
    mlfAssign(&x, _mxarray0_);
    /*
     * y=sin(x);
     */
    mlfAssign(&y, mlfSin(mclVv(x, "x")));
    /*
     * plot(x,y)
     */
    mclPrintAns(&ans, mlfNPlot(0, mclVv(x, "x"), mclVv(y, "y"), NULL));
    mxDestroyArray(x);
    mxDestroyArray(y);
    mxDestroyArray(ans);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
}

⌨️ 快捷键说明

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