From 337fefa7879028e1fba6cc820420c4b47f8e22b2 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 7 Dec 2011 21:08:55 +0100 Subject: converting to git --- examples/fitting.hs | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 examples/fitting.hs (limited to 'examples') diff --git a/examples/fitting.hs b/examples/fitting.hs deleted file mode 100644 index a8f6b1c..0000000 --- a/examples/fitting.hs +++ /dev/null @@ -1,24 +0,0 @@ --- nonlinear least-squares fitting - -import Numeric.GSL.Fitting -import Numeric.LinearAlgebra - -xs = map return [0 .. 39] -sigma = 0.1 -ys = map return $ toList $ fromList (map (head . expModel [5,0.1,1]) xs) - + scalar sigma * (randomVector 0 Gaussian 40) - -dat :: [([Double],([Double],Double))] - -dat = zip xs (zip ys (repeat sigma)) - -expModel [a,lambda,b] [t] = [a * exp (-lambda * t) + b] - -expModelDer [a,lambda,b] [t] = [[exp (-lambda * t), -t * a * exp(-lambda*t) , 1]] - -(sol,path) = fitModelScaled 1E-4 1E-4 20 (expModel, expModelDer) dat [1,0,0] - -main = do - print dat - print path - print sol -- cgit v1.2.3