|
Revision 1105, 0.7 kB
(checked in by zimamiro, 16 years ago)
|
|
|
| Line | |
|---|
| 1 | function [ztrata control y b P]=sloz(apriori,system) |
|---|
| 2 | |
|---|
| 3 | [H u]=load_H; |
|---|
| 4 | |
|---|
| 5 | %for i=1:size(H,1); |
|---|
| 6 | % plot(H(i,:,1),H(i,:,2),'g.'); end |
|---|
| 7 | |
|---|
| 8 | %plot(H(1,:,1),H(1,:,2),'g.'); hold on |
|---|
| 9 | %plot(H(1,index,1), H(1,index,2),'r+'); |
|---|
| 10 | %plot(eta_tilda, beta_tilda,'b.'); hold off |
|---|
| 11 | |
|---|
| 12 | [ztrata control y b P]=rizeni(H,u,system,apriori); |
|---|
| 13 | end |
|---|
| 14 | |
|---|
| 15 | function next=kalman_filter(state,u,sigma) |
|---|
| 16 | %OK |
|---|
| 17 | %prostor hyperstavu - kazdy bod ma souradnice (y, b, P) |
|---|
| 18 | |
|---|
| 19 | %realization |
|---|
| 20 | next(1)=state(1)+(state(2)+state(3)*randn)*u+sigma*randn; |
|---|
| 21 | |
|---|
| 22 | %kalman |
|---|
| 23 | K=u*state(3)/(state(3)*u^2+sigma^2); |
|---|
| 24 | next(2)=state(2)+K*(next(1)-state(1)-state(2)*u); |
|---|
| 25 | next(3)=(1-K*u)*state(3); |
|---|
| 26 | end |
|---|