26.07.2013 Views

Matematisk Model for Mavesækkens Tømning - Danmarks Tekniske ...

Matematisk Model for Mavesækkens Tømning - Danmarks Tekniske ...

Matematisk Model for Mavesækkens Tømning - Danmarks Tekniske ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

110 MATLAB kode til simulering af <strong>for</strong>søgsscenarie<br />

35 <strong>for</strong> t = 0:5:N−2<br />

36 if t == 0<br />

37 Xx = xss;<br />

38 end<br />

39 IV glu(t+1:t+5) = IV glu(t+1:t+5)+iv glu bolus;<br />

40 [tx,Gx,Ix,Xx] = Hovorka<strong>Model</strong>Simulation2Pancreas...<br />

41 (T(t+1):T(t+5),Xx,IV ins(t+1:t+5),IV glu(t+1:t+5),D(t+1:t+5),par);<br />

42 Xx = Xx(end,:)';<br />

43 if Gx > BS<br />

44 iv glu bolus = iv glu bolus − 0.5;<br />

45 elseif Gx < BS<br />

46 iv glu bolus = iv glu bolus + 0.5;<br />

47 end<br />

48 if iv glu bolus < 0<br />

49 iv glu bolus = 0;<br />

50 end<br />

51 Tx = [Tx; tx(1)];<br />

52 G = [G; Gx(1)];<br />

53 I = [I; Ix(1)];<br />

54 X = [X; Xx(1)];<br />

55 end<br />

56<br />

57 % Plot of glucose concentration in plasma.<br />

58 h = figure(1);<br />

59 subplot(221)<br />

60 plot([Tx(1) Tx(end)],[10 10],'r−',Tx,G,'b−','linewidth',2); grid;<br />

61 xlabel('time [min]','fontsize',14); ylabel('G (mmol/L)','fontsize',14)<br />

62 ylim([0 12]); xlim([Tx(1) Tx(end)]);<br />

63 text(60,10.5,'\downarrow','fontsize',14)<br />

64 hold on;<br />

65 fill([Tx(1) Tx(end) Tx(end) Tx(1)],...<br />

66 [70/par.MwG*10 70/par.MwG*10 140/par.MwG*10 140/par.MwG*10],...<br />

67 'g','facealpha',0.2)<br />

68 hold off<br />

69 set(get(h,'CurrentAxes'),'fontsize',14)<br />

70 legend('Target value of BS','Actual value of BS','Location','SouthEast')<br />

71<br />

72 % Plot of insulin concentration in plasma.<br />

73 subplot(222)<br />

74 plot(Tx,I,'b−','linewidth',2); grid;<br />

75 xlabel('time [min]','fontsize',14); ylabel('I (mU/L)','fontsize',14);<br />

76 xlim([Tx(1) Tx(end)])<br />

77 set(get(h,'CurrentAxes'),'fontsize',14)<br />

78<br />

79 % Plot of oral glucose load and iv glucose infusion.<br />

80 T=T/60;<br />

81 subplot(223)<br />

82 stairs(T,D,'b−','linewidth',2)<br />

83 hold on<br />

84 stairs(T,IV glu,'m−','linewidth',2); grid;<br />

85 xlabel('time [hr]','fontsize',14); ylabel('Glucose (g/min)','fontsize',14);<br />

86 xlim([T(1) T(end)]); ylim([0 32]);<br />

87 text(2.9,11,['Total glucose = ' num2str(sum(IV glu)) 'g'],'fontsize',12)<br />

88 set(get(h,'CurrentAxes'),'fontsize',14)<br />

89 legend('Meal','IV glucose','Location','SouthEast')

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!