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

📄 circle_f.c

📁 该程序为MATLAB对CDMA系统个部分的仿真
💻 C
字号:
/*
 * MATLAB Compiler: 2.2
 * Date: Tue Jun 25 12:26:00 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" "circle_f" 
 */
#include "circle_f.h"
#include "axis.h"
#include "clf.h"
#include "libmatlbm.h"

static mxChar _array1_[134] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'c', 'i', 'r', 'c', 'l',
                                'e', '_', 'f', ' ', 'L', 'i', 'n', 'e', ':',
                                ' ', '1', ' ', 'C', 'o', 'l', 'u', 'm', 'n',
                                ':', ' ', '1', ' ', 'T', 'h', 'e', ' ', 'f',
                                'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '"',
                                'c', 'i', 'r', 'c', 'l', 'e', '_', 'f', '"',
                                ' ', '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', ' ', '(', '0', ')', '.' };
static mxArray * _mxarray0_;

static mxChar _array3_[133] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'c', 'i', 'r', 'c', 'l',
                                'e', '_', 'f', ' ', 'L', 'i', 'n', 'e', ':',
                                ' ', '1', ' ', 'C', 'o', 'l', 'u', 'm', 'n',
                                ':', ' ', '1', ' ', 'T', 'h', 'e', ' ', 'f',
                                'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '"',
                                'c', 'i', 'r', 'c', 'l', 'e', '_', 'f', '"',
                                ' ', '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 double _array5_[201] = { 0.0, .031415926535897934, .06283185307179587,
                                .0942477796076938, .12566370614359174,
                                .15707963267948966, .1884955592153876,
                                .21991148575128555, .25132741228718347,
                                .2827433388230814, .3141592653589793,
                                .3455751918948773, .3769911184307752,
                                .4084070449666731, .4398229715025711,
                                .471238898038469, .5026548245743669,
                                .5340707511102649, .5654866776461628,
                                .5969026041820608, .6283185307179586,
                                .6597344572538566, .6911503837897546,
                                .7225663103256524, .7539822368615504,
                                .7853981633974484, .8168140899333463,
                                .8482300164692442, .8796459430051422,
                                .9110618695410401, .942477796076938,
                                .9738937226128359, 1.0053096491487339,
                                1.0367255756846319, 1.0681415022205298,
                                1.0995574287564276, 1.1309733552923256,
                                1.1623892818282235, 1.1938052083641215,
                                1.2252211349000195, 1.2566370614359172,
                                1.2880529879718152, 1.3194689145077132,
                                1.3508848410436112, 1.3823007675795091,
                                1.4137166941154071, 1.4451326206513049,
                                1.4765485471872029, 1.5079644737231008,
                                1.5393804002589988, 1.5707963267948968,
                                1.6022122533307945, 1.6336281798666925,
                                1.6650441064025905, 1.6964600329384885,
                                1.7278759594743864, 1.7592918860102844,
                                1.7907078125461822, 1.8221237390820801,
                                1.8535396656179781, 1.884955592153876,
                                1.916371518689774, 1.9477874452256718,
                                1.9792033717615698, 2.0106192982974678,
                                2.0420352248333655, 2.0734511513692637,
                                2.1048670779051615, 2.1362830044410597,
                                2.1676989309769574, 2.199114857512855,
                                2.2305307840487534, 2.261946710584651,
                                2.2933626371205493, 2.324778563656447,
                                2.356194490192345, 2.387610416728243,
                                2.419026343264141, 2.450442269800039,
                                2.4818581963359367, 2.5132741228718345,
                                2.5446900494077327, 2.5761059759436304,
                                2.6075219024795286, 2.6389378290154264,
                                2.6703537555513246, 2.7017696820872223,
                                2.73318560862312, 2.7646015351590183,
                                2.796017461694916, 2.8274333882308142,
                                2.858849314766712, 2.8902652413026098,
                                2.921681167838508, 2.9530970943744057,
                                2.984513020910304, 3.0159289474462017,
                                3.0473448739820994, 3.0787608005179976,
                                3.1101767270538954, 3.141592653589793,
                                3.173008580125691, 3.2044245066615886,
                                3.235840433197487, 3.2672563597333846,
                                3.2986722862692823, 3.3300882128051805,
                                3.3615041393410783, 3.3929200658769765,
                                3.4243359924128742, 3.455751918948772,
                                3.48716784548467, 3.518583772020568,
                                3.549999698556466, 3.581415625092364,
                                3.6128315516282616, 3.64424747816416,
                                3.6756634047000576, 3.707079331235956,
                                3.7384952577718535, 3.7699111843077517,
                                3.8013271108436495, 3.8327430373795472,
                                3.8641589639154454, 3.895574890451343,
                                3.9269908169872414, 3.958406743523139,
                                3.989822670059037, 4.0212385965949355,
                                4.052654523130833, 4.084070449666731,
                                4.115486376202629, 4.146902302738527,
                                4.178318229274424, 4.209734155810322,
                                4.241150082346221, 4.2725660088821185,
                                4.303981935418016, 4.335397861953915,
                                4.366813788489813, 4.39822971502571,
                                4.429645641561608, 4.461061568097506,
                                4.492477494633404, 4.523893421169301,
                                4.5553093477052, 4.586725274241098,
                                4.6181412007769955, 4.649557127312894,
                                4.680973053848792, 4.71238898038469,
                                4.743804906920587, 4.775220833456485,
                                4.806636759992383, 4.838052686528282,
                                4.869468613064179, 4.900884539600077,
                                4.932300466135975, 4.9637163926718735,
                                4.995132319207771, 5.026548245743669,
                                5.057964172279567, 5.0893800988154645,
                                5.120796025351362, 5.152211951887261,
                                5.183627878423159, 5.215043804959056,
                                5.246459731494954, 5.277875658030853,
                                5.3092915845667505, 5.340707511102648,
                                5.372123437638546, 5.403539364174444,
                                5.434955290710342, 5.46637121724624,
                                5.497787143782138, 5.529203070318036,
                                5.5606189968539335, 5.592034923389832,
                                5.62345084992573, 5.654866776461628,
                                5.686282702997525, 5.717698629533423,
                                5.749114556069321, 5.7805304826052195,
                                5.811946409141117, 5.843362335677015,
                                5.874778262212913, 5.906194188748811,
                                5.937610115284709, 5.969026041820607,
                                6.000441968356505, 6.031857894892402,
                                6.063273821428301, 6.094689747964199,
                                6.126105674500097, 6.157521601035994,
                                6.188937527571892, 6.220353454107791,
                                6.2517693806436885, 6.283185307179586 };
static mxArray * _mxarray4_;
static mxArray * _mxarray6_;

static mxChar _array8_[2] = { 'r', '*' };
static mxArray * _mxarray7_;

static mxChar _array10_[6] = { 's', 'q', 'u', 'a', 'r', 'e' };
static mxArray * _mxarray9_;

void InitializeModule_circle_f(void) {
    _mxarray0_ = mclInitializeString(134, _array1_);
    _mxarray2_ = mclInitializeString(133, _array3_);
    _mxarray4_ = mclInitializeDoubleVector(1, 201, _array5_);
    _mxarray6_ = mclInitializeComplex(0.0, 1.0);
    _mxarray7_ = mclInitializeString(2, _array8_);
    _mxarray9_ = mclInitializeString(6, _array10_);
}

void TerminateModule_circle_f(void) {
    mxDestroyArray(_mxarray9_);
    mxDestroyArray(_mxarray7_);
    mxDestroyArray(_mxarray6_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static void Mcircle_f(mxArray * r);

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

/*
 * The function "mlfCircle_f" contains the normal interface for the "circle_f"
 * M-function from file "D:\mywork\circle_f.m" (lines 1-4). This function
 * processes any input arguments and passes them to the implementation version
 * of the function, appearing above.
 */
void mlfCircle_f(mxArray * r) {
    mlfEnterNewContext(0, 1, r);
    Mcircle_f(r);
    mlfRestorePreviousContext(0, 1, r);
}

/*
 * The function "mlxCircle_f" contains the feval interface for the "circle_f"
 * M-function from file "D:\mywork\circle_f.m" (lines 1-4). The feval function
 * calls the implementation version of circle_f through this function. This
 * function processes any input arguments and passes them to the implementation
 * version of the function, appearing above.
 */
void mlxCircle_f(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[1];
    int i;
    if (nlhs > 0) {
        mlfError(_mxarray0_);
    }
    if (nrhs > 1) {
        mlfError(_mxarray2_);
    }
    for (i = 0; i < 1 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 1; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 1, mprhs[0]);
    Mcircle_f(mprhs[0]);
    mlfRestorePreviousContext(0, 1, mprhs[0]);
}

/*
 * The function "Mcircle_f" is the implementation version of the "circle_f"
 * M-function from file "D:\mywork\circle_f.m" (lines 1-4). 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 circle_f(r)
 */
static void Mcircle_f(mxArray * r) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_circle_f);
    mxArray * x = mclGetUninitializedArray();
    mxArray * t = mclGetUninitializedArray();
    mxArray * ans = mclGetUninitializedArray();
    mclCopyArray(&r);
    /*
     * clf;t=0:pi/100:2*pi;x=r*exp(i*t);
     */
    mclAssignAns(&ans, mlfNClf(0, NULL));
    mlfAssign(&t, _mxarray4_);
    mlfAssign(
      &x,
      mclMtimes(
        mclVa(r, "r"), mclVe(mlfExp(mclMtimes(_mxarray6_, mclVv(t, "t"))))));
    /*
     * plot(x,'r*');axis('square')
     */
    mclAssignAns(&ans, mlfNPlot(0, mclVv(x, "x"), _mxarray7_, NULL));
    mclPrintAns(&ans, mlfAxis(NULL, NULL, _mxarray9_, NULL));
    mxDestroyArray(ans);
    mxDestroyArray(t);
    mxDestroyArray(x);
    mxDestroyArray(r);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
}

⌨️ 快捷键说明

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