An S-Function Exercise


    Build an S-Function for the following problem (remember that files executable in MATLAB must have a name ending in '.m', so if you wanted this s-function to be named 'srun', you would have to call the file 'srun.m')

    A neuron can be modeled by the following differential equations:

    dA/dt=-A/(Tau10+Tau11*A)*((k10+k11*A)/(Tau10+Tau11*A))*(B+u)
    dB/dt=-B/(Tau20+Tau21*B)*((k20+k21*B)/(Tau20+Tau21*B))*A
    
    At time=0, both A and B are equal to 0. The system output is A and the equation parameters are as follows:
    Tau10=0.0026				k10=-4.633e-04
    Tau11=0.00034458			k11=-3.6293e-05
    Tau20=-0.0031				k20=-2.2344e+03
    Tau21=1.4639e-06			k21=9.5473e-04
    

    We are interested in the system's response to a step input of magnitude 0.8 at time 0.5 sec. Construct a simulation using the Runge-Kutta 5 integrator starting at time 0, for 2 seconds duration. Allow the system to integrate with steps between 0.001 and 0.01, with a tolerance of 1e-5. Have two vectors sent to the workspace from your simulation. One should be time, the other, the system output, and make sure they have different names in the simulation window.

    If your vectors are named 'time' and 'output', plot the output as a function of time by typing 'plot(time,output)'. 'help plot' will provide more options.