-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSA04_obtain_ICs_ISO.m
68 lines (52 loc) · 1.7 KB
/
SA04_obtain_ICs_ISO.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
% main analyze beat
clear
close all
clc
%% Loading initial conditions
% load matrix all_ICs (columns: N state variables, rows: N trials)
load ICs_matrix_5000_120s_control, model_index = 2;
% columns: N state variables
% rows: N trials
%% Parameters
% load matrix all_parameters (columns: N parameters, rows: N trials)
load parameter_matrix_5000_0p26 % sigma 0.26
[N_trials N_par] = size(all_parameters);
%% Input parameters
Na_clamp = 0; % [0 for free Na, 1 for Na clamp]
if Na_clamp == 1
disp('Na clamped')
end
% Isoproterenol/Carbachol administration
ISO_CCh_flag = 1; % (0 for control, 1 for ISO, 2 for ACh)
V_prot = 0; % 0 for no stimulation
input = 0; % mV, for voltage-clamp protocol
par_block = ones(1,3); % differential block for NKA/NCX/LTCC
par_SA = ones(1,19); % -, for sensitivity analysis
p = [model_index Na_clamp ISO_CCh_flag V_prot input par_block par_SA];
if Na_clamp == 1
disp('Na clamped')
end
duration = 120e3;
tspan = [0 duration];
options = odeset('RelTol',1e-5,'MaxStep',1);
%% Run cycle
all_ICs_ISO = 0*all_ICs;
tic
parfor ii=1:N_trials
%for ii=1:100, % plot figure
X = sprintf('Run %d on %d',ii,N_trials); disp(X)
y0n = all_ICs(ii,:);
par_SA = all_parameters(ii,:); % 19 parameters
p = [model_index Na_clamp ISO_CCh_flag V_prot input par_block par_SA];
[t,y] = ode15s(@mouse_SAM_eccODEfile,tspan,y0n,options,p);
%all_ICs(ii,:) = y(end,:);
[~, mdp_index] = min(y(end-3000:end,37));
yfinal = y(mdp_index+(length(y(:,37))-3001),:);
all_ICs_ISO(ii,:) = yfinal;
end
all_ICs = all_ICs_ISO
% columns: N outputs
% rows: N trials
toc
%% Saving
%save ICs_matrix_5000_120s_ISO all_ICs % Control