Skip to content

Commit

Permalink
update model folder + updates for new AMICI
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian.froehlich committed Apr 11, 2016
1 parent 6b01c91 commit 79c4ecf
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 55 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

MEMfn
*.mat

*.m~

*.o

models/*
98 changes: 49 additions & 49 deletions complete_model.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@
[mdir,~,~]=fileparts(which(mfilename('full')));

%check for existence of directory
if(~exist(fullfile(mdir,'MEMfn',filename),'dir'))
mkdir(fullfile(mdir,'MEMfn',filename));
if(~exist(fullfile(mdir,'models',filename),'dir'))
mkdir(fullfile(mdir,'models',filename));
end

% remove old paths and add new paths
addpath(fullfile(mdir,'MEMfn',filename));
addpath(fullfile(mdir,'models',filename));

try
% check wheter the saved symbolic definition agrees with the current
% one
load(fullfile(mdir,'MEMfn',filename,'syms.mat'))
load(fullfile(mdir,'models',filename,'syms.mat'))
f_xi = isequaln(Model.sym.xi,syms.xi);
f_phi = isequaln(Model.sym.phi,syms.phi);
f_beta = isequaln(Model.sym.beta,syms.beta);
Expand All @@ -95,26 +95,26 @@
f_sigma_noiseexp(s) = isequaln(Model.exp{s}.sym.sigma_noise,expsyms{s}.sigma_noise);
f_sigma_timeexp(s) = isequaln(Model.exp{s}.sym.sigma_time,expsyms{s}.sigma_time);

f_files(s) = all([exist(fullfile(mdir,'MEMfn',filename,['MEMbeta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdelta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdbetadxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddeltadxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddbetadxidxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdddeltadxidxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMsigma_noise_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMds_ndp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdds_ndpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddds_ndpdpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMsigma_time_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMds_tdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdds_tdpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddds_tdpdpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMphi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdphidbeta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMdphidb_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddphidbdb_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddphidbetadbeta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'MEMfn',filename,['MEMddphidbdbeta_' filename '_' num2str(S(s))]),'file')]);
f_files(s) = all([exist(fullfile(mdir,'models',filename,['MEMbeta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdelta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdbetadxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddeltadxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddbetadxidxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdddeltadxidxi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMsigma_noise_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMds_ndp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdds_ndpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddds_ndpdpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMsigma_time_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMds_tdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdds_tdpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddds_tdpdpdp_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMphi_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdphidbeta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMdphidb_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddphidbdb_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddphidbetadbeta_' filename '_' num2str(S(s))]),'file'),...
exist(fullfile(mdir,'models',filename,['MEMddphidbdbeta_' filename '_' num2str(S(s))]),'file')]);
end

if(all([f_xi,f_phi,f_beta,f_b,f_delta,f_phiexp,f_sigma_noiseexp,f_sigma_timeexp,f_files]))
Expand All @@ -126,7 +126,7 @@
end
loadold = true;
disp(['Loading previous model definition files!'])
disp(['To regenerate model, abort and delete ' mdir 'MEMfn/' filename ]);
disp(['To regenerate model, abort and delete ' mdir 'models/' filename ]);
end
catch

Expand All @@ -141,7 +141,7 @@
for s = 1:length(Model.exp)
expsyms{s} = Model.exp{s}.sym;
end
save(fullfile(mdir,'MEMfn',filename,'syms.mat'),'syms','expsyms');
save(fullfile(mdir,'models',filename,'syms.mat'),'syms','expsyms');

% compute number of elements of xi and b
n_xi = length(Model.sym.xi);
Expand Down Expand Up @@ -192,40 +192,40 @@
% computational complexity even for relatively small models.

% beta(xi) delta(xi)
mfun(Model.exp{s}.sym.beta,'file',fullfile(mdir,'MEMfn',filename,['MEMbeta_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
mfun(Model.exp{s}.sym.beta,'file',fullfile(mdir,'models',filename,['MEMbeta_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
eval(['Model.exp{s}.beta = @MEMbeta_' filename '_' num2str(S(s)) ';']);
mfun(Model.exp{s}.sym.delta,'file',fullfile(mdir,'MEMfn',filename,['MEMdelta_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
mfun(Model.exp{s}.sym.delta,'file',fullfile(mdir,'models',filename,['MEMdelta_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
eval(['Model.exp{s}.delta = @MEMdelta_' filename '_' num2str(S(s)) ';']);

% dbetadxi
Model.exp{s}.sym.dbetadxi = simplify(jacobian(Model.exp{s}.sym.beta,Model.sym.xi));
mfun(Model.exp{s}.sym.dbetadxi,'file',fullfile(mdir,'MEMfn',filename,['MEMdbetadxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
mfun(Model.exp{s}.sym.dbetadxi,'file',fullfile(mdir,'models',filename,['MEMdbetadxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
eval(['Model.exp{s}.dbetadxi = @MEMdbetadxi_' filename '_' num2str(S(s)) ';']);

% ddeltadxi
Model.exp{s}.sym.ddeltadxi = simplify(jacobian(Model.exp{s}.sym.delta,Model.sym.xi));
mfun(Model.exp{s}.sym.ddeltadxi,'file',fullfile(mdir,'MEMfn',filename,['MEMddeltadxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
mfun(Model.exp{s}.sym.ddeltadxi,'file',fullfile(mdir,'models',filename,['MEMddeltadxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
eval(['Model.exp{s}.ddeltadxi = @MEMddeltadxi_' filename '_' num2str(S(s)) ';']);

% ddbetadxidxi
Model.exp{s}.sym.ddbetadxidxi = sym(zeros(n_beta,n_xi,n_xi));
for j = 1:n_beta
Model.exp{s}.sym.ddbetadxidxi(j,:,:) = simplify(hessian(Model.exp{s}.sym.beta(j),Model.sym.xi));
end
mfun(Model.exp{s}.sym.ddbetadxidxi,'file',fullfile(mdir,'MEMfn',filename,['MEMddbetadxidxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
mfun(Model.exp{s}.sym.ddbetadxidxi,'file',fullfile(mdir,'models',filename,['MEMddbetadxidxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
eval(['Model.exp{s}.ddbetadxidxi = @MEMddbetadxidxi_' filename '_' num2str(S(s)) ';']);

% ddeltadxidxi
Model.exp{s}.sym.dddeltadxidxi = sym(zeros(n_delta,n_xi,n_xi));
for j = 1:n_delta
Model.exp{s}.sym.dddeltadxidxi(j,:,:) = simplify(hessian(Model.exp{s}.sym.delta(j),Model.sym.xi));
end
mfun(Model.exp{s}.sym.dddeltadxidxi,'file',fullfile(mdir,'MEMfn',filename,['MEMdddeltadxidxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
mfun(Model.exp{s}.sym.dddeltadxidxi,'file',fullfile(mdir,'models',filename,['MEMdddeltadxidxi_' filename '_' num2str(S(s))]),'vars',{Model.sym.xi});
eval(['Model.exp{s}.dddeltadxidxi = @MEMdddeltadxidxi_' filename '_' num2str(S(s)) ';']);


% sigma_noise(phi)
mfun(Model.exp{s}.sym.sigma_noise,'file',fullfile(mdir,'MEMfn',filename,['MEMsigma_noise_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.sigma_noise,'file',fullfile(mdir,'models',filename,['MEMsigma_noise_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.sigma_noise = @MEMsigma_noise_' filename '_' num2str(S(s)) ';']);

% dsigma_noisedphi
Expand All @@ -235,7 +235,7 @@
Model.exp{s}.sym.dsigma_noisedphi(j,k,:) = jacobian(Model.exp{s}.sym.sigma_noise(j,k),phi);
end
end
mfun(Model.exp{s}.sym.dsigma_noisedphi,'file',fullfile(mdir,'MEMfn',filename,['MEMds_ndp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.dsigma_noisedphi,'file',fullfile(mdir,'models',filename,['MEMds_ndp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.dsigma_noisedphi = @MEMds_ndp_' filename '_' num2str(S(s)) ';']);

% ddsigma_noisedphidphi
Expand All @@ -245,7 +245,7 @@
Model.exp{s}.sym.ddsigma_noisedphidphi(j,k,:,:) = hessian(Model.exp{s}.sym.sigma_noise(j,k),phi);
end
end
mfun(Model.exp{s}.sym.ddsigma_noisedphidphi,'file',fullfile(mdir,'MEMfn',filename,['MEMdds_ndpdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.ddsigma_noisedphidphi,'file',fullfile(mdir,'models',filename,['MEMdds_ndpdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.ddsigma_noisedphidphi = @MEMdds_ndpdp_' filename '_' num2str(S(s)) ';']);

% dddsigma_noisedphidphidphi
Expand All @@ -257,7 +257,7 @@
end
end
end
mfun(Model.exp{s}.sym.dddsigma_noisedphidphidphi,'file',fullfile(mdir,'MEMfn',filename,['MEMddds_ndpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.dddsigma_noisedphidphidphi,'file',fullfile(mdir,'models',filename,['MEMddds_ndpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.dddsigma_noisedphidphidphi = @MEMddds_ndpdpdp_' filename '_' num2str(S(s)) ';']);

if(Model.integration)
Expand All @@ -271,15 +271,15 @@
% end
% end
% end
mfun(Model.exp{s}.sym.ddddsigma_noisedphidphidphidphi,'file',fullfile(mdir,'MEMfn',filename,['MEMdddds_ndpdpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.ddddsigma_noisedphidphidphidphi,'file',fullfile(mdir,'models',filename,['MEMdddds_ndpdpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.ddddsigma_noisedphidphidphidphi = @MEMdddds_ndpdpdpdp_' num2str(S(s)) ';']);
end

% sigma_time(phi)
if(~isfield(Model.exp{s}.sym,'sigma_time'))
Model.exp{s}.sym.sigma_time = sym.empty(0,1);
end
mfun(Model.exp{s}.sym.sigma_time,'file',fullfile(mdir,'MEMfn',filename,['MEMsigma_time_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.sigma_time,'file',fullfile(mdir,'models',filename,['MEMsigma_time_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.sigma_time = @MEMsigma_time_' filename '_' num2str(S(s)) ';']);

% dsigma_timedphi
Expand All @@ -289,7 +289,7 @@
Model.exp{s}.sym.dsigma_timedphi(j,k,:) = jacobian(Model.exp{s}.sym.sigma_time(j,k),phi);
end
end
mfun(Model.exp{s}.sym.dsigma_timedphi,'file',fullfile(mdir,'MEMfn',filename,['MEMds_tdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.dsigma_timedphi,'file',fullfile(mdir,'models',filename,['MEMds_tdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.dsigma_timedphi = @MEMds_tdp_' filename '_' num2str(S(s)) ';']);

% ddsigma_timedphidphi
Expand All @@ -299,7 +299,7 @@
Model.exp{s}.sym.ddsigma_timedphidphi(j,k,:,:) = hessian(Model.exp{s}.sym.sigma_time(j,k),phi);
end
end
mfun(Model.exp{s}.sym.ddsigma_timedphidphi,'file',fullfile(mdir,'MEMfn',filename,['MEMdds_tdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.ddsigma_timedphidphi,'file',fullfile(mdir,'models',filename,['MEMdds_tdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.ddsigma_timedphidphi = @MEMdds_tdpdp_' filename '_' num2str(S(s)) ';']);

% dddsigma_timedphidphidphi
Expand All @@ -311,7 +311,7 @@
end
end
end
mfun(Model.exp{s}.sym.dddsigma_timedphidphidphi,'file',fullfile(mdir,'MEMfn',filename,['MEMddds_tdpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.dddsigma_timedphidphidphi,'file',fullfile(mdir,'models',filename,['MEMddds_tdpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.dddsigma_timedphidphidphi = @MEMddds_tdpdpdp_' filename '_' num2str(S(s)) ';']);

if(Model.integration)
Expand All @@ -325,22 +325,22 @@
% end
% end
% end
mfun(Model.exp{s}.sym.ddddsigma_timedphidphidphidphi,'file',fullfile(mdir,'MEMfn',filename,['MEMdddds_tdpdpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
mfun(Model.exp{s}.sym.ddddsigma_timedphidphidphidphi,'file',fullfile(mdir,'models',filename,['MEMdddds_tdpdpdpdp_' filename '_' num2str(S(s))]),'vars',{phi});
eval(['Model.exp{s}.ddddsigma_timedphidphidphidphi = @MEMdddds_tdpdpdpdp_' filename '_' num2str(S(s)) ';']);
end

% phi
mfun(Model.exp{s}.sym.phi,'file',fullfile(mdir,'MEMfn',filename,['MEMphi_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
mfun(Model.exp{s}.sym.phi,'file',fullfile(mdir,'models',filename,['MEMphi_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
eval(['Model.exp{s}.phi = @MEMphi_' filename '_' num2str(S(s)) ';']);

% dphidbeta
Model.exp{s}.sym.dphidbeta = simplify(jacobian(Model.exp{s}.sym.phi,Model.exp{s}.sym.beta));
mfun(Model.exp{s}.sym.dphidbeta,'file',fullfile(mdir,'MEMfn',filename,['MEMdphidbeta_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
mfun(Model.exp{s}.sym.dphidbeta,'file',fullfile(mdir,'models',filename,['MEMdphidbeta_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
eval(['Model.exp{s}.dphidbeta = @MEMdphidbeta_' filename '_' num2str(S(s)) ';']);

% dphidb
Model.exp{s}.sym.dphidb = simplify(jacobian(Model.exp{s}.sym.phi,Model.exp{s}.sym.b));
mfun(Model.exp{s}.sym.dphidb,'file',fullfile(mdir,'MEMfn',filename,['MEMdphidb_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
mfun(Model.exp{s}.sym.dphidb,'file',fullfile(mdir,'models',filename,['MEMdphidb_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
eval(['Model.exp{s}.dphidb = @MEMdphidb_' filename '_' num2str(S(s)) ';']);


Expand All @@ -349,23 +349,23 @@
for j = 1:n_phi
Model.exp{s}.sym.ddphidbdb(j,:,:) = simplify(hessian(Model.exp{s}.sym.phi(j),Model.exp{s}.sym.b));
end
mfun(Model.exp{s}.sym.ddphidbdb,'file',fullfile(mdir,'MEMfn',filename,['MEMddphidbdb_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
mfun(Model.exp{s}.sym.ddphidbdb,'file',fullfile(mdir,'models',filename,['MEMddphidbdb_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
eval(['Model.exp{s}.ddphidbdb = @MEMddphidbdb_' filename '_' num2str(S(s)) ';']);

% dphidbetadbeta
Model.exp{s}.sym.ddphidbetadbeta = sym(zeros(n_phi,n_beta,n_beta));
for j = 1:n_phi
Model.exp{s}.sym.ddphidbetadbeta(j,:,:) = simplify(hessian(Model.exp{s}.sym.phi(j),Model.exp{s}.sym.beta));
end
mfun(Model.exp{s}.sym.ddphidbetadbeta,'file',fullfile(mdir,'MEMfn',filename,['MEMddphidbetadbeta_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
mfun(Model.exp{s}.sym.ddphidbetadbeta,'file',fullfile(mdir,'models',filename,['MEMddphidbetadbeta_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
eval(['Model.exp{s}.ddphidbetadbeta = @MEMddphidbetadbeta_' filename '_' num2str(S(s)) ';']);

% dphidbdbeta
Model.exp{s}.sym.ddphidbetadb = sym(zeros(n_phi,n_beta,n_b));
for j = 1:n_phi
Model.exp{s}.sym.ddphidbdbeta(j,:,:) = simplify(jacobian(jacobian(Model.exp{s}.sym.phi(j),Model.exp{s}.sym.b),Model.exp{s}.sym.beta));
end
mfun(Model.exp{s}.sym.ddphidbdbeta,'file',fullfile(mdir,'MEMfn',filename,['MEMddphidbdbeta_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
mfun(Model.exp{s}.sym.ddphidbdbeta,'file',fullfile(mdir,'models',filename,['MEMddphidbdbeta_' filename '_' num2str(S(s))]),'vars',{Model.exp{s}.sym.beta,Model.exp{s}.sym.b});
eval(['Model.exp{s}.ddphidbdbeta = @MEMddphidbdbeta_' filename '_' num2str(S(s)) ';']);

end
Expand All @@ -376,7 +376,7 @@


% save the symbolic definition as future reference
syms = load(fullfile(mdir,'MEMfn',filename,'syms.mat'));
syms = load(fullfile(mdir,'models',filename,'syms.mat'));
Model.sym = syms.syms;

% compute number of elements of xi and b
Expand Down
10 changes: 5 additions & 5 deletions simulateForSP.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
% Simulate model
if(nargout<2)
options_simu.sensi = 0;
sol = model(tout,phi,kappa,options_simu);
varargout{1} = sol.y;
sol = model(tout,phi,kappa,[],options_simu);
varargout{1} = log(sol.y);
else
options_simu.sensi = 1;
sol = model(tout,phi,kappa,options_simu);
varargout{1} = sol.y;
varargout{2} = sol.sy;
sol = model(tout,phi,kappa,[],options_simu);
varargout{1} = log(sol.y);
varargout{2} = bsxfun(@times,sol.sy,1./sol.y);
end

if sol.status < 0
Expand Down

0 comments on commit 79c4ecf

Please sign in to comment.