diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1202/CH22/EX22.3/22_3.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1202/CH22/EX22.3/22_3.sce')
-rwxr-xr-x | 1202/CH22/EX22.3/22_3.sce | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/1202/CH22/EX22.3/22_3.sce b/1202/CH22/EX22.3/22_3.sce new file mode 100755 index 000000000..d93f2d307 --- /dev/null +++ b/1202/CH22/EX22.3/22_3.sce @@ -0,0 +1,52 @@ + +clear +clc + +//Example 22.3 +disp('Example 22.3') + +//Parameters +p1=0.028735;p2=0.028344;p3=5.035E-5;V1=12;n=0.0926; +Ib=15;//basal +Gb=81; + +//Diet function +function D=D(t) + D=9*exp(-0.05*t); +endfunction + + +//ODE model +function ydot=model(t,y,U) + G=y(1);X=y(2);I=y(3); + Gdot=-p1*G-X*(G+Gb)+D(t); + Xdot=-p2*X+p3*I; + Idot=-n*(I+Ib)+U/V1; + ydot=[Gdot Xdot Idot]'; +endfunction + + +t=0:0.1:400;t0=0; +y0=[0 0 0]';//G,X,I are deviation variables + +U=0; +y = Gb+ode(y0, t0, t, list(model,U)) +subplot(3,1,1); +plot(t,y(1,:)); +xtitle("","Time(min)","Glucose (mg/L)") +legend("$U=0\ mU/min$") + +U=15; +y =Gb+ ode(y0, t0, t, list(model,U)) +subplot(3,1,2); +plot(t,y(1,:)); +xtitle("","Time(min)","Glucose (mg/L)") +legend("$U=15\ mU/min$") + +U=25; +y = Gb+ode(y0, t0, t, list(model,U)) +subplot(3,1,3); +plot(t,y(1,:)); +xtitle("","Time(min)","Glucose (mg/L)") +legend("$U=25\ mU/min$") + |