Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject: Questions Regarding State Covariance Calculation in Particle Filter Code #1

Open
zhangbb-john opened this issue Nov 3, 2024 · 0 comments

Comments

@zhangbb-john
Copy link

Dear Professor Manon Kok,

I am a student from Zhejiang University, and I have some questions regarding the following code in parcileFilter.m:

for i = 1:N_P
    P_mean = w(i) * ( P(:,:,i) + (xl_mean - xl(:,i)) * (xl_mean - xl(:,i))');
end

Here, P represents the state covariance of the 515 coefficients of the basis functions, which are regarded as linear states within the filter.

In typical particle filters, P_mean is usually calculated as follows:

    weighted_mean = sum(xn .* weights, 2);
    
    % Compute covariance of particles
    P_mean = zeros(size(xn, 1));
    for j = 1:N_P
        diff = xn(:,j) - weighted_mean;
        P_mean = P_mean + weights(j) * (diff * diff');
    end

I have a couple of concerns regarding your implementation:

  • Variation with Particle Index: In your code, P_mean varies with the particle index i, which seems unusual. Could you clarify the reasoning behind this approach?

  • Addition of P(:,:,i): Additionally, I am curious why (xl_mean - xl(:,i)) * (xl_mean - xl(:,i))' adds P(:,:,i). This appears to differ from the typical formulation used in particle filters.

Thank you for your time and assistance.

Best regards,
Bingbing
[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant