% Filename: EcoSuccessionPlot.m
% M-file to
% - Print out a table showing landscape structure over time

% Enter the transfer matrix
T = [ 0.94 0.02 0.01 
      0.05 0.86 0.06
      0.01 0.12 0.93 ];
  
% Enter the initial state
x0 = [ 1 ; 0 ; 0 ];

% We will create a matrix x that has three columns.
% Each column will contain time series data for one class.
% Each row will correspond to a time step (t=0 to t=200) 
x = zeros(201,3);

x(1,:) = x0;       % Data for time step t = 0

% Use for loop to generate times series data
for t = 1:200
   x(t+1,:) = T^t * x0;  % Data for time step t
end

% Time series information for proportion underwater is
% in the first column
u = x(:,1);

% Time series information for proportion saturated but
% not underwater is in the second column
s = x(:,2);

% Time series information for proportion dry is in the
% third column
d = x(:,3);

% Generate plot
time = [0:200];
plot(time,u,'r-',time,s,'g-',time,d,'b-')
legend('u', 's', 'd')
xlabel('Time step t')
ylabel('Proportion of Wetlands')

