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

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

?? regshift.c

?? 國外版本《通信系統原理》matlab源代碼。
?? C
字號:
/* $Revision: 1.21 $ */
/*
 * REGSHIFT   A Simulink triggered register_buff shift
 *
 *           Syntax:  [sys, x0] = regshift(t,x,u,flag,outDelay,tirgThreshold)
 *  This function has two inputs and a number of outputs. The first input is
 *  the signal to be stored and output. The second signal is the clock pulse.
 *  The function refreshes its register_buff and outputs only at the rising 
 *  edge of the clock pulse. The function assigns a maximum delay number in 
 *  outDelay as its register numebr. When the function finishes refreshing all
 *  registers, it is called a cycle.
 *
 *  outDelay is a scalar or vector which contains integers of desired delay
 *           steps from the input. The size of the vector determines the
 *           size of the output.
 *  trigThreshold is the threshold in detecting the rising edge of the clock
 *          pulse.
 *  The size of the output of this function is the size of outDelay pulse one.
 *  Each output element outputs the delay step as indicated in the corrsponding
 *  value in outDelay. The last output is zero and is one only at the time when
 *  the register_buff and output are triggered in a complete cycle (a cycle of
 *  complete a refresh cycle). The pulse keeps the same length as the input
 *  trigger pulse.
 *
 * Wes Wang  August 22, 1994
 * Copyright 1996-2001 The MathWorks, Inc.
 */

#define S_FUNCTION_NAME regshift

#ifdef MATLAB_MEX_FILE
#include "mex.h"      /* needed for declaration of mexErrMsgTxt */
#endif

/*
 * need to include simstruc.h for the definition of the SimStruct and
 * its associated macro definitions.
 */

#include "simstruc.h"
#include "tmwtypes.h"

/* For RTW */
#if defined(RT) || defined(NRT)  
#undef  mexPrintf
#define mexPrintf printf
#endif

/*
 * Defines for easy access of the input parameters
 */

#define NUM_ARGS   2
#define REGISTER_DELAY ssGetArg(S,0)
#define TRIG_THRESHOLD     ssGetArg(S,1)

/*
 * mdlInitializeSizes - called to initialize the sizes array stored in
 *                      the SimStruct.  The sizes array defines the
 *                      characteristics (number of inputs, outputs,
 *                      states, etc.) of the S-Function.
 */

static void mdlInitializeSizes(SimStruct *S)
{
    /*
     * Set-up size information.
     */ 
    
    if (ssGetNumArgs(S) == NUM_ARGS) {
      int_T i, regDelay, numOutput, maxDelay;
      numOutput = mxGetN(REGISTER_DELAY) * mxGetM(REGISTER_DELAY);
      if (numOutput < 1) {
#ifdef MATLAB_MEX_FILE
        char_T err_msg[256];
        sprintf(err_msg, "Output buffer is empty");
        mexErrMsgTxt(err_msg);
#endif  
      }
       
      maxDelay = 1;
      for(i=0; i<numOutput; i++) {
        regDelay = (int_T)(mxGetPr(REGISTER_DELAY)[i]);
        maxDelay = (maxDelay > regDelay) ? maxDelay : regDelay;
      }
      ssSetNumContStates(    S, 0);
      ssSetNumDiscStates(    S, 0);
      ssSetNumInputs(        S, 2);
      ssSetNumOutputs(       S, 1 + numOutput);
      ssSetDirectFeedThrough(S, 1);
      ssSetNumInputArgs(     S, NUM_ARGS);
      ssSetNumSampleTimes(   S, 1);
      ssSetNumRWork(         S, maxDelay+1);
      ssSetNumIWork(         S, 2);
      ssSetNumPWork(         S, 0);
    } else {
#ifdef MATLAB_MEX_FILE
      char_T err_msg[256];
      sprintf(err_msg, "Wrong number of input arguments passed to S-function MEX-file.\n"
         "%d input arguments were passed in when expecting %d input arguments.\n", ssGetNumArgs(S) + 4, NUM_ARGS + 4);
      mexErrMsgTxt(err_msg);
#endif
   }
}

/*
 * mdlInitializeSampleTimes - initializes the array of sample times stored in
 *                            the SimStruct associated with this S-Function.
 */

static void mdlInitializeSampleTimes(SimStruct *S)
{
    /*
     * Note, blocks that are continuous in nature should have a single
     * sample time of 0.0.
     */

    ssSetSampleTimeEvent(S, 0, INHERITED_SAMPLE_TIME);
    ssSetOffsetTimeEvent(S, 0, FIXED_IN_MINOR_STEP_OFFSET);
}

/*
 * mdlInitializeConditions - initializes the states for the S-Function
 */

static void mdlInitializeConditions(real_T *x0, SimStruct *S)
{
    real_T *register_buff       = ssGetRWork(S);

    int_T    *regIndex       = ssGetIWork(S);
    int_T    *lastTrig       = ssGetIWork(S) + 1;    

    int_T     numOutput      = ssGetNumOutputs(S);
    int_T     maxDelay       = ssGetNumRWork(S) - 1;
    
    real_T *lastTime       = ssGetRWork(S) + maxDelay;
    
    int_T i;
    
    /* 
     * Initialize the register_buff to all zeros.
     */
    
    for (i = 0; i < maxDelay; i++)
     *register_buff++ = 0.0;

    /*
     * Initialize the current buffer position and buffer start
     */
    
    *regIndex       = 0;
    *lastTrig       = 0;
    *lastTime       = -1.0;
}

/*
 * mdlOutputs - computes the outputs of the S-Function
 */

static void mdlOutputs(real_T *y, const real_T *x, const real_T *u, SimStruct *S, int_T tid)
{
    real_T *register_buff        = ssGetRWork(S);
    real_T  trigThreshold   = mxGetPr(TRIG_THRESHOLD)[0];
    int_T    *regIndex        = ssGetIWork(S);
    int_T    *lastTrig        = ssGetIWork(S) + 1;    
    int_T     numOutput       = ssGetNumOutputs(S) - 1;
    int_T     maxDelay        = ssGetNumRWork(S) - 1;
    real_T *lastTime        = ssGetRWork(S) + maxDelay;
    
    int_T     i, outnum;
    real_T  currentTime     = ssGetT(S);

    /*
     * acquire the buffer data
     */

    if ((u[1] >= trigThreshold) & (*lastTrig == 0)) {

      for (i = 0; i < numOutput; i++) {
        outnum = (int_T)(mxGetPr(REGISTER_DELAY)[i]);

        if (outnum == 0)
          y[i] = *u;
        else
          y[i] = register_buff[(maxDelay + *regIndex - outnum) % maxDelay];
      }
      if (*regIndex == 0)
        y[numOutput] = 1.0;
      else
        y[numOutput] = 0.0;
        
      register_buff[(*regIndex)++] = *u;
      *regIndex %= maxDelay;
      *lastTrig = 1;
      *lastTime = currentTime;
     } else {
      if (currentTime <= 0.0) {
        for (i = 0; i < numOutput; i++)
          y[i] = 0.0;
      } else if ((currentTime - *lastTime) / currentTime < 0.00000001) {
        /* keep the most recent change in the buffer */
        /* this is backup the case when there are tow calls at the same time.
         * the two values of the same time are different.
         * This is assume the time variable is always increasing
         */

        if (u[1] >= trigThreshold) {
          int_T backIndex;
          backIndex = *regIndex - 1;
          if (backIndex < 0)
            backIndex = maxDelay - 1;                
          for (i = 0; i < numOutput; i++) {
            outnum = (int_T)(mxGetPr(REGISTER_DELAY)[i]);
            if (outnum == 0)
              y[i] = *u;
          }
          if (backIndex == 0)
            y[numOutput] = 1.0;
          else
            y[numOutput] = 0.0;         
          register_buff[backIndex] = *u;
        }
      }
      if (*lastTrig == 1) {
        if (u[1] < trigThreshold) {
          *lastTrig = 0;
          y[numOutput] = 0.0;
        }
      }
    }
}

/*
 * mdlUpdate - computes the discrete states of the S-Function
 */

static void mdlUpdate(real_T *x, const real_T *u, SimStruct *S, int_T tid)
{
}

/*
 * mdlDerivatives - computes the derivatives of the S-Function
 */

static void mdlDerivatives(real_T *dx, const real_T *x, const real_T *u, SimStruct *S, int_T tid)
{
}

/*
 * mdlTerminate - called at termination of model execution.
 */

static void mdlTerminate(SimStruct *S)
{
}

#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在线| 久久久精品国产免大香伊| 奇米影视在线99精品| 欧美日韩中文一区| 亚洲狠狠爱一区二区三区| 99re这里只有精品首页| 欧美激情一区二区三区在线| 国产在线视频精品一区| 精品国精品国产尤物美女| 蜜臀av在线播放一区二区三区 | 久久蜜桃一区二区| 久久av中文字幕片| 日韩一区二区精品葵司在线| 免费观看成人av| 日韩欧美在线网站| 久久成人免费日本黄色| 日韩欧美一级在线播放| 欧美aⅴ一区二区三区视频| 91精品国产综合久久久久久| 天堂在线一区二区| 日韩欧美你懂的| 国产一区二区免费视频| 欧美经典一区二区三区| 99久久综合国产精品| 中文字幕一区二区三| 色综合久久久久网| 午夜精品福利久久久| 日韩一区二区三区视频| 美脚の诱脚舐め脚责91| 久久久久久99久久久精品网站| 国产精品一卡二| 136国产福利精品导航| 色88888久久久久久影院野外 | 韩国三级在线一区| 国产区在线观看成人精品 | 粉嫩嫩av羞羞动漫久久久 | 色狠狠色狠狠综合| 五月婷婷久久综合| 337p日本欧洲亚洲大胆色噜噜| 国产精品69毛片高清亚洲| 中文字幕在线不卡一区二区三区| 日本韩国欧美一区| 日本麻豆一区二区三区视频| 久久午夜免费电影| 91久久精品午夜一区二区| 五月婷婷综合网| 国产欧美日本一区二区三区| 色国产精品一区在线观看| 免费成人在线网站| 国产精品拍天天在线| 欧美日产在线观看| 国产成人在线色| 亚洲国产一区二区三区| 久久精品一区八戒影视| 欧美日韩小视频| 成人影视亚洲图片在线| 午夜视频一区二区| 国产精品国产三级国产普通话99| 欧美精品一二三区| 91亚洲永久精品| 国精产品一区一区三区mba视频| 亚洲女性喷水在线观看一区| 精品久久久三级丝袜| 在线精品视频一区二区| 国产iv一区二区三区| 天堂成人国产精品一区| 日韩久久一区二区| 久久久久久亚洲综合影院红桃| 欧美伊人久久久久久久久影院 | 欧美一区二区日韩| 日本久久一区二区三区| 国产99久久久久| 久久99精品久久久久久动态图| 天堂av在线一区| 91豆麻精品91久久久久久| 日韩中文字幕91| 日韩在线a电影| 久久久美女毛片| 99久久伊人精品| 国产乱子伦视频一区二区三区 | 国产中文字幕精品| eeuss鲁一区二区三区| 久久蜜桃av一区二区天堂 | k8久久久一区二区三区 | 国产欧美精品一区| 国产精品嫩草99a| 亚洲三级在线免费观看| 制服丝袜亚洲播放| 欧美精品一区二区久久婷婷| 欧美性大战久久久久久久蜜臀| 精品国产不卡一区二区三区| 国产欧美日本一区视频| 欧美高清你懂得| 日韩一区在线免费观看| 亚洲一区视频在线观看视频| 亚洲精品美腿丝袜| 欧美成人乱码一区二区三区| 首页欧美精品中文字幕| 中文字幕一区二区三区四区不卡| 久久久精品综合| av在线综合网| 日本精品一区二区三区四区的功能| 99国产精品久久久久| 91影院在线免费观看| 一本久道中文字幕精品亚洲嫩| 91久久精品一区二区| 精品视频在线免费看| 欧美日韩亚洲另类| 91麻豆精品久久久久蜜臀| 91精品国产色综合久久不卡蜜臀| 欧美一个色资源| 国产视频亚洲色图| 亚洲欧美怡红院| 亚洲va韩国va欧美va| 美女一区二区视频| 国产**成人网毛片九色| www.99精品| 欧美日韩精品一区二区| 精品黑人一区二区三区久久 | 欧美电影免费观看高清完整版在| 精品粉嫩超白一线天av| 中文天堂在线一区| 亚洲自拍偷拍欧美| 美国十次综合导航| 成人精品免费看| 欧美日韩免费视频| 精品电影一区二区三区| 综合分类小说区另类春色亚洲小说欧美| 亚洲激情五月婷婷| 麻豆91在线观看| 色综合久久久久综合| 日韩欧美美女一区二区三区| 国产精品伦理在线| 日韩在线播放一区二区| 国产成人免费在线观看不卡| 欧美午夜理伦三级在线观看| 久久综合久久久久88| 亚洲人妖av一区二区| 久久国内精品视频| 91久久精品一区二区三区| 欧美xfplay| 悠悠色在线精品| 国产99久久久国产精品免费看| 欧美综合天天夜夜久久| 久久久久久久综合狠狠综合| 亚洲图片有声小说| 懂色av一区二区三区蜜臀 | 久久久精品欧美丰满| 亚洲成av人片观看| 91网上在线视频| 国产日韩欧美高清| 麻豆视频一区二区| 欧美日韩极品在线观看一区| 国产精品国产三级国产aⅴ原创 | 中文字幕日本不卡| 激情五月激情综合网| 欧美日韩在线三区| 亚洲色图制服诱惑 | 亚洲女性喷水在线观看一区| 国产自产视频一区二区三区| 在线91免费看| 亚洲精品伦理在线| eeuss影院一区二区三区| 久久久久久一级片| 激情六月婷婷久久| 亚洲免费观看高清在线观看| 国产在线播放一区三区四| 欧美精品tushy高清| 亚洲精品国产无天堂网2021| 成人免费高清视频在线观看| 久久久精品日韩欧美| 久久99国内精品| 欧美一区二区啪啪| 男女男精品视频| 欧美一级片在线观看| 视频在线观看一区二区三区| 欧美熟乱第一页| 香港成人在线视频| 欧美日韩成人高清| 午夜在线成人av| 91麻豆精品国产91久久久资源速度 | 中文字幕永久在线不卡| eeuss鲁片一区二区三区在线观看| 日本一区二区三区在线不卡| 丁香桃色午夜亚洲一区二区三区| 久久精品综合网|