00001 00002
00003 00004 00005 00006
00007 package require jmath
00008
00009 set min [jmath::new_vec 2]
00010 jmath::setValue $min "(-5, -5)"
00011
00012 set max [jmath::new_vec 2]
00013 jmath::setValue $max "(5, 5)"
00014
00015 set uniform [jmath::new_MultiDimUniformDistribution $min $max]
00016
00017 set mean [jmath::new_vec 2]
00018 jmath::setValue $mean "(0, 0)"
00019
00020 set cov [jmath::new_vec 2]
00021 jmath::setValue $cov "(2, 1)"
00022
00023 set normal [jmath::new_MultiDimNormalDistribution $mean $cov]
00024
00025 set nbSamples 5000
00026
00027 set data [kernel::new_DataLogger "demoRandom.dat"]
00028
00029 $data writeCurrentDate
00030 $data writeComment "plot 'demoRandom.dat' u 1:2, '' u 3:4"
00031 $data writeComment "u_x u_y n_x n_y"
00032
00033 for {set i 0} {$i < $nbSamples} {incr i} {
00034 set u [$uniform get]
00035 set n [$normal get]
00036 $data writeData "[jmath::vec_get $n 0] [jmath::vec_get $n 1] \n"
00037 }
00038
00039 00040 00041