 function ydot=wilson(t,y,flag,I_ext,g,E,tau)
 % odefile for wilson equations
 % parameters of the model; 1=K,R;  2=Ca,T;  3=KCa,H; 4=Na;

   V=y(4); y3=y(1:3);

   x0(1)=1.24  +  3.7*V + 3.2*V^2;
   x0(2)=4.205 + 11.6*V + 8  *V^2;
   x0(3)=3*y(2);

   x0=x0';

   ydot=tau.*(x0-y3);

   y3(4)=17.8  + 47.6*V +33.8*V^2;

   I=g.*y3.*(y(4)-E);
   ydot(4)=I_ext-sum(I);
 return
