%% Evaluate Heaviside Function for Symbolic and Numeric Arguments
% The heaviside function returns 0, 1/2, or 1 depending on the argument value. If the argument is a floating-point number (not a symbolic object), then heaviside returns floating-point results.
% Evaluate the Heaviside step function for a symbolic input sym(-3). The function heaviside(x) returns 0 for x < 0.

H = heaviside(sym(-3))

% Evaluate the Heaviside step function for a symbolic input sym(3). The function heaviside(x) returns 1 for x > 0.

H = heaviside(sym(3))

% Evaluate the Heaviside step function for a symbolic input sym(0). The function heaviside(x) returns 1/2 for x = 0.

H = heaviside(sym(0))

% For a numeric input x = 0, the function heaviside(x) returns floating-point results.

H = heaviside(0)

%
% Copyright 2006-2019 The MathWorks, Inc.