00001 00002
00003 00004 00005 00006
00007 package require kernel
00008 package require jmath
00009 package require filter
00010
00011 set Q [jmath::create_sym_mat 1 1 "1"]
00012 set F [jmath::create_mat 1 1 "1.1"]
00013
00014 set pm [filter::new_LinearPredictModel $F $Q]
00015
00016 set R [jmath::create_mat 1 1 "1"]
00017 set H [jmath::create_mat 1 1 "1"]
00018 set om [filter::new_LinearObserveModel $H]
00019
00020 set stateMin [jmath::create_vec 1 "0"]
00021 set stateMax [jmath::create_vec 1 "10"]
00022
00023 set myFilter [filter::new_ParticleFilter 100 1 $stateMin $stateMax]
00024
00025 set p [jmath::create_mat 1 1 "0"]
00026
00027 proc update {z r} {
00028 global myFilter om p
00029 $myFilter update $om $z $r
00030 filter::statesToMatPlot $myFilter $p
00031 jmath::plot $p "'-' u 2:1"
00032 }00033
00034 proc predict {} {
00035 global myFilter pm p
00036 $myFilter predict $pm
00037 filter::statesToMatPlot $myFilter $p
00038 jmath::plot $p "'-' u 2:1"
00039 }00040
00041 filter::statesToMatPlot $myFilter $p
00042 jmath::plot $p "'-' u 2:1"