-
Notifications
You must be signed in to change notification settings - Fork 18
/
sens_task_update.m
82 lines (69 loc) · 1.3 KB
/
sens_task_update.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
% Study measurement upatre of sensor tasking
% - pseudo
% - sensor contraints ----
% - probability of detection
clc
clear all
close all
Px=[10,8;8,10];
mux=[5;5];
fn=2;
alphaa=pi;
Rmax=4;
dirn=0;
FOV=[alphaa,Rmax,dirn];
xsenspos=[4;5];
R=[5,-3;-3,5];
hn=2;
% [y,G,tp]= hxrb(xtarg,xsenspos,FOV);
%% Kalman filter update
[X,w]=UT_sigmapoints(mux,Px,2);
Y=zeros(size(X,1),hn);
G=zeros(size(X,1),1);
for i=1:1:size(X,1)
[y,g,tp]= hxy(X(i,:)',xsenspos,FOV);
Y(i,:)=y;
G(i)=g;
end
RR=0;
for i=1:1:size(X,1)
r=sqrt(sum((xsenspos-X(i,:)').^2));
g= max((r/Rmax)^5,1)
RR=RR+w(i)*g*R;
% if G(i)==-1
% RR=RR+w(i);
% else
% RR=RR+w(i);
% end
end
[R,RR]
% RR=R;
% [R,RR]
[mz,Pz]=MeanCov(Y,w);
Pz=Pz+RR;
Pcc=CrossCov(X,mux,Y,mz,w);
[xk,Pk]=KalmanUpdate(mux,Px,mz,Pz,Pcc,-1);
% [mk1,Pk1]=KalmanUpdate_modf_angle(mk,Pk,mz,Pz,Pcc,ym,ytp)
%%
figure(1)
plot_1sig_ellipse(mux,Px,'b')
hold on
plot_1sig_ellipse(mux,Pk,'r')
plot(X(:,1),X(:,2),'go','linewidth',2)
plot_circle_sensor(xsenspos(1),xsenspos(2),Rmax,'k')
% axis([-5,10,-5,10])
grid on
% N=100000;
% Xmc=mvnrnd(mux,Px,N);
% Y=zeros(N,2);
% G=zeros(N,1);
% for j=1:1:N
% [y,g,tp]= hxy(Xmc(j,:)',xsenspos,FOV);
% Y(j,:) =y;
% G(j)=g;
% end
% Yin=Y(G==1,:);
% figure(2)
% hist3(Yin,[50,50])
% xlabel('r')
% ylabel('th')