File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
# # Experiment
10
- t = 1000000 # Trials
10
+ t = 10000 # Trials
11
11
dx = 0.25 # binsize
12
12
v = randn (t,2 ) # samples
13
13
x = - 4 : dx: 4 # range
14
14
15
15
# # Plot
16
16
using Winston
17
17
module Plot3D
18
+ using Winston
18
19
# Warning: the 3D interface is very new at the time
19
20
# of writing this and is likely to not be available
20
21
# and/or have changed
@@ -25,7 +26,10 @@ module Plot3D
25
26
end
26
27
end
27
28
edg1, edg2, count = hist2 (v, x- dx/ 2 )
28
- cntrs = (first (x)+ dx/ 2 , last (x)- dx/ 2 , length (x)- 1 )
29
- x,y = meshgrid (cntrs, cntrs)
30
- Plot3D. plot3d (Plot3D. surf (x,y,count./ (t* dx^ 2 ) * 10 * length (cntrs)))
31
- Plot3D. plot3d (Plot3D. surf (x,y,exp (- (x.^ 2 + y.^ 2 )/ 2 )/ (2 * pi ) * 10 * length (cntrs)))
29
+ # cntrs = ((first(x)+dx/2), (last(x)-dx/2), length(x)-1)
30
+ # x,y = meshgrid(cntrs, cntrs)
31
+ cntrs = (first (x)+ dx/ 2 ): dx: (last (x)- dx/ 2 )
32
+ x = Float64[x for x = cntrs, y = cntrs]
33
+ y = Float64[y for x = cntrs, y = cntrs]
34
+ Plot3D. plot3d (Plot3D. surf (x,count./ (t* dx^ 2 ) * 50 ,y))
35
+ Plot3D. plot3d (Plot3D. surf (x,exp (- (x.^ 2 + y.^ 2 )/ 2 )/ (2 * pi ) * 50 ,y))
You can’t perform that action at this time.
0 commit comments