COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Extended Kalman Filter

• Email
• Follow

```Hi dear....,

I want to estimate moving object by using extended kalman filter.
this code is for kalman filter.. and its also works  as not bad

now  in this code, when I want to change it to Extended kalman filter, I have to use two functions one of them is f and the other is h function. my problem is how to define these function??
the moving object is not specific object... it may be a plane.

function kalman()
clear,clc
....
....
....
% Kalman filter initialization
R=[[0.2845,0.0045]',[0.0045,0.0455]'];
H=[[1,0]',[0,1]',[0,0]',[0,0]'];
Q=0.01*eye(4);
P = 100*eye(4);
dt=1;
A=[[1,0,0,0]',[0,1,0,0]',[dt,0,1,0]',[0,dt,0,1]'];
g = 6; % pixels^2/time step
Bu = [0,0,0,g]';
kfinit=0;
x=zeros(100,4);

% loop over all images
for i = 1 : 30
....
....
....
%extract background
if flag==0
continue
end
imshow(Im);
hold on
plot(cc(i)+c,cr(i)+r,'g.')
plot(cc(i)+c,cr(i)-r,'g.')
end
% Kalman update

if kfinit==0
xp = [MC/2,MR/2,0,0]'
else
xp=A*x(i-1,:)' + Bu   %this code is for kalman iflter

%X(k|k-1)=fonktion f(x(i,:),Bu) % extended kalman filter should be

end
kfinit=1;
PP = A*P*A' + Q

% P(k|k-1)=Fk*P(k-1|k-1)*Fk'+Q(k-1) %predicted estimate covariance

K = PP*H'*inv(H*PP*H'+R)
x(i,:) = (xp + K*([cc(i),cr(i)]' - H*xp))';
%Zk=[cc(i),cr(i)]'
x(i,:)
[cc(i),cr(i)]
P = (eye(4)-K*H)*PP  %updated estiamte covariance
hold on
plot(cc(i)+c,cr(i)+r,'g.')
plot(cc(i)+c,cr(i)-r,'g.')
end
end

% show positions
figure
plot(cc,'r*')
hold on
plot(cr,'g*')
%end
stop(vid);
%estimate image noise (R) from stationary ball
posn = [cc(55:60)',cr(55:60)'];
mp = mean(posn);
diffp = posn - ones(6,1)*mp;
Rnew = (diffp'*diffp)/5;

```
 0

See related articles to this posting

```Hey, Love:

Do you know what the functions "f" and "h" are?

Michael.

```
 0
Reply Michael_RW (12) 1/22/2010 4:31:54 AM

2 Replies
1043 Views

Similar Articles

12/1/2013 4:37:53 PM
page loaded in 56415 ms. (0)