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

📄 resamplea.m

📁 该系统主要使用matlab实现了stbc2*1系统的发送和接收
💻 M
字号:
function [xP,wP,nip] = resampleA(xP,wP,MLest,Estdet);
%This routine resamples the weights so that it removes paricles
%That have a low associated weight
%wPP  weights of the particles
%wIndex  vector of weight locations (corresponding to particles) that get kept
%
%Rules 
%1. Make a 'pool' of all accepted particles. 
%   i.e., all particles above a certain threashold weight 'Wth'
%   The user sets the Wth limit; say above 0.8 is a good one.
%2. Remove partilces that are below Wth, and replace that spot 
%   with one that is randomly grabbed from the 'pool' of acceptable
%   particles
if nargin == 3, Estdet = 10; end

%Normalize weights
nParticles = length(wP);
wP = wP/sum(wP);

%Set weight threashold; try Wth = 1/nParticles. This represents 
%Above this threashold are resampled, below are rejected
%Wth = 1/nParticles * 2/3;
Wth = 1/nParticles*0.666; 

%Set 1, Make Pool of Acceptable Particles
[W,I]=sort(wP);
Wsort = W > Wth;  %Accpetable weights
Ipool = I(Wsort)';
Wpool = wP(Ipool);
nip = length(Wpool); %number in acceptable pool

if (nip <= 1)|(Estdet < 0);, 
    fprintf('Low number of acceptable particles.\n')
    %Contingency if they are all bad, You have lost tracking.
    xP = 0.5*xP + 0.5*repmat(MLest,[1 1 nParticles]);
    %Normalize all weights
    wP = ones(nParticles,1)/nParticles;
    return
end

nnr = nParticles - nip; %number needing replacement
rIndex = ceil(nip*rand(1,nnr));
outIndex = [Ipool Ipool(rIndex)];

wPrs = wP(outIndex); %Get new resampled weights
wP = wPrs;           %Make resampled weights the new weights
if ndims(xP) == 3,
    xPrs = xP(:,:,outIndex);
    xP = xPrs;           %Make resampled particles the new particles
elseif ndims(xP) == 2,
    xPrs = xP(outIndex,:);
    xP = xPrs;
end

⌨️ 快捷键说明

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