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

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

?? dd1c.c

?? 卡爾曼濾波
?? C
字號(hào):
/***********************************************************************
 * MEX TEMPLATE FOR DD1-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_dd1.c kalmlblx.o    % PC-Linux gcc compiler
 *   >> mex my_dd1.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 dd1filt(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

/*********************************************************************************
 *                                                                               *
 *    dd1c gateway routine                                                       *
 *    ------------------------                                                   *
 *                                                                               *
 *    This is a C-version of the Matlab function 'dd1'.                          *
 *    Type 'help dd1' 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 hSvt */
  a = 2;
  if (mxGetN(prhs[a])!=mxGetM(prhs[a]))
     mexErrMsgTxt("Dimension mismatch in Sv");
  else
     hSvt = mat2sm(prhs[a]);

  /* Convert hSwt */
  a = 3;
  if (mxGetN(prhs[a])!=mxGetM(prhs[a]))
     mexErrMsgTxt("Dimension mismatch in Sw");
  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         <<<<<<<<<<<<<<<<<<<<<
   */
  dd1filt(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);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费视频网址| 一区二区三区中文字幕| 中文字幕一区二区三区色视频| 日韩美女视频一区二区| 亚洲午夜私人影院| 麻豆精品视频在线观看视频| 国产sm精品调教视频网站| 在线视频一区二区三| 日韩精品一区二| 亚洲柠檬福利资源导航| 美女一区二区视频| 97se亚洲国产综合自在线| 欧美久久久久久久久久 | 亚洲与欧洲av电影| 九色综合狠狠综合久久| 色综合中文综合网| 经典一区二区三区| 欧美性大战xxxxx久久久| 欧美亚洲综合久久| 精品欧美一区二区久久| 国产精品成人一区二区艾草| 图片区日韩欧美亚洲| 高清国产一区二区| 91精品国产一区二区| 中文字幕不卡在线观看| 日本 国产 欧美色综合| 99久久99久久综合| 欧美mv和日韩mv的网站| 一区二区久久久| 国产**成人网毛片九色 | 午夜视频在线观看一区二区三区| 国产一区二区毛片| 在线不卡免费av| 亚洲色图视频网| 国产精品一区二区无线| 欧美精品自拍偷拍动漫精品| 日韩美女精品在线| 欧美日韩一区三区四区| 国产欧美一区二区精品婷婷| 免费在线视频一区| 欧美日韩在线三区| 亚洲桃色在线一区| 成人午夜在线播放| 国产亚洲精品bt天堂精选| 日本不卡的三区四区五区| 91黄色免费看| 亚洲视频狠狠干| 顶级嫩模精品视频在线看| 日韩精品一区二区三区四区| 日韩和欧美的一区| 精品视频1区2区3区| 亚洲欧美视频在线观看视频| 成人午夜在线播放| 国产欧美一区二区精品仙草咪| 九九在线精品视频| 日韩三级在线免费观看| 亚洲高清不卡在线| 精品视频1区2区3区| 亚洲人成网站精品片在线观看| 成人爽a毛片一区二区免费| 久久久亚洲午夜电影| 久久99九九99精品| 日韩欧美一级在线播放| 美腿丝袜在线亚洲一区| 欧美男同性恋视频网站| 亚洲图片欧美视频| 欧美午夜免费电影| 亚洲午夜免费电影| 欧美午夜一区二区三区| 亚洲国产视频直播| 5858s免费视频成人| 亚洲大片一区二区三区| 欧美色图一区二区三区| 亚洲综合丁香婷婷六月香| 色综合久久综合| 一区二区高清在线| 欧美性色欧美a在线播放| 亚洲午夜国产一区99re久久| 欧美日韩一区在线观看| 日韩福利视频导航| 日韩免费成人网| 国产精品综合av一区二区国产馆| 久久综合色之久久综合| 风间由美一区二区三区在线观看 | 国产一区在线精品| 国产日韩一级二级三级| 成人丝袜视频网| 亚洲免费电影在线| 久久久久亚洲蜜桃| 粉嫩一区二区三区在线看| 日本一区二区在线不卡| 99国产精品国产精品毛片| 亚洲免费在线观看视频| 欧美三级蜜桃2在线观看| 日日骚欧美日韩| www国产精品av| 成人av在线一区二区三区| 亚洲免费高清视频在线| 在线播放日韩导航| 寂寞少妇一区二区三区| 国产欧美日韩不卡免费| 91老师片黄在线观看| 亚洲国产精品久久久久婷婷884| 日韩视频在线你懂得| 国产成人av电影在线| 亚洲精品五月天| 日韩一区二区三区观看| 丁香天五香天堂综合| 亚洲一区二区影院| 欧美电影免费观看高清完整版在线观看| 国产一二精品视频| 亚洲精品伦理在线| 欧美成人一区二区| 99久久精品国产观看| 日本亚洲最大的色成网站www| 国产日本亚洲高清| 欧美日韩久久久| 高清视频一区二区| 亚洲成av人在线观看| 国产欧美日韩不卡| 在线成人av网站| 成人精品免费看| 天天av天天翘天天综合网| 国产肉丝袜一区二区| 欧美男人的天堂一二区| 国产在线一区观看| 亚洲一区二区三区四区五区中文| www欧美成人18+| 欧美午夜不卡视频| 成人深夜在线观看| 欧美bbbbb| 亚洲精品国产视频| 久久夜色精品国产欧美乱极品| 欧美在线综合视频| 国产盗摄女厕一区二区三区| 午夜精品一区二区三区三上悠亚| 中文一区在线播放| 51精品国自产在线| 色婷婷国产精品综合在线观看| 国产麻豆91精品| 水野朝阳av一区二区三区| ...av二区三区久久精品| 欧美大片一区二区| 欧美日韩国产小视频| 99久久综合99久久综合网站| 久久97超碰色| 亚洲777理论| 一区二区三区欧美在线观看| 欧美激情一区三区| 精品久久人人做人人爽| 欧美日韩国产小视频在线观看| 99re亚洲国产精品| 国产成人精品1024| 极品少妇一区二区| 奇米精品一区二区三区在线观看 | 欧美色综合网站| 成人国产精品免费观看| 日本不卡视频一二三区| 亚洲亚洲精品在线观看| 亚洲品质自拍视频网站| 国产精品色婷婷| 久久久精品中文字幕麻豆发布| 日韩免费性生活视频播放| 欧美精品久久99| 欧美日本乱大交xxxxx| 国产午夜亚洲精品理论片色戒| 91精品国产综合久久香蕉麻豆| 在线观看免费视频综合| 91视频免费观看| 波多野结衣中文一区| 成人在线一区二区三区| 国产精品91xxx| 国产成人免费在线视频| 国产中文字幕一区| 激情综合网av| 国产一区二区三区视频在线播放| 老司机免费视频一区二区| 毛片一区二区三区| 精品一区二区三区久久| 久久精品国产亚洲一区二区三区| 青青草97国产精品免费观看| 美国毛片一区二区三区| 美女国产一区二区三区| 蜜臀av一区二区| 黄色日韩三级电影| 国产精品一区久久久久| 国产成人一区二区精品非洲| 国产成人av在线影院| 久久99热这里只有精品| 狠狠色狠狠色综合系列| 国产乱国产乱300精品| 国产麻豆91精品| 成人免费电影视频| av不卡免费在线观看| 一本一道波多野结衣一区二区| 在线亚洲免费视频| 欧美日韩免费一区二区三区视频| 欧美日韩亚洲综合一区二区三区| 欧美精品aⅴ在线视频| 欧美mv日韩mv亚洲|