Blog: Comparing Shock Models: errorplot.p

File errorplot.p, 3.7 KB (added by ehansen, 12 years ago)
Line 
1# Gnuplot script file for plotting percent relative error of shock data
2# This file is called errorplot.p
3set autoscale
4unset log
5unset label
6set xtic auto
7set ytic auto
8set xlabel "Distance Behind Shock [cu]"
9set ylabel "Values (dens in 100 cm^-3, temp in 10^4 K)"
10set xr [0.0:0.9]
11set yr [0.01:500.0]
12set ytics (0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500)
13set terminal png
14set pointsize 0.5
15set logscale y
16set key outside right
17
18#rhoE(x) = a*x**8 + b*x**7 + c*x**6 + d*x**5 + e*x**4 + f*x**3 + g*x**2 + h*x + i + r*x**9 + s*x**10
19#rhoA(x) = a1*x**8 + b1*x**7 + c1*x**6 + d1*x**5 + e1*x**4 + f1*x**3 + g1*x**2 + h1*x + i1 + r1*x**9 + s1*x**10
20#tempE(x) = aa*x**8 + bb*x**7 + cc*x**6 + dd*x**5 + ee*x**4 + ff*x**3 + gg*x**2 + hh*x + ii + rr*x**9 + ss*x**10
21#tempA(x) = aa1*x**8 + bb1*x**7 + cc1*x**6 + dd1*x**5 + ee1*x**4 + ff1*x**3 + gg1*x**2 + hh1*x + ii1 + rr1*x**9 + ss1*x**10
22#XE(x) = aaa*x**8 + bbb*x**7 + ccc*x**6 + ddd*x**5 + eee*x**4 + fff*x**3 + ggg*x**2 + hhh*x + iii + rrr*x**9 + sss*x**10
23#XA(x) = aaa1*x**8 + bbb1*x**7 + ccc1*x**6 + ddd1*x**5 + eee1*x**4 + fff1*x**3 + ggg1*x**2 + hhh1*x + iii1 + rrr1*x**9 + sss1*x**10
24
25#FIT_LIMIT=1.e-14
26#fit rhoE(x) 'v50_shock.dat' index 0 using 1:2 via a, b, c, d, e, f, g, h, i, r, s
27#fit rhoA(x) 'v50_shock.dat' index 3 using 1:2 via a1, b1, c1, d1, e1, f1, g1, h1, i1, r1, s1
28#fit tempE(x) 'v50_shock.dat' index 1 using 1:2 via aa, bb, cc, dd, ee, ff, gg, hh, ii, rr, ss
29#fit tempA(x) 'v50_shock.dat' index 4 using 1:2 via aa1, bb1, cc1, dd1, ee1, ff1, gg1, hh1, ii1, rr1, ss1
30#fit XE(x) 'v50_shock.dat' index 2 using 1:2 via aaa, bbb, ccc, ddd, eee, fff, ggg, hhh, iii, rrr, sss
31#fit XA(x) 'v50_shock.dat' index 5 using 1:2 via aaa1, bbb1, ccc1, ddd1, eee1, fff1, ggg1, hhh1, iii1, rrr1, sss1
32
33# plot the percent relative errors
34#set output "v50_errors1.png"
35#plot [x=0:0.9] 100*abs(rhoE(x)-rhoA(x))/rhoA(x) with lines lc rgb "blue" title "rho", \
36# 100*abs(tempE(x)-tempA(x))/tempA(x) with lines lc rgb "red" title "temp", \
37# 100*abs(XE(x)-XA(x))/XA(x) with lines lc rgb "black" title "Xh"
38
39
40# plot the data
41set output "v30_shock.png"
42set title "vs = 30 km/s"
43plot 'v30_shock.dat' index 0 using 1:2 with lines lc rgb "blue" lt "dashed" title "rho (E)", 'v30_shock.dat' index 3 using 1:2 with lines lc rgb "blue" title "rho (A)", \
44 'v30_shock.dat' index 1 using 1:2 with lines lc rgb "red" lt "dashed" title "temp (E)", 'v30_shock.dat' index 4 using 1:2 with lines lc rgb "red" title "temp (A)", \
45 'v30_shock.dat' index 2 using 1:2 with lines lc rgb "black" lt "dashed" title "X (E)", 'v30_shock.dat' index 5 using 1:2 with lines lc rgb "black" title "X (A)"
46
47set output "v50_shock.png"
48set title "vs = 50 km/s"
49plot 'v50_shock.dat' index 0 using 1:2 with lines lc rgb "blue" lt "dashed" title "rho (E)", 'v50_shock.dat' index 3 using 1:2 with lines lc rgb "blue" title "rho (A)", \
50 'v50_shock.dat' index 1 using 1:2 with lines lc rgb "red" lt "dashed" title "temp (E)", 'v50_shock.dat' index 4 using 1:2 with lines lc rgb "red" title "temp (A)", \
51 'v50_shock.dat' index 2 using 1:2 with lines lc rgb "black" lt "dashed" title "X (E)", 'v50_shock.dat' index 5 using 1:2 with lines lc rgb "black" title "X (A)"
52
53set output "v80_shock.png"
54set title "vs = 80 km/s"
55plot 'v80_shock.dat' index 0 using 1:2 with lines lc rgb "blue" lt "dashed" title "rho (E)", 'v80_shock.dat' index 3 using 1:2 with lines lc rgb "blue" title "rho (A)", \
56 'v80_shock.dat' index 1 using 1:2 with lines lc rgb "red" lt "dashed" title "temp (E)", 'v80_shock.dat' index 4 using 1:2 with lines lc rgb "red" title "temp (A)", \
57 'v80_shock.dat' index 2 using 1:2 with lines lc rgb "black" lt "dashed" title "X (E)", 'v80_shock.dat' index 5 using 1:2 with lines lc rgb "black" title "X (A)"