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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sfun_ctr.c

?? matlab的大量實例代碼
?? C
字號:

/*
 * 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色噜噜狠狠色综合欧洲selulu| 成人午夜免费视频| 亚洲精品视频一区| 国产精品久久久久久久久免费丝袜| 久久蜜桃香蕉精品一区二区三区| 欧美日韩高清一区| 91精品久久久久久久久99蜜臂| 欧美性色欧美a在线播放| 欧美熟乱第一页| 337p亚洲精品色噜噜| 91精品欧美综合在线观看最新 | 亚洲国产电影在线观看| 国产亚洲精品久| 国产精品乱人伦一区二区| 国产精品国产馆在线真实露脸| 综合久久一区二区三区| 亚洲国产视频在线| 日韩精品久久理论片| 国产一区二区在线观看视频| 成人妖精视频yjsp地址| 在线观看日韩一区| 91精品免费观看| 久久欧美中文字幕| 亚洲摸摸操操av| 天堂蜜桃91精品| 国产精品18久久久久久久久| 不卡视频在线观看| 欧美色网站导航| 2023国产精品| 一区二区三区不卡视频| 美美哒免费高清在线观看视频一区二区 | 色综合久久六月婷婷中文字幕| 94-欧美-setu| 欧美一区永久视频免费观看| 国产亚洲一区二区三区四区| 一区二区三区欧美视频| 国精品**一区二区三区在线蜜桃| 成人动漫一区二区| 日韩午夜av一区| 亚洲精品视频在线| 国产一区二区三区黄视频| 色妹子一区二区| 国产性天天综合网| 蜜桃免费网站一区二区三区| 91在线国内视频| 久久婷婷国产综合精品青草| 亚洲综合男人的天堂| 国产成人av一区二区三区在线| 欧美午夜精品电影| 国产精品福利在线播放| 久久99精品国产.久久久久久| av成人老司机| 亚洲国产电影在线观看| 精品亚洲国内自在自线福利| 欧美性色欧美a在线播放| 国产精品视频观看| 国产精品一区二区三区99| 欧美一区午夜精品| 天天综合色天天综合色h| 在线亚洲高清视频| 亚洲欧美一区二区三区极速播放| 国产一区二区主播在线| 精品999在线播放| 久久精品噜噜噜成人av农村| 欧美日韩卡一卡二| 亚洲一区中文在线| 在线免费观看视频一区| 亚洲免费观看高清完整| 99精品视频在线观看免费| 中文字幕乱码亚洲精品一区| 国产乱码精品一区二区三区忘忧草| 日韩一区二区三区四区五区六区 | 亚洲1区2区3区4区| 欧美在线三级电影| 亚洲h动漫在线| 欧美老女人在线| 日本午夜精品视频在线观看| 欧美老女人第四色| 蜜臀久久99精品久久久画质超高清| 欧美高清视频不卡网| 蜜桃av噜噜一区二区三区小说| 久久精品人人做人人爽人人| 国内精品久久久久影院色| 欧美成人官网二区| 国产麻豆日韩欧美久久| 国产精品污污网站在线观看| 成人教育av在线| 一区二区三区中文字幕在线观看| 日本韩国精品在线| 蜜臀av性久久久久蜜臀aⅴ流畅 | 国产精品日产欧美久久久久| 国产91清纯白嫩初高中在线观看| 国产精品欧美一区喷水| 91污在线观看| 日本伊人午夜精品| 久久蜜桃香蕉精品一区二区三区| av综合在线播放| 亚洲一区二区三区国产| 91精品在线麻豆| 成人白浆超碰人人人人| 亚洲电影第三页| 国产日韩欧美制服另类| 91国偷自产一区二区使用方法| 天堂午夜影视日韩欧美一区二区| 精品精品国产高清a毛片牛牛| 国产91丝袜在线18| 亚洲成av人片在线| 国产色产综合色产在线视频 | 亚洲电影一级黄| 精品va天堂亚洲国产| 91在线精品一区二区| 热久久国产精品| 亚洲欧洲av另类| 日韩女优制服丝袜电影| 91麻豆免费看| 国产毛片精品视频| 午夜精品久久久久久久久| 欧美国产一区在线| 日韩午夜在线影院| 91国偷自产一区二区使用方法| 激情综合色综合久久| 亚洲与欧洲av电影| 国产精品第五页| 国产精品区一区二区三区| 欧美日韩一级片在线观看| 国产99久久久国产精品潘金| 无码av免费一区二区三区试看| 国产精品入口麻豆九色| 日韩欧美第一区| 欧美日韩国产系列| 99精品久久只有精品| 国产一区二区免费在线| 日韩精品久久久久久| 一区二区高清在线| 中文字幕亚洲在| 国产欧美一区二区三区网站 | 色综合中文综合网| 精品国产一二三| 欧美日产在线观看| 在线看国产一区二区| av高清不卡在线| 粉嫩aⅴ一区二区三区四区五区| 日本成人超碰在线观看| 亚洲成在人线免费| 一二三区精品视频| 一区二区三区在线免费视频| 中文字幕一区三区| 亚洲免费观看高清| 中文字幕一区av| 国产精品成人免费在线| 国产日韩欧美综合在线| 久久久久久免费| 久久久久久久久久久久久夜| 欧美草草影院在线视频| 欧美一区二区久久| 日韩区在线观看| 日韩精品一区二区三区蜜臀| 欧美一级日韩不卡播放免费| 日韩一级片网站| 日韩欧美电影一区| 久久精品在线免费观看| 国产日韩欧美不卡在线| 国产亚洲精品福利| 亚洲欧美日韩国产手机在线| 亚洲精品老司机| 午夜精品视频一区| 激情综合色播五月| 国产成人日日夜夜| 97se亚洲国产综合自在线不卡| 91在线porny国产在线看| 日本二三区不卡| 91麻豆精品国产91久久久| 日韩视频在线观看一区二区| 精品区一区二区| 国产精品久久久久久福利一牛影视| 最近日韩中文字幕| 亚洲国产一区二区三区青草影视| 日本在线不卡视频| 国产成a人亚洲精| 欧美在线不卡视频| www国产成人| 亚洲综合丝袜美腿| 精品中文字幕一区二区| www.日韩av| 欧美精品 国产精品| 国产欧美日韩麻豆91| 一区二区三区av电影| 国产专区综合网| 日韩欧美一二三区| 中文字幕一区二区三区在线不卡| 亚洲国产综合在线| 不卡区在线中文字幕| 69久久夜色精品国产69蝌蚪网 | 东方aⅴ免费观看久久av| 91精彩视频在线| 久久精品男人的天堂| 亚洲一区二区三区三| 丁香激情综合国产| 日韩欧美在线1卡| 亚洲一区国产视频|