pause 0  ""
pause 0  ""
pause -1 "Now an example how to fit multi-branch functions  (-> return)"
plot 'soundvel.dat'
pause 0  "The model consists of two branches, the first describing longitudinal"
pause 0  "sound velocity as function of propagation direction (upper data),"
pause 0  "the second describing transverse sound velocity (lower data)."
pause 0  ""
pause 0  "The model uses these data in order to fit elastic stiffnesses"
pause 0  "which occur differently in both branches."
pause 0  ""
pause -1 "(-> return)"
load 'hexa.fnc'
load 'sound.par'
plot 'soundvel.dat', vlong(x), vtrans(x)
fit f(x) 'soundvel.dat' 'sound.par'
pause 0  ""
pause -1 "(-> return)"
plot 'soundvel.dat', vlong(x), vtrans(x)
pause 0  "Look at the file 'hexa.fnc' to see how the branches are realized"
pause 0  "using the internal variable FIT_INDEX"
pause 0  ""
pause 0  "Next we only use every fifth data point for fitting by setting the"
pause 0  "variable FIT_SKIP to 4. Look at the fitting-speed increase and at"
pause 0  "fitting result."
pause 0  ""
pause -1 "(-> return)"
load 'sound.par'
plot 'soundvel.dat', vlong(x), vtrans(x)
FIT_SKIP = 4
fit f(x) 'soundvel.dat' 'sound.par'
plot 'soundvel.dat', vlong(x), vtrans(x)
pause 0  "When you compare the results (see 'fit.log') you remark that"
pause 0  "the uncertainties in the fitted constants have become larger,"
pause 0  "the quality of the plot is only slightly affected."
pause 0  ""
pause 0  "By marking some parameters as '# FIXED' in the parameter file"
pause 0  "you fit only the others (c44 and c13 fixed here)."
pause 0  ""
pause -1 "(-> return)"
load 'sound2.par'
plot 'soundvel.dat', vlong(x), vtrans(x)
fit f(x) 'soundvel.dat' 'sound2.par'
plot 'soundvel.dat', vlong(x), vtrans(x)
pause 0  "This has the same effect as specifying only the real free"
pause 0  "parameters by the 'via' syntax."
pause 0  ""
pause 0  "fit f(x) 'soundvel.dat' via c33, c11, phi0"
pause 0  ""
pause -1 "(-> return)"
load 'sound.par'
plot 'soundvel.dat', vlong(x), vtrans(x)
fit f(x) 'soundvel.dat' via c33, c11, phi0
plot 'soundvel.dat', vlong(x), vtrans(x)
