Moe
Moe

Reputation: 331

Gnuplot - setting of xrange

How to set this xrange please to see the function g(x) as the gauss function? Thank you

c = 299792458
kB = 1.380649*10**(-23)
T = 10000
m_he = 6.64424*10**(-27)
nun_he = 4.55746e+14
nuth_he = (2*kB*T/m_he)**(0.5)
konst2 = 11e+12

g(x) = 1-konst2/((pi)**(0.5)*(nuth_he))*exp(-((x-nun_he)**2)/(nuth_he**2))

set xtics rotate by -90

set term pngcairo size 800,1200 enhanced font "Segoe UI,18"
set output "out.png"

set format y "%4.2sx10^{%T}"       
x0=4.55746e+14
set xrange [x0-0.00001e+14:x0+0.00001e+14]
plot g(x) with lines lw 2.5 linecolor rgb "medium-blue", "<echo '4.55746e+14 1'" with points ls 7 ps 2

Upvotes: 1

Views: 490

Answers (1)

theozh
theozh

Reputation: 25694

Please check the basics of the Gauss function. Basically, the factor σ determines the width of the peak (in your case nuth_he). So if you choose the range for example x0-3σ to x0+3σ you should nicely see your curve.

x0=4.55746e+14
set xrange [x0-nuth_he*3:x0+nuth_he*3]

However, what should this be?

"<echo '4.55746e+14 1'" with points ls 7 ps 2

Drawing a single point or line? But again, this will be orders of magnitudes different in y from your Gaussian curve. With this point or line in the same plot you won't see a peak or dip of your Gauss curve.

enter image description here

Upvotes: 2

Related Questions