diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-09-21 18:28:08 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-09-21 18:28:08 +0000 |
commit | 0198366bba7a5f2d67338633f9eb90889ffc31b2 (patch) | |
tree | 4897d90233b333ee2092e63a4b74c7bcb2d22577 /examples/plot.hs | |
parent | d4cb2692f9dae748da23371057a983deca4b2f80 (diff) |
add examples
Diffstat (limited to 'examples/plot.hs')
-rw-r--r-- | examples/plot.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/plot.hs b/examples/plot.hs new file mode 100644 index 0000000..1177c11 --- /dev/null +++ b/examples/plot.hs | |||
@@ -0,0 +1,20 @@ | |||
1 | import LinearAlgebra | ||
2 | import Graphics.Plot | ||
3 | import GSL(erf_Z, erf) | ||
4 | |||
5 | sombrero n = f x y where | ||
6 | (x,y) = meshdom range range | ||
7 | range = linspace n (-2,2) | ||
8 | f x y = exp (-r2) * cos (2*r2) where | ||
9 | r2 = x*x+y*y | ||
10 | |||
11 | f x = sin x + 0.5 * sin (5*x) | ||
12 | |||
13 | gaussianPDF = erf_Z | ||
14 | cumdist x = 0.5 * (1+ erf (x/sqrt 2)) | ||
15 | |||
16 | main = do | ||
17 | let x = linspace 1000 (-4,4) | ||
18 | mplot [f x] | ||
19 | mplot [x, liftVector cumdist x, liftVector gaussianPDF x] | ||
20 | mesh (sombrero 40) \ No newline at end of file | ||