www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/PlotSignumFunctionExample.m

    %% Plot Sign Function
% Plot the sign function and show its behavior at the zero-crossing. Use
% |eps| to represent values just above and below |0|.

% Copyright 2015 The MathWorks, Inc.

x = [-5 -eps(1) 0 eps(1) 5];
y = sign(x);
plot(x,y)
ylim([-2 2])
grid on