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

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

?? dd2c.c

?? Kalman filter that can be simulated under windws
?? C
字號:
/***********************************************************************
 * MEX TEMPLATE FOR DD2-FILTER
 * ---------------------------
 * Make a copy of this file, give it a new name and do the following:
 * o Write a function (in C) that contains the state equation.
 * o In the same file write a function containing the observation equation.
 * o Specify the name of the file in the "define variable" KALMFILE.
 *   Remember to use " " around the name.
 * o Assign XFUNC to the name of the state equation function and assign
 *   YFUNC to the name of the observation equation function (no " "!).
 * o Compile with the appropriate Matlab command:
 *   >> mex my_dd2.c kalmlblx.o    % PC-Linux gcc compiler
 *   >> mex my_dd2.c kalmlblcc.obj % Matlab lcc compiler
 *
 ***********************************************************************/
#define KALMFILE "demosys.c"
#define XFUNC demotu
#define YFUNC demoobs
/***********************************************************************/


/*
 *     INCLUDE HEADERS
 */
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "mex.h"


/*
 *     DEFINES ASSOCIATED WITH MATRIX MANIPULATION 
 */
#define ON 1
#define OFF 0
#define RUNCHK ON             /* Run-time checks switched on/off. */

/* "Inline" functions.                                                 */
/* ( No run-time checks is performed, when inline functions are used ) */
#define nof_rows(ptm)                      (ptm->row)                           /* See getrows */
#define nof_cols(ptm)                      (ptm->col)                           /* See getcols */
#define vec_len(ptv)                       (ptv->row+ptv->col-1)                /* See length  */
#define get_val(ptm,row_pos,col_pos)       (ptm->mat[row_pos][col_pos])         /* See mget    */
#define put_val(ptm,row_pos,col_pos,value) ((ptm->mat[row_pos][col_pos])=value) /* See mput    */
#define rvget(ptv,element)                 (ptv->mat[0][element])               /* See vget    */
#define cvget(ptv,element)                 (ptv->mat[element][0])               /* See vget    */
#define rvput(ptv,element,value)           ((ptv->mat[0][element])=value)       /* See vput    */
#define cvput(ptv,element,value)           ((ptv->mat[element][0])=value)       /* See vput    */


/* Declaration of the "abstract" data-type. */

typedef struct {               /* Matrix structure for C library  */
	int row;               /* These are meant to be "private" */
	int col;               /* and should only be accessed via */
	double **mat;          /* the "member functions" below.   */
} matrix;



typedef struct {          /* Matrix structure for C library  */
	int row;               /* These are meant to be "private" */
	int col;               /* and should only be accessed via */
	int **mat;             /* the "member functions" below.   */
} intmatrix;


typedef struct {          /* Optional initializations        */
	matrix *init;          /* Initialization parameters       */
	int Aflag;             /* Linear state update (deterministic term)    */
	int Fflag;             /* Linear state update (stochastic term)       */
	int Cflag;             /* Linear output equation (deterministic term) */
	int Gflag;             /* Linear output equation (stochastic term)    */
	matrix *A;             /* State transition matrix         */
	matrix *C;             /* Output sensitivity matrix       */
	matrix *F;             /* Process noise coupling matrix   */
	matrix *G;             /* Observ. noise coupling matrix   */
} optpar;

/* Declaration of the "member functions".   */
matrix *mmake( int, int );
void mfree( matrix* );
void mprint( matrix* );
void merror( char* );
int getrows( matrix* );
int getcols( matrix* );
void minit( matrix* );
void madd( matrix*, matrix*, matrix* );
void mset( matrix*, matrix*);
intmatrix *intmmake( int, int );
void intmfree( intmatrix* );


/*
 *     PROTOTYPE DECLARATION
 */
matrix* mat2sm(const mxArray*);
void sm2mat(mxArray*, matrix*);
intmatrix* mat2intsm(const mxArray*);
void intsm2mat(mxArray*, intmatrix*);
int dd2filt(int (*xfct)(matrix*, matrix*, matrix*, matrix*, int),
            int (*yfct)(matrix*, matrix*, matrix*, int),
	    matrix*, matrix*, matrix*, matrix*, matrix*, matrix*, 
            matrix*,matrix*, intmatrix*, optpar*);

#include KALMFILE

/*********************************************************************************
 *                                                                               *
 *    dd2c gateway routine                                                       *
 *    --------------------                                                       *
 *                                                                               *
 *    This is a C-version of the Matlab function 'dd2'.                          *
 *    Type 'help dd2' from Matlab for information on                             *
 *    how to call the function.                                                  *
 *                                                                               *
 *                                                                               *
 *    Written by: Magnus Norgaard                                                *
 *    LastEditDate: Nov. 9, 2001                                                 *
 *                                                                               *
 *********************************************************************************/


/*********************************************************************************
 *                                                                               *
 *                           G A T E W A Y   R O U T I N E                       *
 *                                                                               *
 *********************************************************************************/
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /*
   >>>>>>>>>>>>>>>>>>           VARIABLE DECLARATIONS          <<<<<<<<<<<<<<<<<<<
   */
   matrix *xhat_data, *Smat, *xbar, *Sxbart, *hSvt, *hSwt, *u, *y;
   intmatrix *tidx;
   optpar *opt;
   int a, samples, nx, ny, *ptmi;
   mxArray  *Matmatrix;

  /*
   >>>>>>>>>>>>>>>>      CHECK FOR PROPER NUMBER OF ARGUMENTS      <<<<<<<<<<<<<<<
   */
   if (nrhs<7 || nrhs>8)
      mexErrMsgTxt("Wrong number of input arguments");
   else if (nlhs > 2)
       mexErrMsgTxt("Too many output arguments");
 
  /*
   >>>>>>>>>>>>>>>>>     CONVERT INPUT ARGUMENTS TO SM FORMAT     <<<<<<<<<<<<<<<<
   */
  /* Convert Sxbart */
  a = 1;
  nx = mxGetN(prhs[a]);
  if (nx==0 || nx!=mxGetM(prhs[a]))
     mexErrMsgTxt("Dimension mismatch in P0");
  else
     Sxbart = mat2sm(prhs[a]);
     
  /* Convert xbar and initialize if necessary */
  a = 0;
  if (mxGetN(prhs[a])==0 || mxGetM(prhs[a])==0){
     xbar = mmake(nx,1);
     minit(xbar);
  }
  else
     xbar = mat2sm(prhs[a]);
    
  /* Convert hSwt */
  a = 2;
  if (mxGetN(prhs[a])!=mxGetM(prhs[a]))
     mexErrMsgTxt("Dimension mismatch in Q");
  else
     hSvt = mat2sm(prhs[a]);

  /* Convert hSwt */
  a = 3;
  if (mxGetN(prhs[a])!=mxGetM(prhs[a]))
     mexErrMsgTxt("Dimension mismatch in R");
  else
     hSwt = mat2sm(prhs[a]);

  /* Convert u */
  a = 6;
  if (mxGetN(prhs[a])==0 || mxGetM(prhs[a])==0){
     mexErrMsgTxt("No time stamps. 'timeidx' is empty");
  }
  else{
     tidx = mat2intsm(prhs[a]);
  }
  
  /* Convert u */
  a = 4;
  if (mxGetN(prhs[a])==0 || mxGetM(prhs[a])==0){
     samples = cvget(tidx,nof_rows(tidx)-1);
     u = mmake(1,1);
     u->row = 0;
  }
  else{
     u = mat2sm(prhs[a]);
     samples = mxGetM(prhs[a]);
  }

  /* Convert y */
  a  = 5;
  ny = mxGetN(prhs[a]);
  if (ny==0 || mxGetM(prhs[a])==0)
     mexErrMsgTxt("Observation matrix, y, is empty");
  else if (mxGetM(prhs[a])!= mxGetM(prhs[a+1]))
     mexErrMsgTxt("'y' and 'timeidx' must have the same number of rows");
  else
     y = mat2sm(prhs[a]);

  /* Convert optpar */
  opt = (optpar*) malloc(sizeof(optpar)); /* Allocate mem for par structure */
  opt->Aflag = 0; opt->Fflag = 0; opt->Cflag = 0; opt->Gflag = 0;
  if (nrhs==8){
    a  = 7;
    Matmatrix = mxGetField(prhs[a], 0, "init");
    if(Matmatrix==NULL){
       opt->init = mmake(1,1);
       minit(opt->init);
    }
    else
       opt->init = mat2sm(Matmatrix);

	  /* Explore if linear terms are present */
	  /* Relationship between new and past states linear */
	  Matmatrix = mxGetField(prhs[a], 0, "A");
     if(Matmatrix!=NULL){
		  if(mxGetM(Matmatrix)!=nx || mxGetN(Matmatrix)!=nx)
			  mexErrMsgTxt("optpar.A has the wrong dimension");
        opt->A     = mat2sm(Matmatrix);
        opt->Aflag = 1;
     }

     /* Relationship between states and process noise is linear */
	  Matmatrix = mxGetField(prhs[a], 0, "F");
     if(Matmatrix!=NULL){
		  if(mxGetM(Matmatrix)!=nx || mxGetN(Matmatrix)!=getrows(hSvt))
			  mexErrMsgTxt("optpar.F has the wrong dimension");
        opt->F     = mat2sm(Matmatrix);
        opt->Fflag = 1;
     }
	  
     Matmatrix = mxGetField(prhs[a], 0, "C");
     if(Matmatrix!=NULL){
		  if(mxGetM(Matmatrix)!=ny || mxGetN(Matmatrix)!=nx)
			  mexErrMsgTxt("optpar.C has the wrong dimension");
        opt->C     = mat2sm(Matmatrix);
        opt->Cflag = 1;
     }

     Matmatrix = mxGetField(prhs[a], 0, "G");
     if(Matmatrix!=NULL){
		  if(mxGetM(Matmatrix)!=ny || mxGetN(Matmatrix)!=getrows(hSwt))
			  mexErrMsgTxt("optpar.G has the wrong dimension");
        opt->G     = mat2sm(Matmatrix);
        opt->Gflag = 1;
     }
  }
  else{
     opt->init = mmake(1,1);
     minit(opt->init);
  }


  /* Allocate memory for output matrices */
  xhat_data = mmake(samples+1,nx);
  Smat      = mmake(samples+1,floor(0.5*(nx*(nx+1))+0.5));


  /*
   >>>>>>>>>>>>>>>>>>>>>>         CALL THE C-ROUTINE         <<<<<<<<<<<<<<<<<<<<<
   */
  dd2filt(XFUNC,YFUNC, xhat_data, Smat, xbar, Sxbart, hSvt, hSwt, u, y, tidx, opt);


  /*
   >>>>>>>>>>>>>>>>>>>         CREATE OUTPUT MATICES            <<<<<<<<<<<<<<<<<<
   */     
  if(nlhs>0){
     plhs[0] = mxCreateDoubleMatrix(getrows(xhat_data),nx,mxREAL);
     sm2mat(plhs[0],xhat_data);
  }
  if(nlhs>1){
     plhs[1] = mxCreateDoubleMatrix(getrows(Smat),getcols(Smat),mxREAL);
     sm2mat(plhs[1],Smat);
  }


  /*
   >>>>>>>>>>>>>>>>>>>>        FREE ARGUMENT MATRICES        <<<<<<<<<<<<<<<<<<<<<
   */
  intmfree(tidx); mfree(xbar); mfree(Sxbart); mfree(hSwt); mfree(hSvt); 
  mfree(u); mfree(y); mfree(opt->init);
  if(opt->Aflag) mfree(opt->A);
  if(opt->Fflag) mfree(opt->F);
  if(opt->Cflag) mfree(opt->C);
  if(opt->Gflag) mfree(opt->G);
  free(opt);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品国产毛片| 久久国产麻豆精品| 91久久精品一区二区三| 亚洲久草在线视频| 国产成人午夜视频| 椎名由奈av一区二区三区| 色久综合一二码| 午夜精品久久久久久久| 日韩女同互慰一区二区| 国产精品77777| 亚洲欧美日韩一区二区| 制服丝袜亚洲网站| 国产精品 欧美精品| 亚洲免费观看在线视频| 91精选在线观看| 国产成人av影院| 亚洲激情网站免费观看| 日韩视频一区二区三区在线播放| 国产一区二区不卡| 一区二区视频免费在线观看| 6080国产精品一区二区| 国产麻豆视频一区二区| 一区二区三区精品久久久| 91精品国产综合久久国产大片| 久久99精品久久只有精品| 自拍偷拍亚洲激情| 精品福利在线导航| 91浏览器入口在线观看| 美女视频黄频大全不卡视频在线播放| 欧美经典一区二区| 欧美日韩视频在线观看一区二区三区| 久久99国产精品久久99果冻传媒| 国产精品久久久久久福利一牛影视| 欧美三级乱人伦电影| 国产精品 欧美精品| 天堂va蜜桃一区二区三区| 久久久99精品久久| 欧美日韩电影在线播放| av日韩在线网站| 久久精品国产网站| 亚洲国产精品自拍| 日韩美女啊v在线免费观看| 欧美成人三级在线| 欧美视频中文字幕| 99久久精品免费精品国产| 狠狠色狠狠色综合日日91app| 夜夜精品视频一区二区| 中文字幕第一区第二区| 精品欧美一区二区三区精品久久| 在线这里只有精品| 成人h动漫精品一区二| 精品一区二区三区免费播放| 亚洲国产欧美在线人成| 国产精品福利一区二区三区| 久久午夜羞羞影院免费观看| 69堂国产成人免费视频| 欧美最猛性xxxxx直播| www.亚洲人| 国产很黄免费观看久久| 国产综合成人久久大片91| 日本午夜一区二区| 亚洲国产视频一区二区| 亚洲一区二区三区四区在线观看 | 欧美在线综合视频| 白白色亚洲国产精品| 成人小视频在线观看| 国产综合色产在线精品| 精品制服美女丁香| 寂寞少妇一区二区三区| 九色综合国产一区二区三区| 日韩制服丝袜av| 日韩一区欧美二区| 日本不卡视频一二三区| 日韩和的一区二区| 男人的天堂久久精品| 日韩av一区二区三区| 日本不卡的三区四区五区| 天天影视涩香欲综合网| 日韩激情一区二区| 秋霞成人午夜伦在线观看| 日韩精品三区四区| 美国一区二区三区在线播放| 蜜桃视频第一区免费观看| 日韩av网站免费在线| 久久国产乱子精品免费女| 国内欧美视频一区二区| 国产成人免费视频 | 色综合天天综合网天天狠天天| 国产成a人无v码亚洲福利| 成人免费高清视频在线观看| 成人免费视频一区| 色综合久久久久综合体| 欧美日韩免费一区二区三区| 51久久夜色精品国产麻豆| 欧美一级高清片| 国产亚洲精品久| 亚洲精品中文在线| 亚洲1区2区3区视频| 蜜桃久久久久久| 成人深夜在线观看| 91国偷自产一区二区开放时间| 欧美日韩一卡二卡| 日韩亚洲欧美一区二区三区| 2020国产精品自拍| 1区2区3区精品视频| 亚洲国产精品人人做人人爽| 老鸭窝一区二区久久精品| 成人美女视频在线观看18| 日本韩国精品一区二区在线观看| 欧美美女bb生活片| 国产午夜精品一区二区三区四区| 亚洲日本在线a| 麻豆精品一二三| 99视频在线观看一区三区| 欧美日韩成人一区二区| 国产拍揄自揄精品视频麻豆| 一区二区三区欧美激情| 久久 天天综合| 色婷婷国产精品综合在线观看| 欧美一区二区三区视频免费| 国产精品久久看| 美女精品一区二区| 91小视频在线观看| 精品少妇一区二区| 亚洲国产你懂的| eeuss鲁片一区二区三区| 欧美一区二区黄| 亚洲精品乱码久久久久久久久 | 自拍偷拍欧美激情| 国产一区二区视频在线| 欧美亚洲日本一区| 国产精品美日韩| 精品亚洲免费视频| 欧美日韩五月天| 自拍视频在线观看一区二区| 国产精品一线二线三线| 91精品国产综合久久久蜜臀粉嫩| 国产精品久久福利| 国产一区二区三区四区五区入口| 欧美日韩午夜在线视频| 亚洲色图视频网站| 成人久久18免费网站麻豆| 欧美电影免费观看高清完整版在| 一区二区三区欧美日| av在线播放成人| 国产精品天天看| 狠狠色丁香久久婷婷综合丁香| 欧美久久久久久蜜桃| 亚洲一区二区精品3399| 91亚洲国产成人精品一区二三 | 亚洲免费成人av| 成人深夜在线观看| 欧美国产日韩a欧美在线观看 | 国产精品久久久久影院亚瑟| 国产一级精品在线| 久久久亚洲欧洲日产国码αv| 日本免费在线视频不卡一不卡二| 欧美日韩一区二区三区视频| 夜夜精品视频一区二区 | 亚洲成av人影院在线观看网| 色综合久久综合网97色综合| 亚洲欧洲无码一区二区三区| 国产成人欧美日韩在线电影| 亚洲精品一区在线观看| 精品一区二区三区免费毛片爱| 91麻豆精品国产91| 蜜臀av性久久久久av蜜臀妖精| 欧美精品在线视频| 奇米色777欧美一区二区| 欧美一区二区免费| 极品美女销魂一区二区三区免费| 精品久久五月天| 国产经典欧美精品| 中文字幕亚洲一区二区av在线| 92国产精品观看| 一区二区三区四区激情| 欧美日韩国产系列| 日韩国产欧美在线播放| 日韩欧美色电影| 国产精品一区不卡| 中文字幕日韩一区二区| 色偷偷久久一区二区三区| 亚洲一区二区三区四区中文字幕| 欧美日韩你懂得| 极品少妇xxxx偷拍精品少妇| 国产欧美日韩另类一区| 91免费观看在线| 日韩中文字幕麻豆| 久久影音资源网| thepron国产精品| 亚洲第一av色| 精品对白一区国产伦| 国产一区二区91| 亚洲欧美一区二区三区极速播放| 欧美日韩高清一区二区不卡| 久久99精品国产| 亚洲人成小说网站色在线 | 久久亚洲二区三区| 91在线云播放| 麻豆91免费看|