Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are two other options:

1) Use the Heaviside function:

f(x)=heaviside(x-1)-heaviside(x-3)
plot(f(x),(x,0,5))

2) define a Python function

def f(x,a,b):
    if x>a and x<b:
        return(1)
    else:
        return(0)

plot(lambda x: f(x,1,3),(x,-3,5))