%% Change Value of Heaviside Function at Origin
% The default value of the Heaviside function at the origin is 1/2.

H = heaviside(sym(0))

% Other common values for the Heaviside function at the origin are 0 and 1. To change the value of heaviside at the origin, use sympref to set the value of the 'HeavisideAtOrigin' preference. Store the previous parameter value returned by sympref, so that you can restore it later.

oldparam = sympref('HeavisideAtOrigin',1);

% Check the new value of heaviside at 0.

H = heaviside(sym(0))

% The preferences set by sympref persist throughout your current and future MATLAB® sessions. To restore the previous value of heaviside at the origin, use the value stored in oldparam.

sympref('HeavisideAtOrigin',oldparam);

% Alternatively, you can restore the default value of 'HeavisideAtOrigin' by using the 'default' setting.

sympref('HeavisideAtOrigin','default');

%
% Copyright 2006-2019 The MathWorks, Inc.