#!/usr/local/bin/gnuplot -persist
# set terminal pngcairo  transparent enhanced font "arial,10" fontscale 1.0 size 600, 400 
# set output 'array.3.png'
set key title "after fit" center
unset parametric
set xtics border in scale 1,0.5 nomirror norotate  autojustify
set title "Fit function to values stored in an array" 
set xrange [ * : * ] noreverse writeback
set x2range [ * : * ] noreverse writeback
set yrange [ * : * ] noreverse writeback
set y2range [ * : * ] noreverse writeback
set zrange [ * : * ] noreverse writeback
set cbrange [ * : * ] noreverse writeback
set rrange [ * : * ] noreverse writeback
set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front  noinvert bdefault
set fit nologfile brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
NO_ANIMATION = 1
array Sum[20] = [,,,,132551.0,218066.0,363446.0,2441994.0,570452.0,1191986.0,4787900.0,250579.0,473705.0,,,,,,,]
STATS_records = 8
STATS_invalid = 1
STATS_headers = 0
STATS_blank = 0
STATS_blocks = 1
STATS_outofrange = 0
STATS_columns = 24
STATS_mean = 59213.125
STATS_stddev = 58379.6753361936
STATS_ssd = 62410.498131181
STATS_skewness = 1.19286863699748
STATS_kurtosis = 3.43067488290353
STATS_adev = 45898.375
STATS_mean_err = 20640.3321568458
STATS_stddev_err = 14594.9188340484
STATS_skewness_err = 0.866025403784439
STATS_kurtosis_err = 1.73205080756888
STATS_sum = 473705.0
STATS_sumsq = 55315045317.0
STATS_min = 4740.0
STATS_max = 190505.0
STATS_median = 44665.0
STATS_lo_quartile = 12792.0
STATS_up_quartile = 81773.0
STATS_index_min = 4
STATS_index_max = 1
array A[100] = [0.0850362636267646,0.138668046501166,0.240980220381082,0.3312607077477,0.316817966632536,0.466234692064718,0.482554479366472,0.533352615904967,0.559527644509419,0.654023960582895,0.660229123738849,0.752184148926526,0.753394919663811,0.859996599991983,0.885435900956442,0.933347041120697,0.95423485945779,0.973891416144002,1.00800075730069,0.961330483126975,0.992593114165772,1.05891246915703,1.01873905582889,1.02612963116277,1.06940466677158,1.02656875447722,1.05061056952683,0.982909159749507,1.06118277637573,1.01953487525507,1.02363563845912,0.946271942953646,0.962962760812359,0.890301075049094,0.821582696279568,0.830600532342226,0.777945997028944,0.777267296301223,0.662137417134087,0.647231081256548,0.598358503534245,0.555138329612926,0.447771843456855,0.418813896839086,0.342014392639103,0.327102229306648,0.246551652407449,0.21706370828246,0.12257296336318,0.0859169437957079,-0.0277719511968892,-0.0725943509754872,-0.150628009623008,-0.18908495295506,-0.301560050315137,-0.31940262745372,-0.374345799177169,-0.386674637781836,-0.486303480331371,-0.563512308138807,-0.587342928433972,-0.591821424664302,-0.658887975918265,-0.755490323134804,-0.752002565208069,-0.778842216642055,-0.833719139087535,-0.813841345124631,-0.884057209064273,-0.92712549741281,-0.89132372876573,-0.958337528280604,-0.942553285327497,-0.925763816217593,-0.974366848229344,-0.937417789793499,-0.934423537515066,-0.906879229788984,-0.884448956612347,-0.92346532406631,-0.910933747068837,-0.829934508393742,-0.801317056811785,-0.801142104297107,-0.775036516688814,-0.709864807261295,-0.655425509137385,-0.618937004777872,-0.540797419395498,-0.530190077865709,-0.453971691306098,-0.391564773510953,-0.407404701334656,-0.355724502711509,-0.221934596350434,-0.233903860838782,-0.186658474361653,-0.0682289062937528,0.034553816736702,0.0102017783398309]
a = -1.5738417304267
c = 0.0537485812503008
b = 0.0628586641033944
FIT_CONVERGED = 1
FIT_NDF = 97
FIT_STDFIT = 0.0273627685239023
FIT_WSSR = 0.0726259468253881
FIT_P = 1.0
FIT_NITER = 7
a_err = 0.007443996367925
b_err = 0.000124722069027756
c_err = 0.00273705298866697
## Last datafile plotted: "@@"
plot A with points title "Array A", c+cos(a+b*x) with lines
## fit c+cos(a+b*x) A using 1:2 via a,b,c