Function borders in gnuplot

I want to build many limited functions in gnuplot. That is, plot x from 0 to 2 and x ^ 2 from 1 to 3 and show them together.

How do you build functions with different boundaries?

I know how to do a piecewise function, for example (x <1? X: x ** 2). This is not what I want to do.

+4
source share
1 answer
plot 0 <= x && x <= 2 ? x : 1/0, \ 1 <= x && x <= 3 ? x**2 : 1/0 

We need to determine what to do outside the desired range, so we just use the undefined function f(x)=1/0 1/0 so that nothing is displayed in these ranges.

+6
source

Source: https://habr.com/ru/post/1333423/


All Articles