%% Plot Discrete Threshold Transitions
% Create discrete threshold transitions at 0 and 2.

t = [0 2];
tt = threshold(t)

% tt is a threshold object.  The specified thresholds split the space into 3 states.
% Plot the threshold transitions.

ttplot(tt);

% ttplot graphs a gradient plot by default. The y-axis represents the value of the threshold variable z_t (currently undefined) and the state-space:
% The system is in state 1 when z_t <0.
% The system is in state 2 when 0\le z_t <2.
% The system is in state 3 when z_t \ge 2.
% Because the transitions are discrete, ttplot graphs the levels as lines—the regime switches abruptly when z_t crosses a threshold variable.
% Because z_t is undefined, x-axis is arbitrary. When you specify threshold variable data by using the Data name-value argument, the x-axis is the sample index.
% Copyright 2021 The MathWorks, Inc.