?? updatestates.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;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -