function ss_cascade();
alpha=[10 2 3 0];
beta=[5 1.44 7.2 0];
g=zeros(4,4);
h=zeros(4,4);
g(1,2)=-0.1;
g(1,3)=-0.05;
g(1,4)=1;
g(2,1)=0.5;
g(3,2)=0.5;
h(1,1)=0.5;
h(2,2)=0.5;
h(3,3)=0.5;
p0=[0.2 0.5 0.1 0.75];
tspan = [0:0.2:8];
[t,p] = ode15s(@ode_ssys, tspan, p0,[],alpha,beta,g,h);
figure(1);
plot(t,p(:,1),'rs-');; 
hold on;
plot(t,p(:,2),'gd-');
plot(t,p(:,3),'ko-');
legend('X1','X2','X3');
xlabel('Time')
xlabel('Concentration')
title('A cascaded pathway');


function dp = ode_ssys(t,X,alpha,beta,g,h);
dp = zeros(length(alpha),1);   
for i=1:4   
  vplus=alpha(i); 
  for j=1:4
     vplus=vplus*X(j)^g(i,j);
  end
  vminus=beta(i);  
  for j=1:4
     vminus=vminus*X(j)^h(i,j);
  end
  dp(i)=vplus-vminus;
end
