Extended Kalman Filter

  • 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
  [cc(i),cr(i),radius,flag] = extractbackgraund(Imwork,Imback,i);
  if flag==0
    continue
  end
  imshow(Im);
  hold on
    for c = -1*radius: radius/20 : 1*radius
      r = sqrt(radius^2-c^2);
      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
    for c = -1*radius: radius/20 : 1*radius
      r = sqrt(radius^2-c^2);
       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
Reply harun 12/17/2009 10:57:03 AM

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
821 Views

(page loaded in 0.047 seconds)

Similiar Articles:













7/22/2012 5:23:21 PM


Reply: