fit a function to a histogram created with frequency in gnuplot

末鹿安然 提交于 2019-12-05 17:48:12

I'm facing a similar problem and I found a kind of not very ellegant solution.

binwidth=1
set boxwidth binwidth
bin(x,width)=width*floor(x/width) + binwidth/2.0
set table 'hist.temp'
plot [0:5][0:*] "hist.dat" u (bin($1,binwidth)):(1.0) smooth freq with boxes
unset table

And then you can do the fit of the file as you prefer. I know that probably there are some better way of doing this, but for me it is a fast and working solution. I hope this will be helpful for you.

Cheers!

MonaJalilvand

I used this a nd it worked:

gauss(x)=a/(sqrt(2*pi)sigma)*exp(-(x-mean)**2/(2*sigma**2))

fit gauss(x) 'data.txt' via a,sigma,mean

after 83 iterations GNUplot calculated me a, sigma, and mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!