⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatestates.m

📁 particle filter using SIR
💻 M
字号:
function x = updatestates(xu,q);% PURPOSE : Performs the resampling step of the SIR algorithm%           in order(numSamples) steps.% INPUTS  : - xu = Predicted state samples.%           - q = Normalised importance ratios.% OUTPUTS : - x = Resampled state samples.% AUTHOR  : Nando de Freitas - Thanks for the acknowledgement :-)% DATE    : 08-09-98if nargin < 2, error('Not enough input arguments.'); end[N,timeStep]=size(xu);  % N = number of samples;u = rand(N+1,1);t = -log(u);x = 10.*ones(size(xu));T = cumsum(t);Q = cumsum(q);i = 1;j = 1;while j <= N,      if (Q(j,1)*T(N,1)) > T(i,1)          x(i,1) = xu(j,1);         i = i+1;      else          j = j+1;      end;  end;x=x;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -