# Gnuplot - Histogram Fitting

**URL:** <https://community.unix.com/t/gnuplot-histogram-fitting/276179>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [October 26, 2010, 9:15pm UTC](https://community.unix.com/t/gnuplot-histogram-fitting/276179 "2010-10-26T21:15:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goffinj](https://community.unix.com/letter_avatar/goffinj/32/5_5575768a8748004e209b776fc1b2916d.png) [@goffinj](https://community.unix.com/u/goffinj)\
**Post date:** [October 26, 2010, 9:15pm UTC](https://community.unix.com/t/gnuplot-histogram-fitting/276179/1 "2010-10-26T21:15:28Z")

</div>

Hi I am trying to fit my histogram data with a gaussian model and am encountering two problems:

1. I can't seem to fit the histogram data with a model  
fit y(x) 'bin.txt' using 2:xtic(1) via a,b,c (error: need 2 to 7 using specs)
2. Even when I manually guess the correct parameters for my fit and try to plot both the curve and histogram at the same time, only the histogram shows up  
My data is:

#Bin Frequency  
86 0  
90 1  
94 4  
98 4  
102 7  
106 6  
110 5  
114 9  
118 4  
122 5  
126 3  
130 1  
134 0  
138 1

y(x)=a\*exp(-((x-b)/c)\*\*2)  
a=9.0; b=110.0; c=7.07  
plot y(x), 'bin.txt' using 2:xtic(1) (only the histogram is displayed)  
Any advice would be helpful, thanks.

---

<div class="post-metadata">

**Author:** ![rdcwayx](https://community.unix.com/letter_avatar/rdcwayx/32/5_5575768a8748004e209b776fc1b2916d.png) [@rdcwayx](https://community.unix.com/u/rdcwayx)\
**Post date:** [October 26, 2010, 10:41pm UTC](https://community.unix.com/t/gnuplot-histogram-fitting/276179/2 "2010-10-26T22:41:09Z")

</div>

ok, I think you have provided the sample input file, could you please provide the sample output from your input file?
