Initial release of Maemo 5 port of gnuplot
[gnuplot] / demo / hexa.fnc
1 #
2 #   Use this function to fit sound velocity data as function of
3 #   sound propagation direction, indicated by its angle against the
4 #   z-axis of an hexagonal symmetry coordinate system
5 #
6 #   Adjustable parameters:
7 #
8 #   c33, c11, c13, c44          elastic moduli - materials constants
9 #   phi0                        angle offset
10 #
11 # HBB 970522: factored out common factor 1e9 from c?? into the
12 #  function, to improve the fit convergence. Fit parameters were
13 #  just too grossly different before.
14
15 rho         = 1000.0         # density in kg/m3
16
17 phi(x)      = (x - phi0)/360.0*2.0*pi
18
19 main(x)     = c11*sin(phi(x))**2 + c33*cos(phi(x))**2 + c44
20 mixed(x)    = sqrt( ((c11-c44)*sin(phi(x))**2                           \
21                     +(c44-c33)*cos(phi(x))**2)**2  \
22                    +(2.0*(c13+c44)*sin(phi(x))*cos(phi(x)))**2 ) 
23
24 vlong(x)    = sqrt(1.0/2.0/rho*1e9*(main(x) + mixed(x)))
25 vtrans(x)   = sqrt(1.0/2.0/rho*1e9*(main(x) - mixed(x)))
26
27 # When we read the file in, we set y=index, and we use
28 # y in this (pseudo) 3d fit to choose an x function
29
30 f(x,y)  =  y==1  ?  vlong(x)  :  vtrans(x)