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

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

?? sfun_han.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_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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩视频在线你懂得| 4438成人网| 老司机午夜精品| 日韩一区在线免费观看| 欧美一区二区三区四区久久 | 粉嫩13p一区二区三区| 亚洲无线码一区二区三区| 欧美激情在线免费观看| 日韩欧美国产综合| 色诱亚洲精品久久久久久| 国产资源在线一区| 日本欧美一区二区三区乱码| 亚洲一区二区三区四区在线免费观看| 久久色中文字幕| 欧美一区二区三区爱爱| 欧美四级电影网| 老司机精品视频导航| 国产日韩欧美麻豆| 精品毛片乱码1区2区3区| 欧美三级视频在线| 在线区一区二视频| 成人欧美一区二区三区白人| 久久亚洲一区二区三区四区| 色先锋资源久久综合| 丰满少妇久久久久久久| 国产麻豆精品theporn| 看电影不卡的网站| 欧美96一区二区免费视频| 三级一区在线视频先锋 | 色网综合在线观看| 成人av资源站| 成a人片国产精品| 成人av网站在线观看免费| 国产一区二区视频在线播放| 韩国欧美国产一区| 精品一区二区三区在线播放| 精品一区二区国语对白| 久久99精品久久久久久动态图| 理论电影国产精品| 久久er精品视频| 国产在线不卡一区| 国产剧情一区二区| 粉嫩av亚洲一区二区图片| 成人av影院在线| 91啪在线观看| 欧美午夜一区二区三区| 欧美绝品在线观看成人午夜影视| 欧美在线播放高清精品| 欧美伦理影视网| 欧美成人video| 国产亚洲一区字幕| 亚洲天堂2014| 亚洲午夜免费电影| 午夜精品影院在线观看| 日本女优在线视频一区二区| 日韩国产精品91| 国产精品亚洲视频| 99久久国产免费看| 精品视频1区2区| 日韩精品一区二| 日本一区二区三区电影| 一区二区三区高清| 日韩影院在线观看| 国产一区二区中文字幕| 99久久综合精品| 7777精品伊人久久久大香线蕉| 精品国产一区二区三区av性色 | 久久精品亚洲麻豆av一区二区 | 欧美肥胖老妇做爰| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美国产国产综合| 亚洲综合久久久| 看片网站欧美日韩| 91麻豆视频网站| 欧美一卡在线观看| 国产精品视频一二三| 亚洲成人在线观看视频| 国产一区二区三区四| 欧美视频完全免费看| 2022国产精品视频| 夜夜操天天操亚洲| 久久国内精品视频| 色综合久久中文字幕综合网| 日韩免费一区二区| 亚洲女性喷水在线观看一区| 激情六月婷婷久久| 91福利国产成人精品照片| 精品奇米国产一区二区三区| 亚洲男帅同性gay1069| 黄色日韩三级电影| 欧美日韩一区二区三区四区| 久久精品一区八戒影视| 日韩国产在线观看| 99精品欧美一区二区三区小说| 欧美一区二区三区喷汁尤物| 亚洲人精品午夜| 国内精品伊人久久久久av一坑| 色综合久久中文字幕| 久久网站最新地址| 午夜精品久久久久久久99水蜜桃 | 一本色道久久综合亚洲91| 精品日韩一区二区三区免费视频| 一区二区三区在线视频免费| 国产一区二区三区在线观看免费视频 | 欧美激情在线看| 日本不卡免费在线视频| 在线看日韩精品电影| 国产精品美女久久久久高潮| 久久国产剧场电影| 欧美日韩一区精品| 亚洲日本在线a| 成人av电影在线| 久久久久久99精品| 视频在线观看一区二区三区| 91视频.com| 中文字幕一区二区三区不卡在线| 国产电影精品久久禁18| 久久综合精品国产一区二区三区 | 国产成人免费在线视频| 日韩三级在线观看| 日韩高清欧美激情| 欧美三级三级三级爽爽爽| 亚洲免费毛片网站| 色综合久久综合网97色综合| 日韩久久一区二区| fc2成人免费人成在线观看播放 | 国产精品卡一卡二| 丰满亚洲少妇av| 国产欧美日韩三级| 国产成人夜色高潮福利影视| 久久夜色精品一区| 国产一区二区不卡在线| 久久精品亚洲麻豆av一区二区 | 91丨国产丨九色丨pron| 国产精品久久久久一区| 国产大陆亚洲精品国产| 中文字幕乱码日本亚洲一区二区 | 555夜色666亚洲国产免| 亚洲国产日韩a在线播放性色| 欧美性一级生活| 亚洲午夜在线观看视频在线| 精品视频一区 二区 三区| 天天av天天翘天天综合网 | av高清不卡在线| 亚洲免费在线视频一区 二区| 色国产精品一区在线观看| 亚洲综合色区另类av| 欧美精品视频www在线观看| 免费高清不卡av| 国产欧美一区二区在线观看| 成人v精品蜜桃久久一区| 亚洲三级在线观看| 欧美日韩精品一区二区三区蜜桃 | 色婷婷综合久久久中文字幕| 亚洲九九爱视频| 欧美视频三区在线播放| 免费高清视频精品| 国产欧美日韩中文久久| 91福利视频在线| 蜜臀久久99精品久久久久宅男| 久久久精品国产免大香伊 | 在线不卡欧美精品一区二区三区| 日本亚洲视频在线| 久久久久久久久免费| 色综合久久久久综合体桃花网| 亚洲成a人片综合在线| 精品久久久久一区| 99精品视频中文字幕| 视频一区欧美日韩| 国产午夜精品一区二区三区视频| 99精品久久免费看蜜臀剧情介绍| 亚洲一区二区视频| 久久一区二区三区四区| 色一情一乱一乱一91av| 日本va欧美va欧美va精品| 中文字幕免费在线观看视频一区| 欧美性感一区二区三区| 久久成人麻豆午夜电影| 亚洲天堂福利av| 日韩精品一区二区三区三区免费| 成人h动漫精品一区二| 日韩国产欧美在线观看| 中文字幕在线观看一区| 51久久夜色精品国产麻豆| av在线免费不卡| 麻豆精品久久久| 亚洲一区二区精品久久av| 久久影院视频免费| 欧美日韩国产高清一区二区三区 | 亚洲成人免费av| 国产色91在线| 在线不卡免费欧美| 色综合久久久久网| 国产乱国产乱300精品| 一级日本不卡的影视| 国产午夜精品久久久久久免费视 | 欧美不卡一区二区| 欧美中文字幕一区| 成人看片黄a免费看在线| 久久成人久久鬼色|