sometimes it's helpful to generate some test or dummy data.
I hoped that I can create some test data (columns and/or matrices) with
"set table".
Is there a way to generate N-column or M x N-matrix random data?
e.g. like
0.10 0.45 0.91 0.50 0.55
0.57 0.19 0.74 0.28 0.06
0.85 0.09 0.27 0.27 0.80
0.08 0.31 0.08 0.66 0.43
0.77 0.80 1.00 0.14 0.50
For example, I expected the following code to produce a 5x5 matrix of
random data.
reset
set samples 5
set table "Test.dat"
plot rand(0):rand(0):rand(0):rand(0):rand(0) with table
# or maybe
# plot rand(0),rand(0),rand(0),rand(0),rand(0) with table
# or "splot ... something"
unset table
But this seems not to work like this.
I also tried "set parametric" like in the "random-demos"...
While fiddling around I found that the following code would create such
a 5x5 matrix:
####### generate 5x5 matrix of random numbers
reset
$Data <<EOD
1 1
2 1
3 1
4 1
5 1
EOD
set table "Test.dat"
plot $Data using \
($2*rand(0)):($2*rand(0)):($2*rand(0)):($2*rand(0)):($2*rand(0)) \
with table
unset table
####### EOF
Two questions:
1)
How would I do this for a 1000x1000 matrix?
Repeating ($2*rand(0)) a thousand times...???
2)
Ideally, I also wanted the data to be separated by TAB instead of space.
So, if I additionally set in the above working code
set datafile separator "\t"
I get the error message: "...x range is invalid"
Any ideas?
|