File: fit.ft

package info (click to toggle)
fudgit 2.42-6
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 2,468 kB
  • ctags: 2,375
  • sloc: ansic: 27,729; makefile: 793; yacc: 724; lex: 102; asm: 29; fortran: 15
file content (61 lines) | stat: -rw-r--r-- 1,607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Play safe
free @all
###################################################
# Simple straight line fit example
###################################################

# First load gnuplot macros (should be your .fudgitrc)
# that will be used below.
load fudgitrc
# Read in the following numbers in vectors X and Y:
read - X:1 Y:2
0.050000        -8.3435253e-15
0.100000        -7.3682587e-08
0.150000        -2.62540725e-05
0.200000        -0.000495454499
0.250000        -0.00288394212
0.300000        -0.00930746938
0.350000        -0.0214061842
0.400000        -0.0397837034
0.450000        -0.06410238
0.500000        -0.0934515401
0.550000        -0.126705137
0.600000        -0.162760493
0.650000        -0.2006568
0.700000        -0.239611356
0.750000        -0.279012309
0.800000        -0.318394131
0.850000        -0.357409756
0.900000        -0.395805282
0.950000        -0.433398977
1.000000        -0.470064566
1.050000        -0.505718175
1.100000        -0.540308208
end
# Transform first column to -1/(first column)
let X = -1/X
# Take the ln(-1/Y) of the second column
let Y = ln(-1/Y)
# Fit a straight line
set function straight
# Using least square regression
set method ls_reg
# We need 2 parameters, called them, say, A[1] and A[2].
set parameter A 2
# Do the fit:
fit X Y
# Show results:
echo
echo Fit results: A[1] + A[2]*X
show parameters
# Start a new plot
ResetPlot
# Give some titles and labels
title "A fit example"
xlabel "-1/T"
ylabel "ln(tau)"
# Plot data points with a key:
tpplot X Y "experimental"
# Plot fit to it using a solid line and a key:
tlplot X YFIT "This is the fit"