%% Plot Exponential Threshold Transitions
% Create smooth threshold transitions for the Australian to U.S. dollar exchange rate to model price parity.
% Load Australia/U.S. purchasing power and interest rates data set. Extract the log of the exchange rate EXCH from the table.

load Data_JAustralian
EXCH = DataTable.EXCH; 

% Consider a two state system where:
% State 1 occurs when the Australia dollar buys more than the US dollar (EXCH \ge 0).
% State 2 occurs when the US dollar buys more than the Australian dollar (EXCH <0).
% States are weighed more highly as the system deviates from parity (EXCH = 0).
% Create a threshold transition representing the system. To attribute a greater amount of mixing away from the threshold, specify a exponential transition function. Set the transition rate to 2.5.

tt = threshold(0,Type="exponential",Rates=2.5)

% Plot the threshold transition with the threshold data.

figure
ttplot(tt,Data=EXCH);

%
% Try improving the display by experimenting with the transition band width (Width name-value argument).

figure
ttplot(tt,Data=EXCH,Width=2);

%
% Plot the transition function.

figure
ttplot(tt,Type="graph");

%
% Copyright 2021 The MathWorks, Inc.