Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is there a bug in heaviside function?

Hi all, I have defined a function f = heaviside(x), and then ploted it over [-1,1]. It should plot 0 in [-1,0] and 1 in [0,1]. However, the plot I get is 1 over the whole domain [-1,1]. If I redefine f as f = heaviside(x-0.00000001) -i.e. shifted by a very small value- I get the expected plot. The same happens with unit step function. Is this a bug, or I am missing somthing?

click to hide/show revision 2
retagged

Is there a bug in heaviside function?

Hi all, I have defined a function f = heaviside(x), and then ploted it over [-1,1]. It should plot 0 in [-1,0] and 1 in [0,1]. However, the plot I get is 1 over the whole domain [-1,1]. If I redefine f as f = heaviside(x-0.00000001) -i.e. shifted by a very small value- I get the expected plot. The same happens with unit step function. Is this a bug, or I am missing somthing?