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

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

?? sfun_han.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_han
#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 fst(real_T *x, const real_T *u, const real_T *p1, const real_T *p2)
{
   double delta, delta0, a0, a, y, r, h;
   r=p1[0]; h=p2[0];
   delta=r*h; delta0=delta*h;
   y=x[0]-u[0]+h*x[1]; 
   a0=sqrt(delta*delta+8.0*r*fabs(y));
   if (fabs(y) <= delta0) a=x[1]+y/h;
   else a=x[1]+0.5*(a0-delta)*sign(y);
   if (fabs(a) <= delta) return (-r*a/delta);
   else return(-r*sign(a));
}

/*====================*
 * 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, 3);  /* number of extra parameters */
    if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
        /* Return if number of expected != number of actual parameters */
        return;
    }

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

    if (!ssSetNumInputPorts(S, 1)) return;
    ssSetInputPortWidth(S, 0, 1);
    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, 0);

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

    ssSetNumSampleTimes(S, 1);
    ssSetNumRWork(S, 3);
    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, *mxGetPr(ssGetSFcnParam(S,2)));
    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);
    real_T       *y = ssGetOutputPortSignal(S,0);
    y[0] = x[0];
    y[1] = x[1];
}

#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)
  {
    real_T       *x = ssGetRealDiscStates(S);
    const real_T *u = (const real_T*) ssGetInputPortSignal(S,0);
    const real_T *r = mxGetPr(ssGetSFcnParam(S,0));
    const real_T *h = mxGetPr(ssGetSFcnParam(S,1));
    const real_T *T = mxGetPr(ssGetSFcnParam(S,2));
    real_T tempX[2] = {0.0, 0.0};
    tempX[0] = x[0] + T[0]*x[1]; 
    tempX[1] = x[1] + T[0]*fst(x,u,r,h);
/*    printf("%f, %f, %f\n",tempX[0],tempX[1],fst(x,u,r,h));*/
    x[0] = tempX[0]; x[1] = tempX[1];
  }
#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一区二区三区免费野_久草精品视频
国产精品毛片久久久久久| 激情文学综合丁香| 亚洲国产欧美日韩另类综合| 日本一区二区在线不卡| 国产精品乱人伦中文| 综合久久综合久久| 日韩精品每日更新| 国产传媒日韩欧美成人| 91福利资源站| 国产欧美精品一区二区色综合| 国产精品视频观看| 婷婷综合久久一区二区三区| 美国精品在线观看| 在线观看日产精品| 久久精品一区八戒影视| 全国精品久久少妇| 成人av动漫在线| 日韩一二三区不卡| 亚洲一区在线观看视频| 国产精品一区在线观看你懂的| 91丨porny丨最新| 国产精品亲子乱子伦xxxx裸| 日韩电影网1区2区| 欧美日韩精品一区视频| 亚洲欧美偷拍卡通变态| 99久久国产免费看| 国产精品入口麻豆原神| 岛国一区二区三区| 欧美韩国日本一区| 99久久精品国产一区| 欧美国产日韩在线观看| 成人91在线观看| 亚洲精品视频在线看| 欧美在线你懂得| 日日夜夜一区二区| 欧美va亚洲va在线观看蝴蝶网| 亚洲一区视频在线| 欧美mv日韩mv| proumb性欧美在线观看| 亚洲一区二区精品3399| 日韩欧美成人激情| 成人丝袜高跟foot| 亚洲天堂a在线| 日韩一区和二区| 国产一区二区三区在线观看精品| 国产精品视频观看| 欧美日韩久久一区二区| 国产一区二区免费在线| 中文字幕日本不卡| 日韩午夜激情视频| www.久久久久久久久| 日本vs亚洲vs韩国一区三区二区| 久久久国产精品不卡| 欧美日韩一区二区在线观看视频| 激情丁香综合五月| 日韩av电影天堂| 亚洲一区二区三区三| 欧美优质美女网站| 色噜噜夜夜夜综合网| 成人一级片在线观看| 久久成人免费网| 日本伊人精品一区二区三区观看方式| 777a∨成人精品桃花网| 国产高清在线观看免费不卡| 亚洲小说欧美激情另类| 久久久久久久久99精品| 欧美一级日韩免费不卡| 国产九色精品成人porny| 青草av.久久免费一区| 亚洲五码中文字幕| 国产精品二区一区二区aⅴ污介绍| 欧美午夜一区二区| 99久久久国产精品免费蜜臀| 日韩国产一二三区| 亚洲第一电影网| 亚洲国产精品一区二区久久恐怖片| 日本一区二区三区在线观看| 久久品道一品道久久精品| 欧美日韩卡一卡二| 国产精品二区一区二区aⅴ污介绍| 色婷婷久久99综合精品jk白丝| 免费国产亚洲视频| 欧美一级生活片| 国模一区二区三区白浆| 在线综合亚洲欧美在线视频| 欧美亚洲日本国产| 最新不卡av在线| 91偷拍与自偷拍精品| 亚洲国产高清aⅴ视频| 日本强好片久久久久久aaa| 欧美日韩国产在线观看| 亚洲地区一二三色| 3d成人动漫网站| 国产综合久久久久久鬼色 | 欧美a级一区二区| 色老头久久综合| 亚洲人亚洲人成电影网站色| 风间由美一区二区av101| 日韩一区二区在线播放| 青青草国产成人av片免费| 91小视频免费观看| 亚洲欧美一区二区三区久本道91| 国产精品18久久久久| 久久久综合视频| 成人动漫视频在线| 亚洲一区二区在线播放相泽| 92精品国产成人观看免费| 中文字幕一区二| 91色九色蝌蚪| 亚洲夂夂婷婷色拍ww47| 91老师片黄在线观看| 一区二区三区在线观看视频| 精品视频1区2区3区| 日本一区中文字幕| 国产精品色眯眯| 色婷婷久久一区二区三区麻豆| 午夜天堂影视香蕉久久| 久久久久久久久岛国免费| 91免费国产在线观看| 国产在线观看一区二区| 一区2区3区在线看| 久久婷婷成人综合色| 欧美一区二区成人6969| 色婷婷久久久亚洲一区二区三区 | 亚洲尤物在线视频观看| 26uuu精品一区二区| 666欧美在线视频| 欧美性大战久久久久久久蜜臀 | 精品在线视频一区| 一区二区在线观看不卡| 久久精品一级爱片| 日韩视频免费观看高清完整版在线观看 | 久久免费美女视频| 欧美日韩一卡二卡三卡 | 成人午夜激情片| 久久99精品网久久| 亚洲成人福利片| 亚洲精品国久久99热| 久久精品视频免费| 久久精品人人爽人人爽| 久久综合九色综合97婷婷| 久久久电影一区二区三区| 国产丝袜在线精品| 亚洲男人电影天堂| 婷婷成人综合网| 国产一区二区三区黄视频 | 婷婷激情综合网| www.亚洲人| 国产日韩欧美精品一区| 午夜一区二区三区在线观看| 国产老妇另类xxxxx| 欧美丝袜丝交足nylons| 欧美日韩国产一二三| 日韩一级免费观看| 亚洲欧美怡红院| 久久99精品视频| 日本精品一区二区三区四区的功能| 欧美日韩国产免费一区二区| 2020日本不卡一区二区视频| 久久se精品一区二区| 欧美顶级少妇做爰| 国产精品国产三级国产aⅴ中文| 日韩经典一区二区| 色天天综合色天天久久| 久久美女高清视频| 三级成人在线视频| 91成人在线精品| 国产精品网站在线| 国产在线精品一区二区不卡了| 91麻豆免费看片| 亚洲日本在线a| 91麻豆产精品久久久久久| 国产精品你懂的在线| 99久久精品国产观看| 成人高清视频在线| jizzjizzjizz欧美| 一区二区三区久久| 欧美三级电影在线观看| 亚洲mv大片欧洲mv大片精品| 国产99精品在线观看| 欧美一区二区视频网站| 亚洲国产精品一区二区久久| 欧美日韩午夜在线视频| 蜜芽一区二区三区| 精品欧美乱码久久久久久1区2区| 麻豆精品在线视频| 国产精品国产三级国产| av不卡在线播放| 蜜臀va亚洲va欧美va天堂| 亚洲男人天堂av网| 国产日韩欧美在线一区| 日韩一区二区电影在线| 91婷婷韩国欧美一区二区| 国产精品 日产精品 欧美精品| 亚洲午夜成aⅴ人片| 亚洲视频每日更新| 日韩欧美国产三级| 色欲综合视频天天天| 日韩欧美一级精品久久| 国产一本一道久久香蕉|