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

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

?? kalmeval.m

?? 卡爾曼濾波
?? M
字號(hào):
function [yhat_data,RMS]=kalmeval(method,kalmfiley,r,x_data,PS,y,tidx,optpar);
% KALMEVAL    Evaluate filter performance.
%
%    Assuming a (nonlinear) observation equation
%               y(k) = g[x(k),w(k)],
%    where 'x' is the state vector and 'w' is (white) observation noise,
%    KALMEVAL estimates the output (y) from the state estimates obtained
%    by filtering. The function plots the observed and estimated outputs
%    as well as the state estimates along with 3 times their standard
%    deviations.
%    
% Call
%   [yhat,RMS]=kalmeval('method','yfile',R,xhat,PS,y,tidx,optpar) 
%
% Input
%   method  - Filter method (ekf, dd1, dd2, ekfm, dd1m, dd2m).
%   yfile   - Name of file containing the observation equations.
%   R       - Covariance matrix for the measurement noise.
%             only used if method='dd2' or 'dd2m'.
%   xhat    - State estimates. Dimension is [samples+1 x states].
%   PS      - Matrix where each row contains elements of (the upper triangular
%             part of) the Cholesky factor of the covariance matrix
%             (dd1, dd2, dd1m, dd2m) or the covariance matrix (ekf, ekfm).
%             The dimension is [samples+1 x 0.5*states*(states+1)].
%   y       - Signal of observed outputs. Dimension: [observations x outputs].
%   tidx    - Vector containing time stamps (in samples) for the 
%             observations in y.
%   optpar  - (Optional) Data structure containing optional parameters:
%	           .G:     Measurement noise coupling matrix (/cell array).
%             .init : Initial parameters for 'xfile', 'yfile'
%                     (use an arbitrary format).
%
%   In case of multiple observation streams (dd1m, dd2m, ekfm), the
%   arguments yfile, R, y, and tidx must be cell arrays. 
%
% Output
%   yhat    - Output estimate. Dimension is [samples+1 x outputs].
%   RMS     - RMS error for each output.
%
%  The user must provide the m-functions 'yfile' containing the
%  output equation. The function should take two arguments:
%       function y=my_yfile(x,w)
%
%  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.
%
%
% Written by Magnus Norgaard
% LastEditDate: Nov. 22, 2001 

% >>>>>>>>>>>>>>>>>>>>>>>>>>> INITIALIZATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<
h2    = 3;                 % Squared divided difference step
h     = sqrt(h2);          % Divided difference step
if nargin<8,               % No optional parameters passed
   optpar = [];
end
if isfield(optpar,'init')  % Parameters for m-functions
   initpar = optpar.init;
else
   initpar = [];
end


% ----- Check if there are muliple streams -----
if strcmpi(method,'dd1m') | strcmpi(method,'dd2m') | strcmpi(method,'ekfm'),
   streamflag = 1;
   streams    = length(y);
   if ~(iscell(kalmfiley) & iscell(r) & iscell(tidx) & iscell(y))
     error('"yfunc", "R", "tidx", and "y" must be cell structures');
   elseif (streams~=length(r) | streams~=length(tidx) | ...
                                 streams~=length(kalmfiley))
     error('"yfunc", "r", "tidx", and "y" must have same number of cells');
   end
   idx1 = zeros(streams,1);       % Index to start of each stream in yhat/ybar
   idx2 = zeros(streams,1);       % Index to end of each stream in yhat/ybar
   ny   = 0;
   for n=1:streams,               % Wrap information about observation stream 
     obs(n).yfunc = kalmfiley{n}; % into data structure
     obs(n).y     = y{n};
     obs(n).tidx  = tidx{n};
     obs(n).ny    = size(obs(n).y,2);
     obs(n).nobs  = size(obs(n).y,1);
     [v,d]        = eig(r{n});
     obs(n).nw    = size(r{n},1);  
     obs(n).hSw   = h*real(v*sqrt(d)); % Square root of measurement noise cov.
     if (obs(n).nobs~=size(obs(n).tidx,1)),
       error('Dimension mismatch between y and tidx');
     end
     ny = ny + obs(n).ny;
     idx1(n) = ny - obs(n).ny + 1;
     idx2(n) = ny;
	  obs(n).wmean = zeros(obs(n).nw,1); % Mean of measurement noise
	  obs(n).nxnw2 = nx+obs(n).nw;
	  obs(n).Gflag = 0;
   end
   if isfield(optpar,'G'),    % Linear observation noise model
      if ~iscell(optpar.G),
         error('"optpar.G" must be a cell array');
      elseif streams~=length(optpar.G),
         error('Number of cells in "optpar.G" is wrong');
      end
      for n=1:streams,
		   if ~isempty(optpar.G{n})  % Observation model "n" is linear
            obs(n).Gflag = 1;
			   obs(n).nxnw2 = obs(n).nxnw2-obs(n).nw;
			end
		end
	end
else
   streamflag = 0;
   ny    = size(y,2);         % # of outputs
   nw    = size(r,1);         % # of measurement noise sources
   [v,d] = eig(r);            % Square root of process noise covariance
   hSw   = h*real(v*sqrt(d)); % ..times h
   feval(kalmfiley,initpar);  % Output equation
   wmean = zeros(nw,1);       % Mean of measurement noise
	Gflag = 0;
   nxnw2 = nx+nw;
	if isfield(optpar,'G'),    % Linear observation noise model
      nxnw2 = nxnw2-nw;
      Gflag = 1;
   end
end

yhat      = zeros(ny,1);      % Allocate yhat 
[samples,nx]= size(x_data);   % # of samples and states
samples     = samples -1;
yhat_data = zeros(samples+1,ny); % Matrix for storing estimates of output
[I,J]     = find(triu(reshape(1:nx*nx,nx,nx))'); % Index to elem. in Sx
sidx      = sub2ind([nx nx],J,I);
Sx        = zeros(nx,nx);  % Allocate memory for covariance 'root'
counter   = 0;             % Counts the progress of the evaluation
waithandle=waitbar(0,'Evaluating filter');  % Initialize wait bar


% >>>>>>>>>>>>>>>>>>>>>>>>>>>> EVALUATE OUTPUT <<<<<<<<<<<<<<<<<<<<<<<<<<<
% ---------- DD1 and EKF ----------
if strcmpi(method,'dd1') | strcmpi(method,'ekf')
   for k=0:samples,

     % --- Output prediction ---  
     yhat = feval(kalmfiley,x_data(k+1,:)',wmean); % output estimate  
     yhat_data(k+1,:) = yhat';

     % --- How much longer? ---
     if (counter+0.01<= k/samples),
		  counter = k/samples;
		  waitbar(k/samples,waithandle);
     end
   end
   
% ---------- DD2 ----------
elseif strcmpi(method,'dd2')
  for k=0:samples,

     % --- Output prediction ---  
     Sx(sidx) = PS(k+1,:);                % Extract covariance estimate
     xhat = x_data(k+1,:)';               % Current state estimate
     yhat = feval(kalmfiley,x_data(k+1,:)',wmean); % "Nominal" output estimate
     yhat = ((h2-nxnw2)/h2)*yhat;
     for kx=1:nx,
       syp = feval(kalmfiley,xhat+h*Sx(:,kx),wmean);
       sym = feval(kalmfiley,xhat-h*Sx(:,kx),wmean);
       yhat = yhat + (syp+sym)/(2*h2);    
     end
	  if ~Gflag,
        for kw=1:nw,
           swp = feval(kalmfiley,xhat,hSw(:,kw));
           swm = feval(kalmfiley,xhat,-hSw(:,kw));
           yhat = yhat + (swp+swm)/(2*h2);          
        end
	  end
     yhat_data(k+1,:) = yhat';

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

% ---------- DD1M and EKFM ----------
elseif strcmpi(method,'dd1m') | strcmpi(method,'ekfm'),
   for k=0:samples,
      for n=1:streams,
			% --- Output prediction ---
			xhat =   x_data(k+1,:)';
			yhat(idx1(n):idx2(n)) = feval(obs(n).yfunc,xhat,obs(n).wmean);  
		end
      yhat_data(k+1,:) = yhat';
      
      % --- How much longer? ---
		if (counter+0.01<= k/samples),
			counter = k/samples;
			waitbar(k/samples,waithandle);
     end
   end


% ---------- DD2M ----------
elseif strcmpi(method,'dd2m'),
   for k=0:samples,
      Sx(sidx) = h*PS(k+1,:);              % Extract covariance estimate
      xhat = x_data(k+1,:)';               % Current state estimate

      for n=1:streams,
	      % --- Output prediction ---
			yhat(idx1(n):idx2(n)) = feval(obs(n).yfunc,xhat,obs(n).wmean);
         yhat(idx1(n):idx2(n)) = ((h2-obs(n).nxnw2)/h2)*yhat(idx1(n):idx2(n));
         for kx=1:nx,
            syp = feval(obs(n).yfunc,xhat+Sx(:,kx),obs(n).wmean);
            sym = feval(obs(n).yfunc,xhat-Sx(:,kx),obs(n).wmean);
			   yhat(idx1(n):idx2(n)) = yhat(idx1(n):idx2(n)) + (syp+sym)/(2*h2);
			end
			if ~obs(n).Gflag,
			   for kw=1:obs(n).nw,
				   swp = feval(obs(n).yfunc,xhat,obs(n).hSw(:,kw));
				   swm = feval(obs(n).yfunc,xhat,-obs(n).hSw(:,kw));
				   yhat(idx1(n):idx2(n)) = yhat(idx1(n):idx2(n)) + (swp+swm)/(2*h2);
			   end
			end
      end
      yhat_data(k+1,:) = yhat';
      
     % --- How much longer? ---
     if (counter+0.01<= k/samples),
		  counter = k/samples;
		  waitbar(k/samples,waithandle);
     end
   end

% ---------- Invalid Filter Specified ----------
else
   close(waithandle);                  % Close wait bar
   error(['"' method '" is not a valid filter method']);
end

% Calculate RMS error
if streamflag==0,
   RMS = sqrt(sum((y-yhat_data(tidx,:)).^2,1)/size(y,1));
else
   RMS = zeros(1,ny);
   for n=1:streams,
      RMS(idx1(n):idx2(n))= ...
        sqrt(sum((obs(n).y-yhat_data(obs(n).tidx,idx1(n):idx2(n))).^2,1)/obs(n).nobs);
   end
end

% Close wait bar
close(waithandle);


% >>>>>>>>>>>>>>>>>>>>>>>>>>> PLOT RESULTS <<<<<<<<<<<<<<<<<<<<<<<<<<
Maxsubplots = 3;             % Maximum # of plots in one figure window

% --- Plot observed and estimated output ---
clf
% ---------- Multiple observation streams ------
if streamflag==1,
   % ----- Plot observations -----
   for n=1:streams
     subplot(streams,1,n)
     plot(0:samples,yhat_data(:,idx1(n):idx2(n)),'-',obs(n).tidx,obs(n).y,'+')
     grid
     set(gca,'Xlim',[0 samples])
     ylabel(['Stream #' num2str(n)]);
     if n==1,
       title('Observed output (+) and estimated output (line)')
     end
     if n==streams,
       xlabel('Time (samples)')
     end
   end

   % ----- Plot residuals -----
   figure
   for n=1:streams
     subplot(streams,1,n)
     plot(obs(n).tidx,[obs(n).y-yhat_data(obs(n).tidx,idx1(n):idx2(n))])
     grid
     set(gca,'Xlim',[0 samples])
     ylabel(['Stream #' num2str(n)]);
     if n==1,
       title('Error between observed and estimated output')
     end
     if n==streams,
       xlabel('Time (samples)')
     end
   end

% ---------- A single observation stream ------
else
   subplot(211)
   plot(0:samples,yhat_data,'-',tidx,y,'+')
   grid
   set(gca,'Xlim',[0 samples])
   title('Observed output (x) and estimated output (line)')
   xlabel('Time (samples)')

   % --- Plot residuals ---
   subplot(212)
   plot(tidx,[y-yhat_data(tidx,:)])
   grid
   set(gca,'Xlim',[0 samples])
   title('Error between observed and estimated outputs')
   xlabel('Time (samples)')
end

% --- Plot state estimates ---
if strcmpi(method,'ekf'),
   statestd = 3*sqrt(mat2var(PS));
else
   statestd = 3*sqrt(smat2var(PS));
end
noplots = ceil(nx/Maxsubplots);
s = 1;    % State counter

for p=1:noplots,
   figure
   for i=1:Maxsubplots,
      subplot(Maxsubplots,1,i);
      plot(0:samples,x_data(:,s),'b-',0:samples,x_data(:,s)+statestd(:,s),'r:',...
                 0:samples,x_data(:,s)-statestd(:,s),'r:');
      set(gca,'Xlim',[0 samples]);
      ylabel(['State #' num2str(s)]);
      s = s+1;
      if s>nx, break; end
   end
   xlabel('Time (samples)');
end		 

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久国产精品72免费观看| 久久成人免费日本黄色| 午夜精品123| 在线观看一区日韩| 国产一区二区三区四| 亚洲精品日韩一| 欧美精品一区二区三区高清aⅴ| 不卡av电影在线播放| 免费成人在线观看| 亚洲午夜电影网| 国产精品初高中害羞小美女文| 日韩精品一区二区三区蜜臀 | 日韩激情视频在线观看| 欧美喷潮久久久xxxxx| 国产精品亲子伦对白| 日本美女视频一区二区| 欧美挠脚心视频网站| 一区二区三区四区高清精品免费观看 | 国产精品国产a| 国产一区在线观看视频| 亚洲美女区一区| 久久久精品国产免大香伊| www国产成人| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 91久久精品一区二区三| 国产91在线观看丝袜| 91久久一区二区| 中文在线资源观看网站视频免费不卡 | 日本久久一区二区| 激情综合五月婷婷| 91麻豆国产福利在线观看| 777a∨成人精品桃花网| 欧美日韩国产免费| 精品一区二区三区免费毛片爱 | 日韩美女视频在线| 日本韩国欧美国产| 久久综合久久综合亚洲| 国产成人在线色| 亚洲愉拍自拍另类高清精品| www.欧美亚洲| 欧美午夜精品久久久久久超碰| 日韩欧美一级二级三级久久久| 91精品久久久久久蜜臀| 不卡av在线免费观看| 国产一区二区三区四区在线观看| 日本一区二区电影| 福利一区二区在线观看| 五月天网站亚洲| 欧美日韩国产片| 国产裸体歌舞团一区二区| 精品国产99国产精品| 日韩欧美国产高清| 日本精品一区二区三区高清| 一本高清dvd不卡在线观看| 日韩欧美在线一区二区三区| 最好看的中文字幕久久| 色久优优欧美色久优优| 中文字幕在线不卡一区| 91久色porny | 欧美tk—视频vk| 久久精品免费在线观看| 国产精品视频一二三| 九九视频精品免费| 欧美伦理视频网站| 国产一区啦啦啦在线观看| 亚洲综合视频在线观看| 欧美一区二区三区在线观看 | 国产日本亚洲高清| 樱花影视一区二区| 国产欧美日韩亚州综合| 美女mm1313爽爽久久久蜜臀| 91官网在线免费观看| 欧美人牲a欧美精品| 欧美人狂配大交3d怪物一区| 国产一区二区h| 在线欧美一区二区| 日本人妖一区二区| 精品免费国产一区二区三区四区| 国产精品一区二区久久精品爱涩| 久久久91精品国产一区二区精品 | 亚洲综合色婷婷| 亚洲已满18点击进入久久| 亚洲另类一区二区| 亚洲精选视频在线| 久久久美女艺术照精彩视频福利播放| 久久蜜桃一区二区| 亚洲视频一区二区免费在线观看| 成人黄色777网| 欧美日韩免费视频| 成人免费视频caoporn| 午夜私人影院久久久久| 欧美性生活久久| 国产精品1区2区3区| 国产精品久久久久婷婷| 精品精品国产高清一毛片一天堂| 51午夜精品国产| 一区二区高清在线| 午夜精品免费在线| 国产乱码精品一区二区三区av| 日韩精品视频网| 国产精品传媒视频| 亚洲自拍偷拍网站| 成人免费小视频| jiyouzz国产精品久久| 一区二区三区四区不卡在线| 色八戒一区二区三区| 久久视频一区二区| 亚洲蜜臀av乱码久久精品| 午夜婷婷国产麻豆精品| 日韩精品视频网| 色综合天天综合网天天狠天天 | 欧美人体做爰大胆视频| 欧美裸体bbwbbwbbw| 亚洲精品一区二区三区精华液| 日韩西西人体444www| 欧美在线观看视频一区二区| 日韩精品一区二区三区四区 | 国产精品一区二区你懂的| 欧美性生活一区| 日韩美一区二区三区| 亚洲自拍偷拍图区| 成人自拍视频在线| 26uuu亚洲综合色| 免费成人av在线播放| 日本女优在线视频一区二区| 婷婷久久综合九色综合伊人色| 3d动漫精品啪啪| 亚洲国产欧美在线| 久久中文字幕电影| 欧美日韩精品专区| 国产剧情一区二区| 香蕉久久一区二区不卡无毒影院| 久久精品视频免费| 3d动漫精品啪啪一区二区竹菊| 国产69精品久久777的优势| 视频一区二区不卡| 一区二区三区欧美久久| 久久精品网站免费观看| 884aa四虎影成人精品一区| 成人黄色在线看| 久久超碰97人人做人人爱| 亚洲自拍偷拍网站| 中文字幕在线不卡一区二区三区| 亚洲精品一区二区三区在线观看| 欧美最猛黑人xxxxx猛交| 99久久婷婷国产精品综合| 国产成人精品亚洲午夜麻豆| 久久国产尿小便嘘嘘| 亚洲成人av电影| 亚洲天堂av一区| 精品免费国产一区二区三区四区| 欧美电影一区二区| 欧美二区三区的天堂| 在线综合+亚洲+欧美中文字幕| 欧美日韩一级二级三级| 欧美色偷偷大香| 欧美人xxxx| 欧美性xxxxxxxx| 欧美亚洲综合久久| 欧美吻胸吃奶大尺度电影| 91久久奴性调教| kk眼镜猥琐国模调教系列一区二区| 成人一区二区在线观看| 99国产一区二区三精品乱码| 97精品视频在线观看自产线路二| 97久久精品人人澡人人爽| 色爱区综合激月婷婷| 欧美日韩免费不卡视频一区二区三区| 欧美视频在线播放| 欧美电影一区二区三区| 久久综合九色综合久久久精品综合| 日韩久久免费av| 欧美一区二区三区在线| 欧美大片日本大片免费观看| 精品国产乱子伦一区| 国产精品久久二区二区| 亚洲一区二区美女| 欧美伦理影视网| 久久伊人中文字幕| 欧美日韩中文字幕一区| 日韩女优视频免费观看| 日韩欧美自拍偷拍| 国产性做久久久久久| 国产精品入口麻豆九色| 综合亚洲深深色噜噜狠狠网站| 国产亚洲美州欧州综合国| 欧美一区二区三区播放老司机 | 色呦呦国产精品| 欧美探花视频资源| 精品电影一区二区三区 | 国产一区二区三区黄视频| 紧缚奴在线一区二区三区| 日本韩国精品一区二区在线观看| 欧洲国内综合视频| 久久综合精品国产一区二区三区 | 日本成人超碰在线观看| 亚洲成a人片在线不卡一二三区| 中文字幕亚洲不卡| 亚洲黄色免费网站| 久久97超碰色|