Gnuplot 如何为一个具有多个参数的函数绘制多个曲线图?

Gnuplot 如何为一个具有多个参数的函数绘制多个曲线图?,gnuplot,Gnuplot,假设我的高度压力函数是: P(h) = p0 * exp(-h/scale) 我想为不同的行星画一组图;相同的图形(画布),但不同的p0和scale参数,每个行星一对(加上行星名称) 我是否必须输入“multiplot”并重新分配scale=和p0=,然后才能为每一组参数调用相同的plot p(h) p0 = "1 2 3 4" scale = "0.1 0.2 0.3 0.4" planets = "First Second Third Fourth" P(h, n) = (1.0*wo

假设我的高度压力函数是:

 P(h) = p0 * exp(-h/scale)
我想为不同的行星画一组图;相同的图形(画布),但不同的
p0
scale
参数,每个行星一对(加上行星名称)


我是否必须输入“multiplot”并重新分配
scale=
p0=
,然后才能为每一组参数调用相同的
plot p(h)

p0 = "1 2 3 4"
scale = "0.1 0.2 0.3 0.4"
planets = "First Second Third Fourth"

P(h, n) = (1.0*word(p0, n)) * exp(-h/(1.0*word(scale, n)))
plot for [i=1:words(planets)] P(x, i) title word(planets, i)
1.0*
用于将各个字符串“转换”为数字。丑陋,但有效。如果您想让它更简洁,可以定义函数
p0
scale
,根据迭代参数返回一个数字

p0(n) = (n==1 ? 1 : n==2 ? 2 : n==3 ? 3 : 4)
scale(n) = (n==1 ? 0.1 : n==2 ? 0.2 : n==3 ? 0.3 : 0.4)
P(h, n) = p0(n)*exp(-h/scale(n))
plot for [i=1:words(planets)] P(x, i) title word(planets, i)

事实上,我选择了混合方法<代码>p0(n)=1.0*字(p0\u w,n)