-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_global.m
93 lines (73 loc) · 3.13 KB
/
load_global.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
% This function initializes the parameters for the model and sets initial
% values for the variables. Parmeters and initial conditions are data set
% specific.
function [x0, Init, low, hi] = load_global(data)
global DIFF_INC ODE_TOL
global Rav Rmv
ODE_TOL = 1e-8; %ODE solving tolerance
DIFF_INC = 1e-4; %square root of the ODE tolerance - used for sensitivity analysis and optimiation
tdata_per = data.t_per;
Vdata = data.V;
Pdata = data.P;
VlvM = mean(data.VMax); % Left ventricular max volume FROM DATA
Vlvm = mean(data.Vmin); % Left ventricular min volume FROM DATA
plvM = mean(data.PMax); % Left ventricular max pressure FROM DATA
plvm = mean(data.Pmin); % Left ventriular min pressure FROM DATA
Weight = 339; % Weight in grams - Rat 12 - THIS IS NOT CONTAINED IN THE data STRUCT - NEEDS TO MANUALLY ENTERED HERE
HR = round(1./mean(diff(tdata_per))) ;% beats/sec form data
Vstr = VlvM-Vlvm; % ul/beat VlvM - Vlvm from data
TotalVol = 57*Weight; % microliter [57 ml/kg = microliter/g] (weight e.g. 285g FROM DATA)
TotFlow = HR*Vstr; % HR * Stroke Volume
% Flows (related to subject)
qao = TotFlow; % flow through aortic arch to systemic arteries
qvc = TotFlow; % flow through vena cava to heart
qa = TotFlow; % flow through systemic arteris
qs = TotFlow; % flow from systemic arteris to systemic veins
qv = TotFlow; % flow from veins to vena cava
% Pressures (related to subject)
plv = plvM; % Left ventricle pressure
pao = plv*.99; % Aortic arch pressure
psa = pao*.99; % systemic arterial pressure
pvc = plvm*1.1; % Pressure in Vena Cave
psv = pvc *1.1; % Systemic Vein Pressure
paod = pao-30; % diasoltic aortic pressure
psad = psa-30; % diasoltic systemic artery pressure
paom = paod + 1/3*(pao-paod); % mean aortic pressure
psam = psad + 1/3*(psa-psad); % mean systemic artery pressure
% Resistances (Ohm's law)
Rs = (psam - psv)/qs;
Ra = (paom - psam)/qa;
Rv = (psv - pvc)/qv;
Rav = (plvM - pao)/qao;
Rmv = (pvc - plvm)/qvc;
% Volumes (Beneken and deWit)
Vsa = TotalVol*0.20;
Vsv = TotalVol*0.70;
Vvc = TotalVol*0.075;
Vao = TotalVol*0.025;
%stressed volumes (systole)
VsaS = Vsa*0.3;
VsvS = Vsv*0.3;
VvcS = Vvc*0.3;
VaoS = Vao*0.3;
% Elastances (Beneken)
Eao = pao/VaoS; %
Esa = psa/VsaS; %
Esv = psv/VsvS; %
Evc = pvc/VvcS; %
% Ventricle parameters
% Average of all segments - these values were determined by inspection
Tsf = 0.25; % Time fraction for systolic phase, increasing elasticity
Trf = 0.60; % Time fraction for Systolic phase, decreasing elasticity
Emin= pvc/VlvM; % Minimum elasticity of the heart [ plvm/(VlvM-Vd) ]
Emax= paod/Vlvm; % Maximum elasticity of the heart [ pao_diastole/(Vlvm-Vd) ] Pressure diastole estimated
% Initial conditions
Init = [VaoS VsaS VsvS VvcS VlvM];
% Parameter vector
x0 = [Ra Rs Rv...
Eao Esa Esv Evc...
Tsf Trf Emin Emax]'; %8-11
x0 = log(x0);
% Upper bound and lower bounds for optimization
hi = x0+log(20); % x0*20 (when not log)
low = x0-log(20); % x0/20 (when not log)