Need help with debugging on kalman filter

Hi all,
I need to modify these codes below on Kalman filter, but there seems to be some error.
Can anyone help please?
clear N=3; %number of samples
Nrun=100; %number of runs
T=1; %sampling interval
sw=1; % sigma_w
sv=1; % sigma_v
A=[1 T; 0 1]; %process matrix
C=[1 0]; %process matrix
R1=sw^2*[T^4/4 T^3/2; T^3/2 T^2]; %covariance of process noise
R2=sv^2; %covariance of measurement noise
Pm(:,:,1)=1e5*eye(2); %P(0|-1)
for k=1:N
Kf(:,k)=Pm(:,:,k)*C*(C*Pm(:,:,k)*C+R2)^(-1); %Kf(:,k)=Kf(k)
K(:,k)=(A*Pm(:,:,k)*C)*(C*Pm(:,:,k)*C+R2)^(-1); %K(:,k)=K(k)
P(:,:,k)=Pm(:,:,k)-(Pm(:,:,k)*C)*(C*Pm(:,:,k)*C+R2)^(-1)*C*Pm(:,:,k); %P(:,:,k)=P(N|N) Pm(:,:,k+1)=A*Pm(:,:,k)*A’+R1-K(:,k)*(C*Pm(:,:,k)*C’+R2)*K(:,k)’; %Pm(:,:,k+1)=P(N+1|N)
end

댓글 수: 2

Geoff Hayes
Geoff Hayes 2020년 11월 9일
Wei - what modifications do you need to make? What is the error?
Wei Jun Chan
Wei Jun Chan 2020년 11월 10일
Hi Geoff,
Thank you. I managed to find the error.
So i copied this codes from a PDF file and the syntax for C’ is formatted. it should be C'. The ’ and ' was changed and matlab could not recognise ’.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

질문:

2020년 11월 9일

댓글:

2020년 11월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by