gnuplot设置链接并设置非线性 [英] gnuplot set link and set nonlinear

查看:56
本文介绍了gnuplot设置链接并设置非线性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以详细说明 set非线性 set链接函数.这些主题的文档太简短了.具体来说,对于 set link ,为什么有必要拼出逆变换?(仅仅是因为gnuplot无法确定逆变换,还是有更深层次的原因?)如果作为逆,我确实提供了完全不同的函数(不是逆),该怎么办?

Can someone elaborate in more detail on the set nonlinear and set link functions. The documentation is too brief on those topics. Specifically, for set link, why is in necessary to spell out the inverse tranformation? (is it just because gnuplot does not have the capability to determine the inverse tranformation or is there any deeper reason?) What if as inverse I do provide a completely different function (not being an inverse)?

例如我假设在下面的示例中,至少一个图将是一条线,但并非如此,为了生成一条线,一个人需要绘制第三条命令

e.g. I would assume that in the following example, at least one plot would be a line but it is not, in order to produce a line, one needs to plot the third command

set xrange [0:5]
set link x2 via x**2 inverse sqrt(x)
plot x**2 axes x2y1
plot x**2 axes x1y1
plot sqrt(x) axes x2y1

这使我回到问题所在,即链接规范中逆函数的目的是什么.

This brings me back to the question, what is the purpose of the inverse in the link specification.

现在回到设置非线性,文档指出:通过将g(x)应用于隐藏轴坐标来映射沿可见轴的坐标.f(x)将可见轴坐标映射回至隐藏的线性轴."我不知道隐藏轴应该是什么,线性轴是什么.示例通过log10(x)倒数10 ** x 设置非线性x对我来说很有意义,但在文档中使用的术语范围内(我理解这种转换,但是我不知道它的作用是什么)隐藏的轴也在这里播放,在这种转换中也不需要逆运算.

Now back to set nonlinear, the documentation states: "Coordinates along the visible axis are mapped by applying g(x) to hidden axis coordinates. f(x) maps the visible axis coordinates back onto the hidden linear axis." I do not understand what the hidden axis is supposed to be and what is the linear axis. The example set nonlinear x via log10(x) inverse 10**x makes sense to me but not in the context of the terms used in documentation (I understand the transformation but I have no idea what role the hidden axis plays here, also, there is no need for the inverse in such a transformation).

最有趣的示例是轴断开的示例:

The most interesting example is the one with broken axis:

f(x) = (x <= 100) ? x : (x < 500) ? NaN : x-390
g(x) = (x <= 100) ? x : x+390
set xrange [0:1000] noextend
set nonlinear x via f(x) inverse g(x)
set xtics add (100,500)
plot sample [x=1:100] x, [x=500:1000] x

但是我一点也不了解(我了解函数定义,但在 nonlinear 功能的上下文中却不了解).在这个例子中,解释 set非线性和隐藏轴命名法可能是最有用的.

But I do not understand it at all (I understand the function definition but not in the context of the nonlinear feature). It might be probably most useful to explain the set nonlinear and the hidden axes nomenclature on this example.

首先我想绘制一个函数 f(x).假设 v(x)为从线性轴到可见轴的映射: v:L-> V l(x)为反之,即 l:V-> L ( L 应该与gnuplot中的 xrange 相对应).从答案中,我不了解 f(x)的计算方式.如果 f(x):X-> R (即从实数子集到实数的映射),那么 X 来自那些映射下.通常(没有链接轴或非线性轴)(并且认为 L = V v l 是身份映射), Y轴将包含数字{ y = f(x),这样 x 位于 V }中.

Let's say first I want to plot a function f(x). Let v(x) be a mapping from the linear to the visible axis: v:L->V and l(x) be the inverse, that is l:V->L (L should probably correspond to xrange in gnuplot). From the answer I did not understand how f(x) is calculated. If f(x): X->R (that is a mapping from some subset of Real numbers to real numbers), where does the X come from under those mappings. Normally (no linking or nonlinear axes) (and it holds that L=V and v and l are identity maps) the Y axis would contain numbers {y=f(x), such that x is in V}.

在非线性情况下,这变得有些混乱,换句话说, x 是来自 L V 空间,还是y = f(x)中的 x 来自已经转换的 X 轴的数字集合,实际上是 f(v(x)),其中 x 取自gnuplot(或空间 L )中设置的 xrange ,还是 f(x),其中 x 来自 L 还是 f(l(x))其中 x 再次从转换后的 X 轴获取,它实际上又是 f(l(v(x))) x 是从 L 空间还是 xrange ?而且,这与 set链接会有所不同,后者实际上对 f(x)的计算方式没有任何影响.(有趣的是,在绘制数据时,由于没有转换功能,这种情况可能需要与 set link 更相似.)

This becomes a little confusing in the nonlinear case, in other words do the x come form the L or V space, or are the x in y = f(x) from the set of numbers of already tranformed X axis which would really be f(v(x)) where x are taken from the xrange set in gnuplot (or space L), or is it really f(x), where x is from L or is it f(l(x)) where x are taken again from transformed X axis which really is again f(l(v(x))) x being from the L space or xrange? Also, this would be a difference from the set link which really cannot have any effect on how f(x) is calculated. (Interestingly enough, when plotting data the situation would probably need to be more similar to set link since there is no function to transform.)

推荐答案

1)为什么对于 set link ,您需要提供一个逆函数?你不知道如果只希望x1和x2(或y1和y1)具有相同的作用,那么只需说 set link x2 set link y2 而没有正向或反向转换功能就足够了

1) Why is it that for set link you need to provide an inverse function? You don't. If you just want x1 and x2 (or y1 and y1) to act identically then it is sufficient to say set link x2 or set link y2 with no forward or reverse transformation functions.

2)但是,如果要通过函数链接x1和x2,则需要同时提供正向和反向函数.将这些描述为描述tic tictic标签可能是最容易的.如果您说

2) However if you want to link x1 and x2 via a function you need to provide both the forward and inverse functions. It may be easiest to think of these as describing the axis tic labels. If you say

set tics nomirror
set x2tics
set link x2 via x**2 inv sqrt(x)
f(x) = x 
plot f(x)

您将看到,对于沿线的任何给定点,x1坐标将读取为x,x2坐标将读取为x ** 2.IE.正向函数用于计算沿x2轴的位置.为什么反函数?让我们假设您不是在上面说的 plot x 而是

You will see that for any given point along the line the x1 coordinate will read off as x and the x2 coordinate will read off as x**2. I.e. the forward function is used to calculate positions along the x2 axis. Why the inverse function? Let us suppose instead of plot x above you instead said

plot f(x) axes x2y1

这是相同的函数,f(x)= x,但是现在它是相对于x2轴绘制的.逆函数sqrt(x2 coord)用于生成x1轴坐标.换句话说,该函数沿x1是线性的,但是当您告诉程序针对x2进行绘制时,您会得到一个抛物线.在这种情况下,您可以同时看到x1和x2上的数字,因此很明显发生了什么.

This is the same function, f(x) = x, but now it is drawn relative to the x2 axis. The inverse function sqrt(x2 coord) is used to generate the x1 axis coordinate. In other words, the function is linear along x1 but when you tell the program to plot against x2 you get a parabola. In this case you can see the numbers along both x1 and x2 so it is obvious what is going on.

这有效地将x2定义为链接到线性伙伴x1的非线性轴.线性轴和非线性轴都是可见的.

This effectively defines x2 as a nonlinear axis, linked to a linear partner x1. Both the linear and nonlinear axes are visible.

3)这使我们能够通过sqrt(x)inv x ** 2 设置非线性x,这实际上与引擎盖下面的命令相同.我们翻转映射的方向性,以使x1现在是非线性末端.除了将x链接到沿x2轴的坐标之外,它还链接到沿未绘制的线性轴(隐藏"轴)的坐标.因此,现在针对x1进行绘制时,与在原始 set链接情况下针对x2进行绘制具有相同的效果.

3) This brings us to set nonlinear x via sqrt(x) inv x**2, which is really the same command as before underneath the hood. We flip the directionality of the mapping so that x1 is now the nonlinear end. Rather than linking x to coordinates along the x2 axis, it links to coordinates along a linear axis that is not drawn, the "hidden" axis. So now when we plot against x1 it we get the same effect as from plotting against x2 in the original set link case.

这篇关于gnuplot设置链接并设置非线性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆