亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sfun_ctr.c

?? 大量matlab實(shí)例代碼
?? C
字號(hào):

/*
 * sfuntmpl_basic.c: Basic 'C' template for a level 2 S-function.
 *
 *  -------------------------------------------------------------------------
 *  | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |
 *  -------------------------------------------------------------------------
 *
 * Copyright 1990-2001 The MathWorks, Inc.
 * $Revision: 1.26 $
 */


/*
 * You must specify the S_FUNCTION_NAME as the name of your S-function
 * (i.e. replace sfuntmpl_basic with the name of your S-function).
 */

#define S_FUNCTION_NAME  sfun_ctr
#define S_FUNCTION_LEVEL 2

/*
 * Need to include simstruc.h for the definition of the SimStruct and
 * its associated macro definitions.
 */
#include "simstruc.h"
#include "math.h"

/* Error handling
 * --------------
 *
 * You should use the following technique to report errors encountered within
 * an S-function:
 *
 *       ssSetErrorStatus(S,"Error encountered due to ...");
 *       return;
 *
 * Note that the 2nd argument to ssSetErrorStatus must be persistent memory.
 * It cannot be a local variable. For example the following will cause
 * unpredictable errors:
 *
 *      mdlOutputs()
 *      {
 *         char msg[256];         {ILLEGAL: to fix use "static char msg[256];"}
 *         sprintf(msg,"Error due to %s", string);
 *         ssSetErrorStatus(S,msg);
 *         return;
 *      }
 *
 * See matlabroot/simulink/src/sfuntmpl_doc.c for more details.
 */

 double sign(double x)
{
   double f;
   f=1; if (x<=0) f=-1; return(f);
}

double fal(double e, double a, const real_T *p1)
{
   double d;
   d=p1[0];
   if (fabs(e)<=d) return(e*pow(a,d));
   else return(pow(fabs(e),a)*sign(e));
}

/*====================*
 * S-function methods *
 *====================*/

/* Function: mdlInitializeSizes ===============================================
 * Abstract:
 *    The sizes information is used by Simulink to determine the S-function
 *    block's characteristics (number of inputs, outputs, states, etc.).
 */
static void mdlInitializeSizes(SimStruct *S)
{
    /* See sfuntmpl_doc.c for more details on the macros below */

    ssSetNumSFcnParams(S, 4);  /* number of extra parameters */
    if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
        /* Return if number of expected != number of actual parameters */
        return;
    }

    ssSetNumContStates(S, 0);
    ssSetNumDiscStates(S, 0);

    if (!ssSetNumInputPorts(S, 1)) return;
    ssSetInputPortWidth(S, 0, 5);
    ssSetInputPortRequiredContiguous(S, 0, true); /*direct input signal access*/
    /*
     * Set direct feedthrough flag (1=yes, 0=no).
     * A port has direct feedthrough if the input is used in either
     * the mdlOutputs or mdlGetTimeOfNextVarHit functions.
     * See matlabroot/simulink/src/sfuntmpl_directfeed.txt.
     */
    ssSetInputPortDirectFeedThrough(S, 0, 1);

    if (!ssSetNumOutputPorts(S, 1)) return;
    ssSetOutputPortWidth(S, 0, 1);

    ssSetNumSampleTimes(S, 1);
    ssSetNumRWork(S, 4);
    ssSetNumIWork(S, 0);
    ssSetNumPWork(S, 0);
    ssSetNumModes(S, 0);
    ssSetNumNonsampledZCs(S, 0);

    ssSetOptions(S, 0);
}

/* Function: mdlInitializeSampleTimes =========================================
 * Abstract:
 *    This function is used to specify the sample time(s) for your
 *    S-function. You must register the same number of sample times as
 *    specified in ssSetNumSampleTimes.
 */
static void mdlInitializeSampleTimes(SimStruct *S)
{
    ssSetSampleTime(S, 0, 0.0);
    ssSetOffsetTime(S, 0, 0.0);
}

#define MDL_INITIALIZE_CONDITIONS   /* Change to #undef to remove function */
#if defined(MDL_INITIALIZE_CONDITIONS)
  /* Function: mdlInitializeConditions ========================================
   * Abstract:
   *    In this function, you should initialize the continuous and discrete
   *    states for your S-function block.  The initial states are placed
   *    in the state vector, ssGetContStates(S) or ssGetRealDiscStates(S).
   *    You can also perform any other initialization activities that your
   *    S-function may require. Note, this routine will be called at the
   *    start of simulation and if it is present in an enabled subsystem
   *    configured to reset states, it will be call when the enabled subsystem
   *    restarts execution to reset the states.
   */
  static void mdlInitializeConditions(SimStruct *S)
  {
  }
#endif /* MDL_INITIALIZE_CONDITIONS */

#define MDL_START  /* Change to #undef to remove function */
#if defined(MDL_START) 
  /* Function: mdlStart =======================================================
   * Abstract:
   *    This function is called once at start of model execution. If you
   *    have states that should be initialized once, this is the place
   *    to do it.
   */
  static void mdlStart(SimStruct *S)
  {
  }
#endif /*  MDL_START */

/* Function: mdlOutputs =======================================================
 * Abstract:
 *    In this function, you compute the outputs of your S-function
 *    block. Generally outputs are placed in the output vector, ssGetY(S).
 */
static void mdlOutputs(SimStruct *S, int_T tid)
{
    const real_T *x = ssGetRealDiscStates(S);
    const real_T *u = (const real_T*) ssGetInputPortSignal(S,0);
    real_T       *y = ssGetOutputPortSignal(S,0);
    const real_T *a = mxGetPr(ssGetSFcnParam(S,0));
    const real_T *bet = mxGetPr(ssGetSFcnParam(S,1));
    const real_T *b = mxGetPr(ssGetSFcnParam(S,2));
    const real_T *d = mxGetPr(ssGetSFcnParam(S,3));
    double e1, e2, u0, a1, a2;
    a1 = a[0]; a2 = a[1];
    e1 = u[0]-u[2]; e2 = u[1]-u[3];
    u0 = bet[0]*fal(e1,a1,d) + bet[1]*fal(e2,a2,d);
    y[0] = u0-u[4]/b[0];
}

#define MDL_UPDATE  /* Change to #undef to remove function */
#if defined(MDL_UPDATE)
  /* Function: mdlUpdate ======================================================
   * Abstract:
   *    This function is called once for every major integration time step.
   *    Discrete states are typically updated here, but this function is useful
   *    for performing any tasks that should only take place once per
   *    integration step.
   */
  static void mdlUpdate(SimStruct *S, int_T tid)
  {
  }
#endif /* MDL_UPDATE */

#define MDL_DERIVATIVES  /* Change to #undef to remove function */
#if defined(MDL_DERIVATIVES)
  /* Function: mdlDerivatives =================================================
   * Abstract:
   *    In this function, you compute the S-function block's derivatives.
   *    The derivatives are placed in the derivative vector, ssGetdX(S).
   */
  static void mdlDerivatives(SimStruct *S)
  {
  }
#endif /* MDL_DERIVATIVES */

/* Function: mdlTerminate =====================================================
 * Abstract:
 *    In this function, you should perform any actions that are necessary
 *    at the termination of a simulation.  For example, if memory was
 *    allocated in mdlStart, this is the place to free it.
 */
static void mdlTerminate(SimStruct *S)
{
}

/*======================================================*
 * See sfuntmpl_doc.c for the optional S-function methods *
 *======================================================*/

/*=============================*
 * Required S-function trailer *
 *=============================*/

#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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产99国产精品| 成人精品视频网站| 欧美自拍偷拍一区| 亚洲手机成人高清视频| 日本精品一区二区三区四区的功能| 在线播放日韩导航| 日精品一区二区| 精品欧美乱码久久久久久1区2区| 自拍av一区二区三区| 91浏览器入口在线观看| 亚洲一区二区偷拍精品| 在线不卡中文字幕播放| 日韩码欧中文字| 欧美美女网站色| 亚洲天堂网中文字| 欧美三区在线观看| 经典一区二区三区| 136国产福利精品导航| 欧美人动与zoxxxx乱| 激情文学综合丁香| 亚洲视频在线一区| av在线播放成人| 日韩激情av在线| 国产精品亲子伦对白| 欧美最猛性xxxxx直播| 国产一区在线观看视频| 亚洲欧美日韩精品久久久久| 国产一区二区伦理片| 欧美日韩精品一区二区三区四区| 亚洲男女一区二区三区| 在线视频你懂得一区| 狠狠色综合日日| 亚洲免费视频中文字幕| 国内精品免费**视频| 中文字幕一区二区不卡| 日韩欧美在线综合网| 91香蕉视频mp4| 韩国视频一区二区| 精品国产乱码久久久久久免费| 午夜精品一区在线观看| 日韩丝袜美女视频| 日本aⅴ免费视频一区二区三区 | 久久久电影一区二区三区| 972aa.com艺术欧美| 久久久亚洲精品石原莉奈| 午夜欧美2019年伦理| 久久久亚洲精品石原莉奈| 99国产精品99久久久久久| 日韩国产成人精品| 国产欧美日韩精品在线| 欧美视频在线观看一区| 韩国欧美一区二区| 亚洲成a人v欧美综合天堂下载| 欧美主播一区二区三区美女| 亚洲国产一区二区视频| 男男gaygay亚洲| 欧美一级高清片| 精品视频色一区| 在线观看国产91| 99re这里只有精品首页| 亚洲欧美一区二区三区国产精品 | 欧美挠脚心视频网站| 午夜精品一区二区三区电影天堂| 91精品国产综合久久婷婷香蕉| 老司机免费视频一区二区| 一级特黄大欧美久久久| 日韩一区日韩二区| 久久精品人人做人人爽97| 欧美白人最猛性xxxxx69交| 欧美军同video69gay| 欧美在线不卡一区| 色哟哟欧美精品| 色噜噜狠狠成人网p站| 天涯成人国产亚洲精品一区av| 久久先锋资源网| 91网页版在线| 色吧成人激情小说| 在线免费观看日本一区| 91色视频在线| 在线观看不卡视频| 欧美日韩亚洲综合一区| 欧美日韩美少妇| 麻豆国产91在线播放| 最新中文字幕一区二区三区| 亚洲欧洲av在线| 亚洲激情图片一区| 亚洲激情成人在线| 亚洲第一主播视频| 亚洲制服丝袜av| 国产午夜三级一区二区三| 国产三级精品三级| 国产精品电影一区二区| 亚洲免费大片在线观看| 久久色.com| 国产视频一区二区在线| 久久久精品中文字幕麻豆发布| 欧美在线观看一区二区| 91免费视频网址| 一本一道综合狠狠老| 久久精品国产精品亚洲精品| 奇米在线7777在线精品| 欧美极品少妇xxxxⅹ高跟鞋| 久久久精品蜜桃| 国产欧美一区二区精品仙草咪| 69久久99精品久久久久婷婷| 精品国产91九色蝌蚪| 欧美国产1区2区| 午夜伦欧美伦电影理论片| 久草这里只有精品视频| 岛国一区二区在线观看| 91成人网在线| 久久综合久久久久88| 最新不卡av在线| 中文字幕精品在线不卡| 久久精品一区二区三区av| 亚洲精品午夜久久久| 蜜桃91丨九色丨蝌蚪91桃色| 成人午夜私人影院| 欧美剧在线免费观看网站| 色综合激情五月| 欧美电影免费观看完整版| 中文字幕在线视频一区| 日韩专区一卡二卡| 亚洲精品免费视频| 九九在线精品视频| 色综合激情久久| 国产亚洲精品bt天堂精选| 一区二区三区**美女毛片| 国产制服丝袜一区| 精东粉嫩av免费一区二区三区| 麻豆精品国产91久久久久久| 秋霞午夜鲁丝一区二区老狼| 91免费观看在线| 久久人人97超碰com| 午夜欧美视频在线观看| caoporn国产精品| 日韩女优av电影在线观看| 亚洲精品中文字幕乱码三区| 亚洲激情自拍偷拍| 国产成人午夜片在线观看高清观看| 国产高清成人在线| 丁香六月综合激情| 日韩精品一区在线观看| 久久日韩精品一区二区五区| 丝袜美腿亚洲综合| 91免费国产在线| 中文字幕一区二区三区在线观看| 国产精品久久三| 国产精品夜夜爽| 久久综合色婷婷| 久久se这里有精品| 成人h版在线观看| 久久久久一区二区三区四区| 久色婷婷小香蕉久久| 欧美日本一区二区三区| 亚洲综合在线电影| 91视频一区二区| 国产精品国产三级国产aⅴ原创| 亚洲一区av在线| 一本一道波多野结衣一区二区| 欧美精品一卡二卡| 亚洲一区二区在线播放相泽| 在线一区二区三区四区五区| 日韩三级中文字幕| 五月综合激情婷婷六月色窝| 在线亚洲高清视频| 又紧又大又爽精品一区二区| 日本高清无吗v一区| 亚洲欧美日韩电影| 欧美主播一区二区三区| 亚洲午夜久久久久久久久电影院| 久久精品免费看| 精品欧美乱码久久久久久| 精品一区二区三区免费观看| 亚洲精品在线免费播放| 国产一区二区不卡在线| 91福利在线播放| 亚洲综合在线免费观看| 欧美日韩视频不卡| 五月天欧美精品| 欧美一卡在线观看| 极品销魂美女一区二区三区| 在线观看亚洲精品视频| 午夜精品福利久久久| 日韩欧美国产麻豆| 一区二区三区在线观看动漫 | 成人av在线电影| 中文字幕一区二区三区不卡| 欧美在线视频日韩| 日本 国产 欧美色综合| 国产日本欧美一区二区| 99久久综合99久久综合网站| 亚洲一区在线播放| 日韩丝袜情趣美女图片| 国产精品1区2区3区在线观看| 欧美一级精品大片| 国产在线播放一区二区三区| 国产精品久久久久久久久果冻传媒 | 亚洲一区日韩精品中文字幕| 91精品国产欧美一区二区成人|