1

i´m plotting a Dataset and performed two linear fit on the resulting graph. I plotted the results and got a graph with two straight lines. The two lines run from one end of the plot to the other. Do somebody know how to restrain the plot of the lines to a certain interval.

For example: the line of the first fit runs from x=800:1100 and the line of the second fit runs from x=900:1600.

The parameters of the whole plot are y= -2:9; x= 800:1600

4

1 回答 1

1

您可以使用 gnuplot 忽略像 1/0 这样的表达式并定义一种指示函数的事实:

f1(x) = 2.0*x + 1.0
f2(x) = x/3.0 + 2.0
ind(x, A, B) = 1.0/((x>A)*(x<B))

plot [800:1600] f1(x)*ind(x, 800, 1100), f2(x)*ind(x, 900, 1600)
于 2013-06-16T15:16:14.407 回答