Gnuplot - Histogram Fitting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Gnuplot - Histogram Fitting
# 1  
Old 10-26-2010
Gnuplot - Histogram Fitting

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.
# 2  
Old 10-26-2010
ok, I think you have provided the sample input file, could you please provide the sample output from your input file?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generating histogram

Hi, I have 2 files with similar structure - reference and test that I would like to BIN both and generate the comparison. input files structure is: a 3 b 10 c 3 d 7 e 1 f 4 g 9 h 6 I would like the output to be (lets say both reference and test are the file above - no diff) BIN ... (3 Replies)
Discussion started by: yan1
3 Replies

2. Programming

Frequency percentage distribution histogram with R

I am new to R and would like to calculate the percentage frequency distribution of h1 and h2. How can I combine h1 and h2 in one plot? I tried the following code. h1=c(5.18,4.61,3.30,7.58,3.00,3.80,1.95,2.67,2.77,2.73,2.33,3.36,3.50,1.91,4.25,3.87,2.86,2.26,2.00,3.86,3.33,3.59,4.00)... (0 Replies)
Discussion started by: ayyappa342
0 Replies

3. UNIX for Dummies Questions & Answers

Help with xmgrace histogram

Hi All, I am new to Grace and would like to plot histograms. My input files have one column for frequencies and another column for distances, for example: 1 2.6 4 2.7 5 2.8 2 3.9 2 4.0 4 4.7 4 4.8 4 4.9 ... I want to plot a histogram ranging from 0 to 10 with... (0 Replies)
Discussion started by: sxiong
0 Replies

4. Shell Programming and Scripting

awk for histogram

I have a single file that looks like this: 1.62816 1.62816 0.86941 0.86941 0.731465 0.731465 1.03174 1.03174 0.769444 0.769444 0.981181 0.981181 1.14681 1.14681 1.00511 1.00511 1.20385 1.20385 (2 Replies)
Discussion started by: kayak
2 Replies

5. UNIX for Dummies Questions & Answers

Output all files fitting the pattern

Hi there I need to create 1 line pipe that outputs list of files whose second character is digit in reverse order (file is a directory and called /tmp)the way I did ls /tmp | grep '^.]*' | sort -r dunno it does not seem working. I tried to do it with another directory that I am sure contain a... (8 Replies)
Discussion started by: FUTURE_EINSTEIN
8 Replies

6. Shell Programming and Scripting

AWK counting interval / histogram data

My data looks like this: frame phi psi 0 68.466774 -58.170494 1 75.128593 -51.646816 2 76.083946 -64.300102 3 77.578056 -76.464218 4 63.180199 -76.067680 5 77.203979 -58.560757 6 66.574913 -60.000214 7 73.218269 -70.978203 8 70.956879 -76.096558 9 65.538872 -76.716568... (19 Replies)
Discussion started by: chrisjorg
19 Replies

7. UNIX for Dummies Questions & Answers

Fitting a range of data

Hi, I am able to write an awk program that fits using the chi squared minimization method for each number is a data column... but I am wondering if it is possible to do that for a range of numbers at the same time. If I have a column for the observed data... and then say 10 columns for... (13 Replies)
Discussion started by: cosmologist
13 Replies

8. UNIX for Dummies Questions & Answers

histogram or counter

Dear all, I have numerous dat files (a.dat, b.dat...) containing 500 numeric values each. I would like to count them, based on their range and obtain a histogram or a counter. INPUT: a.dat 1.3 2.16 0.34 ...... b.dat 1.54 0.94 3.13 ..... ... (2 Replies)
Discussion started by: chen.xiao.po
2 Replies

9. UNIX for Dummies Questions & Answers

gnuplot easy histogram

hello experts, I have been trying to plot a histogram of a data like; -54 -56 -43 -65 -67 -78 ... I have 156.000 rows of these kind of values between 0 and -100. I just want to make x axis takes values 5 spacing in between like; -100 -95 -90 .............. 0 And I want y... (4 Replies)
Discussion started by: enes71
4 Replies

10. UNIX for Dummies Questions & Answers

Fitting data in gnuplot with xyerrorbars

I was looking at the examples that show how to fit data using gnuplot (ex: gnuplot / misc (2E)) but I can't find a place that shows what to do if I have ranges for the x and y error bars. I tried the common sense: gnuplot> fit f(x) "data.txt" using 3:6:4:5:7:8 via a,b ... (8 Replies)
Discussion started by: cosmologist
8 Replies
Login or Register to Ask a Question