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.

Bilag B<br />

MATLAB kode til fit af data<br />

1 clear all; close all;<br />

2<br />

3 % Constrains <strong>for</strong> fmincon<br />

4 A = [ −1 0 ; 0 −1 ];<br />

5 B = [0; 0];<br />

6<br />

7 % Loading experimental data<br />

8 load('eks cor.mat')<br />

9 Data = STc99m/max(STc99m);<br />

10<br />

Listing B.1: fitdata.m<br />

11 %%%%%%%%%%%%%%%%%%%%%% Cobelli %%%%%%%%%%%%%%%%%%%%%%%%<br />

12 % Guess of initial value<br />

13 x0 = [0.18; 0.18]; % [k21; kempt]<br />

14 XC = fmincon(@Cfun,x0,A,B);<br />

15<br />

16 k21 = XC(1); % rate of grinding [1/min]<br />

17 kempt = XC(2); % rate of gastric emptying [1/min]<br />

18 kabs = 0.013; % rate constant of intestinal absorption [1/min]<br />

19<br />

20 q0 = [1; 0; 0]; % Initial condition<br />

21 [T,Q] = ode15s(@<strong>Model</strong>1,[0 400],q0,[],k21,kempt,kabs);<br />

22<br />

23 qsto1 = Q(:,1); % Mass of glucose in stommach in solid phase [g]<br />

24 qsto2 = Q(:,2); % Mass of glucose in stommach in liquid phase [g]<br />

25 qsto = qsto1 + qsto2;<br />

26 Qsto = qsto/max(qsto);

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

Saved successfully!

Ooh no, something went wrong!