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 ...

26.07.2013 Views

112 MATLAB kode til simulering af forsøgsscenarie 44 [tx,Gx,Ix,Xx] = HovorkaModelSimulation2Pancreas... 45 (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); 46 Xx = Xx(end,:)'; 47 if Gx > BS 48 iv glu bolus = iv glu bolus − 0.5; 49 elseif Gx < BS 50 iv glu bolus = iv glu bolus + 0.5; 51 end 52 if iv glu bolus < 0 53 iv glu bolus = 0; 54 end 55 Tx = [Tx; tx(1)]; 56 G = [G; Gx(1)]; 57 I = [I; Ix(1)]; 58 X = [X; Xx(1)]; 59 end 60 61 % Plot of glucose concentration in plasma. 62 h = figure(1); 63 subplot(221) 64 plot([Tx(1) Tx(end)],[2.5 2.5],'r−',Tx,G,'b−','linewidth',2); grid; 65 xlabel('time [min]','fontsize',14); ylabel('G (mmol/L)','fontsize',14); 66 ylim([0 10]); xlim([Tx(1) Tx(end)]); 67 text(60,6,'\downarrow','fontsize',14) 68 hold on; 69 fill([Tx(1) Tx(end) Tx(end) Tx(1)],... 70 [70/par.MwG*10 70/par.MwG*10 140/par.MwG*10 140/par.MwG*10],... 71 'g','facealpha',0.2) 72 hold off 73 set(get(h,'CurrentAxes'),'fontsize',14) 74 legend('Target value of BS','Actual value of BS','Location','NorthEast') 75 76 % Plot of insulin concentration in plasma. 77 subplot(222) 78 plot(Tx,I,'b−','linewidth',2); grid; 79 xlabel('time [min]','fontsize',14); ylabel('I (mU/L)','fontsize',14); 80 xlim([Tx(1) Tx(end)]); 81 set(get(h,'CurrentAxes'),'fontsize',14) 82 83 % Plot of oral glucose load and iv glucose infusion. 84 T=T/60; 85 subplot(223) 86 stairs(T,D,'b−','linewidth',2) 87 hold on 88 stairs(T,IV glu,'m−','linewidth',2); grid; 89 xlabel('time [hr]','fontsize',14); ylabel('Glucose (g/min)','fontsize',14); 90 xlim([T(1) T(end)]); ylim([0 8]); 91 text(2.9,5,['Total glucose = ' num2str(sum(IV glu)) 'g'],'fontsize',12) 92 set(get(h,'CurrentAxes'),'fontsize',14) 93 legend('Meal','IV glucose','Location','NorthEast') 94 95 % Plot of insulin infusion. 96 subplot(224) 97 stairs(T,IV ins,'b−','linewidth',2); grid; 98 xlabel('time [hr]','fontsize',14);

99 ylabel('Insulin infusion (mU/min)','fontsize',14); 100 xlim([T(1) T(end)]); ylim([0 41]); 101 set(get(h,'CurrentAxes'),'fontsize',14) 113

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

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

45 (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 />

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

47 if Gx > BS<br />

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

49 elseif Gx < BS<br />

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

51 end<br />

52 if iv glu bolus < 0<br />

53 iv glu bolus = 0;<br />

54 end<br />

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

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

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

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

59 end<br />

60<br />

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

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

63 subplot(221)<br />

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

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

66 ylim([0 10]); xlim([Tx(1) Tx(end)]);<br />

67 text(60,6,'\downarrow','fontsize',14)<br />

68 hold on;<br />

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

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

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

72 hold off<br />

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

74 legend('Target value of BS','Actual value of BS','Location','NorthEast')<br />

75<br />

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

77 subplot(222)<br />

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

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

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

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

82<br />

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

84 T=T/60;<br />

85 subplot(223)<br />

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

87 hold on<br />

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

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

90 xlim([T(1) T(end)]); ylim([0 8]);<br />

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

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

93 legend('Meal','IV glucose','Location','NorthEast')<br />

94<br />

95 % Plot of insulin infusion.<br />

96 subplot(224)<br />

97 stairs(T,IV ins,'b−','linewidth',2); grid;<br />

98 xlabel('time [hr]','fontsize',14);

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

Saved successfully!

Ooh no, something went wrong!