set term png set size 1.8 set grid set out 'night.png' U = (12)*3600 V = (18)*3600 + 16*60 + 54 f(x) = a + x + (x > d ? b*(tan(c*((x-d)**2))**3) : 0) \ + (x > d+g ? f * (x-d-g)**2 : 0) \ a=-0.11 d=2.25 g = 0 b = 0.121061 c = 0.59466 f = 0.940319 Ad = 6.76001 Bd = 0.181864 Cd = 3.22308 Dd = 0.000125618 Ed = -1.09493e-06 Di(x) = atan((x+Ad)*Bd)*Cd + Dd*(x**2) + Ed*(x**3) # below -6: An = 7.84728 Bn = 0.283291 Cn = 1.52257 Dn = -0.00776427 En = -0.000215529 Ni(x) = atan((x+An)*Bn)*Cn + Dn*(x**2) + En*(x**3) set xdata time set format x "%H:%M" set title \ "log10 ( illuminance / 1 lx ) Kravi hora, Brno, \ from a PV panel from the last noon up to `date "+%A %Y-%m-%d %H:%M"`" set ylabel \ 'Reliable values below 3.6, i.e. 4000 lx' set xlabel 'UTC+2h (CEST)' plot [43200:129600] [-3:5.7] \ 'nnew' using (3600*(24+$1)+60*$2):($3) '%*19[^\n]%lf%*1[:]%lf%*45[^\n]%lf' title \ 'Sunset and Sun at -6, -12 and -18 degrees and vice versa' with impulses 2,\ 'nold' using (3600*($1)+60*$2):($3) '%*26[^\n]%lf%*1[:]%lf%*38[^\n]%lf' title \ '' with impulses 2,\ 'm.txt' using ($1<12 ? 3600*(24+$1)+60*$2 : 1/0) :\ ($5>-6 ? Di($5) - ($8 + 26.8)/2.5 : ($5>-20 ? Ni($5) - ($8 + 26.8)/2.5: 1/0)) title \ 'clear sky moonlight' with lines 1,\ 'm.txt' using ($1>11 ? 3600*($1)+60*$2 : 1/0) :\ ($5>-6 ? Di($5) - ($8 + 26.8)/2.5: ($5>-20 ? Ni($5) - ($8 + 26.8)/2.5: 1/0)) title \ '' with lines 1,\ 's.txt' using ($1>11 ? 3600*($1)+60*$2 : 1/0) :\ ($5>-6 ? Di($5) : Ni($5)) title \ 'clear sky sunlight' with lines 3,\ 's.txt' using ($1<12 ? 3600*(24+$1)+60*$2 : 1/0) :\ ($5>-6 ? Di($5) : Ni($5)) title \ '' with lines 3,\ 'night.txt' using ($1 +U) : (f( log10($2)+3.0)-2 ) \ title 'PV data' with lines 4 quit