%% Create a Fan Plot Using Table Data
% Create table of historical dates and data.

historicalDates = datetime(2006:2010,1,1)';
historicalData = [-0.0110;0.0120;0.0090;0.0120;0.0150];
historical = table(historicalDates,historicalData,'VariableNames',{'Dates','Data'});

%
% Create table of forecast dates and data.

forecastDates = datetime(2011:2015,1,1)';
forecastData =      [0.0203      -0.0155    0.0311     -0.0026     0.0035    0.0049      0.0026    0.0298    -0.0212     0.0128    ...
                     0.0533      0.0139     0.0037     -0.0727     -0.0291   -0.0058     0.0183    0.0490    0.0072      -0.0604;
                     0.0430      -0.0094    0.0587     0.0095      0.0185    0.0205      0.0172    0.0569    -0.0177     0.0320    ...
                     0.0141      0.0337     0.0187     0.0132      -0.0292   0.0048      0.0400    0.0126    0.0239      0.0124;
                     0.0518      -0.0116    0.0708     0.0112      0.0221    0.0246      0.0205    0.0686    -0.0217     0.0385    ...
                     0.0168      0.0405     0.0224     0.0157      -0.0356   0.0056      0.0482    0.0150    0.0286      0.0148;
                     0.0546      -0.0171    0.0762     0.0088      0.0210    0.0239      0.0193    0.0737    -0.0285     0.0396    ...
                     0.0151      0.0419     0.0214     0.0139      -0.0442   0.0024      0.0506    0.0130    0.0284      0.0128;
                     0.0565      -0.0207    0.0797     0.0072      0.0203    0.0234      0.0185    0.0770    -0.0329     0.0404    ...
                     0.0139      0.0428     0.0207     0.0126      -0.0499   0.0026      0.0522    0.0117    0.0283      0.0115];
forecast = [table(forecastDates,'VariableName',{'Dates'}),array2table(forecastData)];

%
% Plot the data using fanplot.

fanplot(historical,forecast);

% Copyright 2012 The MathWorks, Inc.