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

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

?? dd2.m

?? Kalman filter that can be simulated under windws
?? M
字號:
function [xhat_data,Smat]=dd2(kalmfilex,kalmfiley,xbar,P0,q,r,u,y,timeidx,optpar)
% DD2
%   This function performs a DD2-filtering; a state estimation for nonlinear 
%   systems that is based on second-order polynomial approximations of the 
%   nonlinear mappings. The approximations are derived by using a 
%   multidimensional extension of Stirling's interpolation formula. 
%   The model of the nonlinear system must be specified in the form:
%               x(k+1) = f[x(k),u(k),v(k)]
%               y(k)   = g[x(k),w(k)]
%   where 'x' is the state vector, 'u' is a possible input, and 'v' and 'w'
%   are (white) noise sources.
%
% Call
%   [xhat,Smat]=dd2(xfile,yfile,x0,P0,q,r,u,y,timeidx,optpar) 
%
% Input
%   xfile   - File containing the state equations.
%   yfile   - File containing the output equations.
%   x0      - Initial state vector.
%   P0      - Initial covariance matrix (symmetric, nonnegative definite).
%   q,r     - Covariance matrices for v and w, respectively.
%   u       - Input signal. Dimension is [samples x inputs].
%             Use [] if there are no inputs.
%   y       - Output signal. Dimension is [observations x outputs].
%   timeidx - Vector containing sample numbers for the availability of
%             the observations in 'y'. The vector has same length as 'y'.
%   optpar  - Data structure containing optional parameters:
%             .A:     State transition matrix.
%             .C:     Output sensitivity matrix.
%             .F:     Process noise coupling matrix.
%             .G:     Measurement noise coupling matrix.
%             .init : Initial parameters for 'xfile' and 'yfile'
%                     (use an arbitrary format).
%
% Output
%   xhat    - State estimates. Dimension is [samples+1 x states].
%   Smat    - Matrix where each row contains elements of (the upper triangular
%             part of) the Cholesky factor of the covariance matrix. The 
%             dimension is [samples+1 x 0.5*states*(states+1)]. The individual
%             covariance matrices can later be extracted with SMAT2COV.
%
%  The user must write the two m-functions 'xfile' and 'yfile' containing the
%  state update and the output equation. The function containing the state
%  update should take three arguments:
%       function x=my_xfile(x,u,v)
%
%  while the function containing the output equation should take two
%  arguments:
%       function y=my_yfile(x,w)
%
%  In both cases, an initialization of constant parameters can be 
%  made using the parameter 'optpar.init'. This parameter is passed through
%  x if the functions are called with only one parameter.
%
%  Literature:
%     M. Norgaard, N.K. Poulsen, O. Ravn: "New Developments in State
%     Estimation for Nonlinear Systems", Automatica, (36:11), Nov. 2000,
%     pp. 1627-1638.
%
% Written by: Magnus Norgaard
% LastEditDate: Nov. 9, 2001 

% >>>>>>>>>>>>>>>>>>>>>>>>>>> INITIALIZATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<
h2    = 3;                 % Squared divided-difference step size
h     = sqrt(h2);          % Divided difference step-size
scal1 = 0.5/h;             % A convenient scaling factor
scal2 = sqrt((h2-1)/(4*h2*h2)); % Another scaling factor
if isempty(u),             % No inputs
  nu = 0; samples = timeidx(end); uk1 = [];
else
  [samples,nu] = size(u);  % # of samples and inputs
end
nx           = size(P0,1); % # of states
if isempty(xbar),          % Set to x0=0 if not specified 
  xbar = zeros(nx,1);
elseif length(xbar)~=nx,
  error('Dimension mismatch between x0 and P0');
end
ny    = size(y,2);         % # of outputs
nv    = size(q,1);         % # of process noise sources
nw    = size(r,1);         % # of measurement noise sources
[v,d] = eig(P0);           % Square root of initial state covariance
Sxbar = triag(real(v*sqrt(d)));
[v,d] = eig(q);            % Square root of process noise covariance
Sv    = real(v*sqrt(d));
hSv   = h*Sv;
[v,d] = eig(r);
Sw    = real(v*sqrt(d));   % Square root of measurement noise cov.
hSw   = h*Sw;
SxxSxv = zeros(nx,2*(nx+nv));  % Allocate compund matrix consisting of Sxx and Syv 
SyxSyw = zeros(ny,2*(nx+nw));  % Allocate compund matrix consisting of Syx and Syw
xhat_data = zeros(samples+1,nx); % Matrix for storing state estimates
Smat      = zeros(samples+1,0.5*nx*(nx+1)); % Matrix for storing cov. matrices
[I,J]     = find(triu(reshape(1:nx*nx,nx,nx))'); % Index to elem. in Sx
sidx      = sub2ind([nx nx],J,I); 
yidx  = 1;                 % Index into y-vector 
vmean = zeros(nv,1);       % Mean of process noise
wmean = zeros(nw,1);       % Mean of measurement noise

% ----- Initialize state+output equations and linearization -----
if nargin<10,              % No optional parameters passed
   optpar = [];
end
if isfield(optpar,'init')  % Parameters for m-functions
   initpar = optpar.init;
else
   initpar = [];
end

Aflag = 0; Cflag = 0; Fflag = 0; Gflag = 0;
nxnv2 = nx+nv;
nxnw2 = nx+nw;
if isfield(optpar,'A'),    % Deterministic dynamic model is linear
   A = optpar.A;
   if(size(A,1)~=nx | size(A,2)~=nx)
      error('"optpar.A" has the wrong dimension');
   end
   nxnv2 = nxnv2-nx;
   Aflag = 1;
end
if isfield(optpar,'F'),    % Linear process noise model in state equation
   F = optpar.F;
   if(size(F,1)~=nx | size(F,2)~=nv)
      error('"optpar.F" has the wrong dimension');
   end
   SxxSxv(:,nx+1:nx+nv) = F*Sv;
   nxnv2 = nxnv2-nv;
   Fflag = 1;
end
if isfield(optpar,'C'),    % Deterministic observation model linear
   C = optpar.C;
   if(size(C,1)~=ny | size(C,2)~=nx)
      error('"optpar.C" has the wrong dimension');
   end
   nxnw2 = nxnw2-nx;
   Cflag = 1;
end
if isfield(optpar,'G'),    % Linear observation noise model
   G = optpar.G;
   if(size(G,1)~=ny | size(G,2)~=nw)
      error('"optpar.G" has the wrong dimension');
   end
   SyxSyw(:,nx+1:nx+nw) = G*Sw;
   nxnw2 = nxnw2-nw;
   Gflag = 1;
end

% Index to location of Sxv2 and Syw2 in SxxSxv and SyxSyw matrices
if Cflag,
	idx_syw2 = nx+nw;
else
	idx_syw2 = 2*nx+nw;
end
if Aflag,
	idx_sxv2 = nx+nv;
else
	idx_sxv2 = 2*nx+nv;
end
SxxSxv = [SxxSxv zeros(nx,nxnv2)];
SyxSyw = [SyxSyw zeros(ny,nxnw2)];
feval(kalmfilex,initpar);  % State equation
feval(kalmfiley,initpar);  % Output equation
counter = 0;               % Counts the progress of the filtering
waithandle=waitbar(0,'Filtering in progress');  % Initialize waitbar


% >>>>>>>>>>>>>>>>>>>>>>>>>>>> FILTERING <<<<<<<<<<<<<<<<<<<<<<<<<<<
for k=0:samples,

  % --- Measurement update (a posteriori update) ---
  y0 = feval(kalmfiley,xbar,wmean);
  if (k<=timeidx(end) & timeidx(yidx)==k),
    ybar = ((h2-nxnw2)/h2)*y0;
    if Cflag,
       SyxSyw(:,1:nx) = C*Sxbar;
    else
       kx2 = nx+nw;
       for kx=1:nx,
          syp = feval(kalmfiley,xbar+h*Sxbar(:,kx),wmean);
          sym = feval(kalmfiley,xbar-h*Sxbar(:,kx),wmean);
          SyxSyw(:,kx)  = scal1*(syp-sym);
          SyxSyw(:,kx2+kx) = scal2*(syp+sym-2*y0);
          ybar = ybar + (syp+sym)/(2*h2);    
       end
    end
    if ~Gflag,
       for kw=1:nw,
          swp = feval(kalmfiley,xbar,hSw(:,kw));
          swm = feval(kalmfiley,xbar,-hSw(:,kw));
          SyxSyw(:,nx+kw)       = scal1*(swp-swm);
          SyxSyw(:,idx_syw2+kw) = scal2*(swp+swm-2*y0);
          ybar = ybar + (swp+swm)/(2*h2);          
       end
    end
    
    % Cholesky factor of a'posteriori output estimation error covariance
    Sy   = triag(SyxSyw);
    K    = (Sxbar*SyxSyw(:,1:nx)')/(Sy*Sy');
    xhat = xbar + K*(y(yidx,:)'-ybar);  % State estimate

    % Cholesky factor of a'posteriori estimation error covariance
    Sx   = triag([Sxbar-K*SyxSyw(:,1:nx) K*SyxSyw(:,nx+1:end)]);
    yidx = yidx + 1; 

  % No observations available at this sampling instant
  else
    xhat = xbar;                       % Copy a priori state estimate
    Sx   = Sxbar;                      % Copy a priori covariance factor
  end

  % --- Time update (a'priori update) of state and covariance ---
  if k<samples, 
    if nu>0 uk1 = u(k+1,:)'; end
    fxbar = feval(kalmfilex,xhat,uk1,vmean);
    xbar = ((h2-nxnv2)/h2)*fxbar;
    if Aflag,
        SxxSxv(:,1:nx) = A*Sx;
    else
       kx2 = nx+nv;
       for kx=1:nx,
          sxp = feval(kalmfilex,xhat+h*Sx(:,kx),uk1,vmean);
          sxm = feval(kalmfilex,xhat-h*Sx(:,kx),uk1,vmean);
          SxxSxv(:,kx) = scal1*(sxp-sxm);
          SxxSxv(:,kx2+kx) = scal2*(sxp+sxm-2*fxbar);
          xbar            =  xbar + (sxp+sxm)/(2*h2);
       end
    end
    if ~Fflag,
       for kv=1:nv,
          svp = feval(kalmfilex,xhat,uk1,hSv(:,kv));
          svm = feval(kalmfilex,xhat,uk1,-hSv(:,kv));
          SxxSxv(:,nx+kv)       = scal1*(svp-svm);
          SxxSxv(:,idx_sxv2+kv) = scal2*(svp+svm-2*fxbar);
          xbar                  = xbar + (svp+svm)/(2*h2);
       end
    end
    
    % Cholesky factor of a'priori estimation error covariance
    Sxbar = triag(SxxSxv);
  end
  
  % --- Store results ---
  xhat_data(k+1,:) = xhat';
  Smat(k+1,:)      = Sx(sidx)';

  % --- How much longer? ---
  if (counter+0.01<= k/samples),
     counter = k/samples;
     waitbar(k/samples,waithandle);
  end
end
close(waithandle);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品午夜视频| 日本久久电影网| www激情久久| 国产精品888| 亚洲色图丝袜美腿| 欧美性色黄大片| 天堂蜜桃91精品| 精品国产露脸精彩对白| 成人网页在线观看| 一区二区三区欧美久久| 欧美高清激情brazzers| 狠狠色狠狠色综合系列| 亚洲欧洲日产国产综合网| 在线观看www91| 美女任你摸久久| 日韩高清不卡在线| 久久综合成人精品亚洲另类欧美 | 无码av中文一区二区三区桃花岛| 欧美精品v国产精品v日韩精品| 精彩视频一区二区| 中文字幕制服丝袜一区二区三区 | 奇米影视7777精品一区二区| 久久综合狠狠综合久久激情| 色综合久久中文字幕| 日韩高清一级片| 国产精品久久久久影院老司| 欧美亚洲综合色| 国产一区二区三区观看| 亚洲乱码国产乱码精品精可以看| 日韩三级电影网址| 色综合天天综合网天天看片| 蜜臀av一区二区在线免费观看| 国产精品每日更新| 欧美一二三四区在线| 99久久婷婷国产综合精品电影| 五月激情六月综合| 亚洲欧美日韩一区二区| 久久综合av免费| 欧美老女人第四色| 色综合久久88色综合天天免费| 乱中年女人伦av一区二区| 夜夜精品浪潮av一区二区三区| 久久久久久免费网| 日韩一级成人av| 色狠狠一区二区三区香蕉| 国产一区二区三区精品欧美日韩一区二区三区 | 国产麻豆一精品一av一免费 | 另类小说欧美激情| 一区二区三区四区乱视频| 国产日韩一级二级三级| 日韩女优视频免费观看| 欧美视频在线不卡| 色综合久久88色综合天天免费| 国产成人午夜精品影院观看视频| 亚洲国产精品久久一线不卡| 亚洲欧美成人一区二区三区| 久久久91精品国产一区二区精品 | 国产精品麻豆99久久久久久| 精品久久久网站| 91精品国产麻豆国产自产在线| 91免费国产在线| 成人一区二区三区| 国产精品一区免费视频| 韩国一区二区视频| 九色综合狠狠综合久久| 另类小说一区二区三区| 奇米一区二区三区av| 日本视频一区二区三区| 亚洲一区二区精品视频| 亚洲午夜久久久久久久久电影院| 最新热久久免费视频| 中文字幕在线不卡| 国产精品乱人伦| 日韩美女视频一区| 亚洲免费观看在线视频| 亚洲综合激情小说| 亚洲愉拍自拍另类高清精品| 亚洲国产日日夜夜| 午夜精品在线视频一区| 日韩在线观看一区二区| 日本中文字幕一区| 精品一区二区三区免费观看| 国产在线精品视频| 国产传媒日韩欧美成人| 懂色一区二区三区免费观看| 成人网页在线观看| 色88888久久久久久影院野外| 在线精品视频一区二区| 欧美三级韩国三级日本一级| 日韩一区二区电影网| 2020国产精品| 国产精品久久久久久久久免费桃花 | 国产大片一区二区| av不卡在线观看| 欧美色大人视频| 日韩一区二区免费电影| 国产日韩精品久久久| 亚洲日本青草视频在线怡红院| 亚洲蜜臀av乱码久久精品| 日韩在线卡一卡二| 国产成人精品亚洲777人妖| 色哟哟国产精品免费观看| 欧美日本国产一区| 国产欧美日韩综合精品一区二区| 亚洲欧美一区二区视频| 日韩精品欧美成人高清一区二区| 久久99国产精品久久99| 成人激情黄色小说| 欧美伦理电影网| 久久综合精品国产一区二区三区| 亚洲女厕所小便bbb| 久久精品72免费观看| 91在线云播放| 欧美成人国产一区二区| 亚洲欧美一区二区三区极速播放 | 国产精品三级av| 成人福利视频在线| 欧美老肥妇做.爰bbww| 久久精品亚洲精品国产欧美| 亚洲一本大道在线| 国产.欧美.日韩| 欧美肥大bbwbbw高潮| 日本一区二区成人在线| 午夜精品一区二区三区电影天堂| 国产传媒一区在线| 欧美一区二区视频观看视频| 日本一区二区电影| 蜜臀久久99精品久久久久久9| 99精品视频中文字幕| 精品国产1区2区3区| 亚洲一二三专区| 国产99久久久久久免费看农村| 精品视频123区在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 日本在线不卡视频| 91麻豆国产精品久久| 国产网站一区二区| 久久国产乱子精品免费女| 欧美性生活影院| 日韩不卡一二三区| 亚洲美女视频在线观看| 精品伊人久久久久7777人| 欧美在线一二三| 亚洲日穴在线视频| 高清国产午夜精品久久久久久| 91精品国产乱| 亚洲.国产.中文慕字在线| 91美女片黄在线观看91美女| 国产精品入口麻豆原神| 精品一区二区三区在线播放视频| 欧美日韩不卡一区二区| 一区二区三区电影在线播| 91亚洲男人天堂| 国产精品午夜在线观看| 国产91精品久久久久久久网曝门 | 91精品国产aⅴ一区二区| 一区二区成人在线| 欧美国产日韩亚洲一区| 国产一区欧美日韩| 精品国产乱子伦一区| 麻豆极品一区二区三区| 欧美精品国产精品| 亚洲成人资源网| 精品视频一区二区三区免费| 亚洲综合激情网| 欧美日韩免费不卡视频一区二区三区| 亚洲欧美电影院| 欧美性受极品xxxx喷水| 婷婷综合另类小说色区| 欧美日韩国产首页在线观看| 亚洲高清视频中文字幕| 欧美性xxxxx极品少妇| 三级成人在线视频| 日韩免费看的电影| 国产精一区二区三区| 久久久久99精品国产片| 不卡视频在线看| 一区二区三区久久| 欧美精品三级日韩久久| 蜜臀久久99精品久久久画质超高清 | 亚洲欧洲另类国产综合| 91亚洲精华国产精华精华液| 夜夜精品视频一区二区| 欧美日韩在线直播| 美国毛片一区二区| 国产片一区二区| 色综合久久综合中文综合网| 亚洲午夜视频在线观看| 日韩欧美另类在线| 成人福利视频在线看| 亚洲午夜影视影院在线观看| 欧美一区二区三区免费在线看 | 麻豆国产欧美一区二区三区| 久久精品在线观看| 色天天综合久久久久综合片| 午夜精品在线视频一区| 久久久久国色av免费看影院| 91久久精品网| 久久精品国产亚洲高清剧情介绍| 国产午夜精品久久久久久免费视|