|
From: baouche <bao...@gm...> - 2011-02-28 08:49:46
|
Dear List, I would like to draw a histogram with his Gaussian shape for this data: # time simulation #data collected 50 0.6 100 22 150 3 200 3.8 250 5 300 0 350 0 400 0 450 0 500 0 550 0 600 0 650 0 700 0 750 0 Thanks already, chakib -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31029938.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2011-02-28 15:08:58
|
plot 'datafilename' with histeps baouche wrote: > > Dear List, > > I would like to draw a histogram with his Gaussian shape for this data: > > # time simulation #data collected > 50 0.6 > 100 22 > 150 3 > 200 3.8 > 250 5 > 300 0 > 350 0 > 400 0 > 450 0 > 500 0 > 550 0 > 600 0 > 650 0 > 700 0 > 750 0 > > Thanks already, > > chakib > -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31030803.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: baouche <bao...@gm...> - 2011-02-28 15:21:15
|
Hello, Thanks for your reply but it's not exactly what i want, this is the kind of result that i want : http://old.nabble.com/file/p31030805/stat0108_wmf.gif Regards. -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31030805.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2011-02-28 16:31:43
|
define the gauss-function, gauss(x)=amplitude/(sigma*sqrt(2.*pi))*exp(-(x-position)**2/(2.*sigma**2)) fit it to the data, fit 'datafilename' gauss(x) via amplitude, position, sigma and then plot it: plot 'datafilename' with histeps, gauss(x) and try to set 'amplitude', 'position', and 'sigma' to reasonable values before fitting, otherwise the fit may get lost. baouche wrote: > > Hello, > > Thanks for your reply but it's not exactly what i want, this is the kind > of result that i want : > > http://old.nabble.com/file/p31030805/stat0108_wmf.gif > > Regards. > -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31031085.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2011-03-03 19:26:52
|
your data doesn't show any gaussian shape. are you sure you posted the correct data? baouche wrote: > > Hello, > > Thank you for the information, but i can't find a good value for these > three parameters: amplitude, position and sigma, > > My data are: > > # data > 50 0.6 > 100 22 > 150 3 > 200 3.8 > 250 5 > 300 0 > 350 0 > 400 0 > 450 0 > 500 0 > 550 0 > 600 0 > 650 0 > 700 0 > 750 0 > > > Regards. > > -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31061892.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: baouche <bao...@gm...> - 2011-03-04 08:33:58
|
This is my best data: 50 0.6 100 22 150 20 200 20.4 250 37 300 34.4 350 39.2 400 39.2 450 32.2 500 27 550 10.8 600 5.4 650 3.4 700 0.4 750 0 Regards -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31065753.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2011-03-04 10:16:35
|
your data look like an energy loss spectrum of a particle detector. in order to fit a gaussian you first need to do a background subtraction. we assume an exponential function here. background(x)=b0*exp(-x/bc) we use only the two points at x=100 and x=700, resp. to determine the background. fit background(x) 'ts.dat' using ($1==100||$1==700?$1:0/0):2 via b0, b and then we fit the gaussian fit [90:800] gauss(x) 'ts.dat' using 1:($2-background($1)) via position, amplitude, sigma the complete script: datafile = 'ts.dat' set samples 1000 set yrange [0:*] gauss(x)=amplitude/(sigma*sqrt(2.*pi))*exp(-(x-position)**2/(2.*sigma**2)) background(x)=b0*exp(-x/bc) b0=30 bc=200 fit background(x) datafile using ($1==100||$1==700?$1:0/0):2 \ via b0, b amplitude=10000 sigma=100 position=350 fit [90:800] gauss(x) datafile using 1:($2-background($1)) \ via position, amplitude, sigma plot datafile using 1:2 with histeps title 'data', \ '' using 1:($2-background($1)) with histeps title 'data-background', \ gauss(x), background(x), gauss(x)+background(x) baouche wrote: > > This is my best data: > > 50 0.6 > 100 22 > 150 20 > 200 20.4 > 250 37 > 300 34.4 > 350 39.2 > 400 39.2 > 450 32.2 > 500 27 > 550 10.8 > 600 5.4 > 650 3.4 > 700 0.4 > 750 0 > > Regards > -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31066345.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: baouche <bao...@gm...> - 2011-03-04 10:22:26
|
Thank you for your Great Job ! -- View this message in context: http://old.nabble.com/how-to-draw-Gaussian-shape-with-histogram-tp31029938p31066388.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |