f(x) = 1 for -0.5

How about this

x = linspace(-10, 10, 1000);
fx = ( x > -0.5 ) & ( x < 0.5 );
figure;
plot( x, fx );

Leave a Comment