Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
demoRandom.tcl
00001 # $Id$ #
00002 
00003 #
00004 #/** Demo of uniform and normal random distribution. \file demoRandom.tcl  \ingroup jmath */
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 # set gp [open "demoRandom.gnuplot" "w"]
00040 # puts $gp "plot 'demoRandom.dat' u 1:2, '' u 3:4"
00041 # close $gp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:21 for Jafar by doxygen 1.7.6.1
LAAS-CNRS