I'm trying to plot a piece wise defined function give by,
equation Implemented in gnuplot, like this,
h(x)=0
g(x)=(4/3)*(1-x**3)
plot h(x)*(x<0) + g(x)*(x>0)*(x<1) + h(x)*(x>1)
The problem is that the line that goes from h(x)
to g(x)
is not a vertical line, is a inclined one. I really need a vertical one.
How to fix it? plot
You mustn't have (mathematically speaking) a connecting line between the noncontinous parts, because that implies that there are actual function values there.
You should do this instead:
plot sample [:0] h(x) lc 1 title "f(x)", \
[0:1] g(x) lc 1 notitle, \
[1:] h(x) lc 1 notitle