<|start_filename|>animal/html/mydata_get_ts.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_get_ts</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="mydata_get_ts.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">Demonstrates the use of get_ts and get_tj</a></li><li><a href="#2">set parameters and f</a></li><li><a href="#3">get scaled ages, lengths, growth rates</a></li><li><a href="#4">plotting</a></li></ul></div><h2>Demonstrates the use of get_ts and get_tj<a name="1"></a></h2><pre class="codeinput"><span class="comment">% metabolic acceleration between stages s and j at constant f</span>
<span class="comment">%  with vHb &gt;= vHs &gt;= vHj &gt;= vHp</span>
<span class="comment">% if vHb = vHs = vHj: standard DEB model</span>
<span class="comment">% if vHb = vHs &lt; vHj: maximum acceleration, given vHj</span>
<span class="comment">% during acceleration {F_m}, {p_Am} and v increase with length</span>
<span class="comment">% notice that K, f, [E_m], g, r_B are not affected by this increase</span>
<span class="comment">% scaling of lengths is always with respect to embryo parameter values</span>
<span class="comment">% lT = 0 during embryo stage (no heating or osmotic work)</span>
</pre><h2>set parameters and f<a name="2"></a></h2><pre class="codeinput">  g   = 0.0424;  <span class="comment">% [E_G] v/ kap {p_Am}, energy investment ratio</span>
  k   = 0.0118;  <span class="comment">% k_J/ k_M, ratio of maturity and somatic maintenance rate coeff</span>
  lT  = .0;      <span class="comment">% {p_T}/[p_M]Lm,  scaled heating length</span>
  vHb = 2.52e-6; <span class="comment">% v_H^b = U_H^b g^2 kM^3/ (1 - kap) v^2; U_B^b = M_H^b/ {J_EAm}, mat at birth: start of feeding</span>
  vHs = 7.40e-5; <span class="comment">% v_H^s = U_H^s g^2 kM^3/ (1 - kap) v^2; U_B^s = M_H^s/ {J_EAm}, mat at settlemen: start of acceletation</span>
  vHj = 8.88e-4; <span class="comment">% v_H^j = U_H^j g^2 kM^3/ (1 - kap) v^2; U_B^j = M_H^j/ {J_EAm}, mat at metamorphosis: end of acceleration</span>
  vHp = 3.13e-2;  <span class="comment">% v_H^p = U_H^p g^2 kM^3/ (1 - kap) v^2; U_B^p = M_H^p/ {J_EAm}, mat at puberty: ceasing of maturation, start of reproduction</span>
  pars_ts = [g; k; lT; vHb; vHs; vHj; vHp]; <span class="comment">% parameters for get_ts</span>
  pars_tj = [g; k; lT; vHb; vHj; vHp];      <span class="comment">% parameters for get_tj, for comparison (vHs = vHb)</span>
  pars_tb = [g; k; vHb];                    <span class="comment">% parameters for get_tb</span>

  f = 0.8;
</pre><h2>get scaled ages, lengths, growth rates<a name="3"></a></h2><pre class="codeinput">  <span class="comment">% first use get_ts (vHs &gt; vHb)</span>
  [ts tj tp tb ls lj lp lb li rj rB info] = get_ts(pars_ts, f);
  <span class="keyword">if</span> info ~=1
      fprintf(<span class="string">'warning in get_ts: no convergence\n'</span>)
  <span class="keyword">end</span>

  ti = 2 * tp; <span class="comment">% maximum scaled age for plotting</span>
  t_bs = linspace(tb, ts, 50)'; <span class="comment">% scaled ages between b and s</span>
  t_sj = linspace(ts, tj, 50)'; <span class="comment">% scaled ages between s and j</span>
  t_jp = linspace(tj, tp, 50)'; <span class="comment">% scaled ages between j and p</span>
  t_pi = linspace(tp, ti, 50)'; <span class="comment">% scaled ages after p</span>

  l_bs = f - lT - (f - lT - lb) * exp(- rB * (t_bs - tb)); <span class="comment">% von Bert growth between b and s</span>
  l_sj = ls * exp (rj * (t_sj - ts)/ 3);                   <span class="comment">% exponential growth between s and j</span>
  l_jp = li - (li - lj) * exp(- rB * (t_jp - tj));         <span class="comment">% von Bert growth between j and p</span>
  l_pi = li - (li - lp) * exp(- rB * (t_pi - tp));         <span class="comment">% von Bert growth between p and i</span>

  <span class="comment">% compare with get_tj (vHs = vHb)</span>
  [tj_j tp_j tb_j lj_j lp_j lb_j li_j rj_j rB_j info] = get_tj(pars_tj, f);
  <span class="keyword">if</span> info ~=1
      fprintf(<span class="string">'warning in get_tj: no convergence\n'</span>)
  <span class="keyword">end</span>
  t_bj   = linspace(tb_j, tj_j, 50)';
  t_jp_j = linspace(tj_j, tp_j, 50)';
  t_pi_j = linspace(tp_j, ti, 50)';

  l_bj = lb_j * exp (rj_j * (t_bj - tb_j)/ 3);                   <span class="comment">% exponential growth between b and j</span>
  l_jp_j = li_j - (li_j - lj_j) * exp(- rB_j * (t_jp_j - tj_j)); <span class="comment">% von Bert growth between j and p</span>
  l_pi_j = li_j - (li_j - lp_j) * exp(- rB_j * (t_pi_j - tp_j)); <span class="comment">% von Bert growth between p and i</span>

  <span class="comment">% compare with no acceleration</span>
  [tb_b lb_b info] = get_tb(pars_tb, f);
  <span class="keyword">if</span> info ~=1
      fprintf(<span class="string">'warning in get_tb: no convergence\n'</span>)
  <span class="keyword">end</span>

  t_bi = linspace(tb_b, ti, 100)';
  rB_b = 1/ 3/ (1 + f/ g);
  l_bi = f - lT - (f - lT - lb_b) * exp(- rB_b * (t_bi - tb_b)); <span class="comment">% von Bert growth between b and i</span>
</pre><h2>plotting<a name="4"></a></h2><pre class="codeinput">  close <span class="string">all</span>

  plot(t_bs, l_bs, <span class="string">'b'</span>, t_sj, l_sj, <span class="string">'g'</span>, t_jp, l_jp, <span class="string">'r'</span>, t_pi, l_pi, <span class="string">'k'</span>, <span class="keyword">...</span>
       t_bj, l_bj, <span class="string">'g'</span>, t_jp_j, l_jp_j, <span class="string">'r'</span>, t_pi_j, l_pi_j, <span class="string">'k'</span>, <span class="keyword">...</span>
       t_bi, l_bi, <span class="string">'b'</span>)
  xlabel(<span class="string">'scaled age'</span>)
  ylabel(<span class="string">'scaled length'</span>)
</pre><img vspace="5" hspace="5" src="mydata_get_ts_01.png" alt=""> <p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% Demonstrates the use of get_ts and get_tj

% metabolic acceleration between stages s and j at constant f
%  with vHb >= vHs >= vHj >= vHp
% if vHb = vHs = vHj: standard DEB model
% if vHb = vHs < vHj: maximum acceleration, given vHj
% during acceleration {F_m}, {p_Am} and v increase with length
% notice that K, f, [E_m], g, r_B are not affected by this increase
% scaling of lengths is always with respect to embryo parameter values
% lT = 0 during embryo stage (no heating or osmotic work)

%% set parameters and f

  g   = 0.0424;  % [E_G] v/ kap {p_Am}, energy investment ratio 
  k   = 0.0118;  % k_J/ k_M, ratio of maturity and somatic maintenance rate coeff
  lT  = .0;      % {p_T}/[p_M]Lm,  scaled heating length 
  vHb = 2.52e-6; % v_H^b = U_H^b g^2 kM^3/ (1 - kap) v^2; U_B^b = M_H^b/ {J_EAm}, mat at birth: start of feeding
  vHs = 7.40e-5; % v_H^s = U_H^s g^2 kM^3/ (1 - kap) v^2; U_B^s = M_H^s/ {J_EAm}, mat at settlemen: start of acceletation
  vHj = 8.88e-4; % v_H^j = U_H^j g^2 kM^3/ (1 - kap) v^2; U_B^j = M_H^j/ {J_EAm}, mat at metamorphosis: end of acceleration
  vHp = 3.13e-2;  % v_H^p = U_H^p g^2 kM^3/ (1 - kap) v^2; U_B^p = M_H^p/ {J_EAm}, mat at puberty: ceasing of maturation, start of reproduction
  pars_ts = [g; k; lT; vHb; vHs; vHj; vHp]; % parameters for get_ts
  pars_tj = [g; k; lT; vHb; vHj; vHp];      % parameters for get_tj, for comparison (vHs = vHb)
  pars_tb = [g; k; vHb];                    % parameters for get_tb
  
  f = 0.8;
  
%% get scaled ages, lengths, growth rates

  % first use get_ts (vHs > vHb)
  [ts tj tp tb ls lj lp lb li rj rB info] = get_ts(pars_ts, f);
  if info ~=1
      fprintf('warning in get_ts: no convergence\n')
  end
  
  ti = 2 * tp; % maximum scaled age for plotting
  t_bs = linspace(tb, ts, 50)'; % scaled ages between b and s
  t_sj = linspace(ts, tj, 50)'; % scaled ages between s and j
  t_jp = linspace(tj, tp, 50)'; % scaled ages between j and p
  t_pi = linspace(tp, ti, 50)'; % scaled ages after p
  
  l_bs = f - lT - (f - lT - lb) * exp(- rB * (t_bs - tb)); % von Bert growth between b and s
  l_sj = ls * exp (rj * (t_sj - ts)/ 3);                   % exponential growth between s and j
  l_jp = li - (li - lj) * exp(- rB * (t_jp - tj));         % von Bert growth between j and p
  l_pi = li - (li - lp) * exp(- rB * (t_pi - tp));         % von Bert growth between p and i
 
  % compare with get_tj (vHs = vHb)
  [tj_j tp_j tb_j lj_j lp_j lb_j li_j rj_j rB_j info] = get_tj(pars_tj, f);
  if info ~=1
      fprintf('warning in get_tj: no convergence\n')
  end
  t_bj   = linspace(tb_j, tj_j, 50)';
  t_jp_j = linspace(tj_j, tp_j, 50)';
  t_pi_j = linspace(tp_j, ti, 50)';
  
  l_bj = lb_j * exp (rj_j * (t_bj - tb_j)/ 3);                   % exponential growth between b and j
  l_jp_j = li_j - (li_j - lj_j) * exp(- rB_j * (t_jp_j - tj_j)); % von Bert growth between j and p
  l_pi_j = li_j - (li_j - lp_j) * exp(- rB_j * (t_pi_j - tp_j)); % von Bert growth between p and i
  
  % compare with no acceleration
  [tb_b lb_b info] = get_tb(pars_tb, f);
  if info ~=1
      fprintf('warning in get_tb: no convergence\n')
  end

  t_bi = linspace(tb_b, ti, 100)';
  rB_b = 1/ 3/ (1 + f/ g);
  l_bi = f - lT - (f - lT - lb_b) * exp(- rB_b * (t_bi - tb_b)); % von Bert growth between b and i
 
  
%% plotting

  close all
  
  plot(t_bs, l_bs, 'b', t_sj, l_sj, 'g', t_jp, l_jp, 'r', t_pi, l_pi, 'k', ...
       t_bj, l_bj, 'g', t_jp_j, l_jp_j, 'r', t_pi_j, l_pi_j, 'k', ...
       t_bi, l_bi, 'b')
  xlabel('scaled age')
  ylabel('scaled length')
  
##### SOURCE END #####
--></body></html>

<|start_filename|>docs/DEBtool_animal.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_animal</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3><A NAME="toolbox_animal">Toolbox: animal</A></H3>

Toolbox animal deals with the standard DEB model and some variants of this model.<br>
Hundreds of examples of applications of functions in this toolbox can be found in the predict-files of the 
<a href = "http://www.bio.vu.nl/thb/deb/deblab/add_my_pet/index.html" TARGET="_top"> add_my_pet collection</a>.<br>
The following models are delineated as variations on <a href="#std">model <i>std</i></a>

<ul>
  <li> s-models assume isomorphy throughout the full life cycle
    <ul>
      <li> <a NAME="std"><i>std</i></a>:<br>
        The standard DEB model follows from the assumptions as listed in Table 2.4 of the <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB book</a>.
        Within the family of DEB models, it can be seen as a canonical form, which differs from other DEB models by
        <ul>
          <li> 1 type of food, 1 type of reserve, 1 type of structure</i>
          <li> 3 life stages (embryo, juvenile, adult) triggered by maturity thresholds.
               Birth is defined as start of assimilation via food uptake, puberty as end of maturation and start of allocation to reproduction.</li>
          <li> O_2 available without limitation </li>
          <li> products: faeces and 3 minerals CO2, N_waste, H2O</li>
        </ul>
        The model equations are summarized in Table 2.5, and in scaled stochastic form in the <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010_c.pdf">comments on Section 2.9</a>.
     </li>

     <li> <a NAME="stf"><i>stf</i></a>:<br> 
       Like <a href="#std">model <i>std</i></a> but with
       <ul>
         <li> foetal development (rather than egg development)</li>
       </ul>
       Budding, as found in cnidarians and salps has, metabolically, similarities with foetal propagation: no assimilation by buds during development.
       Foetal development is found in e.g. peripatus, some cartilagenous and ray-finned fish. 
    </li>

    <li> <a NAME="stx"><i>stx</i></a>:<br>
      Like <a href="#stf">model <i>stf</i></a> but with 
      <ul>  
        <li> foetal development (rather than egg development) that first starts with a preparation stage and then sparks off at a time that is an extra parameter </li>
        <li> a baby stage (for mammals) just after birth, ended by weaning, where juvenile switches from feeding on milk to solid food at maturity level E_Hx.
           Weaning is between birth and puberty.</li>   
       </ul>
       In its simplest form, it is a two parameter extension of <a href="#std">model <i>std</i></a> at abundant food.
       Food quality and upregulation can involve more parameters.
       This life history is found in placentalia.
       Milk production is from upregulated feeding/assimilation.
       The quantification of this process involves further parameters. 
       See <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010.pdf">Section 7.7 of the DEB book</a> and 
       <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010_c.pdf">its comments</a>.
    </li>

    <li> <a NAME="ssj"><i>ssj</i></a>:<br>
      Like <a href="#std">model <i>std</i></a> but with 
      <ul>  
        <li> a non-feeding stage between events s and j during the juvenile stage that is initiated at a particular maturity level and lasts a particular time.
          Substantial metabolically controlled shrinking occurs during this period, more than can be explained by starvation.</li>   
      </ul>
        It is a two or three parameter extension of <a href="#std">model <i>std</i></a>.
        This life history is found in Elopiformes, Albuliformes, Notacanthiformes, Anguilliformes, Ophidiiformes, some Anura and Echinodermata.
        The  <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010_c.pdf">comments on Section 1.1.4</a> give more background.
    </li>

    <li> <a NAME="sbp"><i>sbp</i></a>:<br>
      Like <a href="#std">model <i>std</i></a> but with 
      <ul>  
        <li> growth ceases at puberty, meaning that the kappa-rule is not operational in adults.</li>   
      </ul>
      It has the same parameters as the <a href="#std">model <i>std</i></a>, and is similar to the <a href="#abp">model <i>abp</i></a>, which differs by acceleration.
      This life history is found in Calanus, while other copepods accelerate. 
      We obviously need more data and better culturing techniques. 
    </li>
  </ul>

  <li> a-models also assume isomorphy, but during part of the life cycle metabolism accelerates following the rules for V1-morphy
    
    <ul>
      <li> <a NAME="abj"><i>abj</i></a>:<br>
        The DEB model with type M acceleration is like <a href="#std">model <i>std</i></a>, but 
        <ul>
          <li> acceleration between birth and metamorphosis </li>
          <li> before and after acceleration: isomorphy</li>
        </ul>
        Metamorphosis is before puberty and occurs at maturity E_Hj, which might or might not correspond with changes in morphology.
        This model is a one-parameter extension of <a href="#std">model <i>std</i></a>.
      </li>
 
      <li> <a NAME="asj"><i>asj</i></a>:<br>
        The DEB model with delayed type M acceleration is like <a href="#abj">model <i>abj</i></a>, but 
        <ul>
          <li> start of acceleration is delayed till maturity level E_Hs</li>
          <li> Before and after acceleration: isomorphy.</li>
        </ul>
        Metamorphosis is still before puberty.
        This model is a one-parameter extension of model <i>abj</i>.
        This life history is found in Mnemiopsis, Crassostrea and Aplysia.
        Further improvement of data might require a change from <i>abj</i> to <i>asj</i> for quite a few species.
      </li>

      <li> <a NAME="abp"><i>abp</i></a>:<br>
        The DEB model with type M acceleration is like <a href="#abj">model <i>abj</i></a>, but 
        <ul>
          <li> acceleration between birth and puberty </li>
          <li> before acceleration: isomorphy</li>
          <li> after acceleration: no growth, so no kappa-rule</li>
        </ul>
        Metamorphosis can occur before puberty and occurs at maturity E_Hj, but only affects morphology, not metabolism.
        This model has the same number of parameters as <a href="#std">model <i>std</i></a>. 
        It is similar to the <a href="#sbp">model <i>sbp</i></a>, which has no acceleration.
        It applies to copepods, may be also to ostracods, spiders and scorpions.
      </li>
    </ul>

  <li> h-models are as a-models, but with extra life stages (as found in insects) triggered by the reproduction buffer density

    <ul>
      <li> <a NAME="hep"><i>hep</i></a>:<br>
        The DEB model for ephemeropterans, odonata and possibly other insect groups. It characteristics are
        <ul> 
          <li> morphological life stages: egg, larva, (sub)imago;  functional stages: embryo, juvenile, adult, imago</li>
          <li> the embryo still behaves like <a href="#std">model <i>std</i></a></li>
          <li> acceleration starts at birth and ends at puberty</li>
          <li> puberty occurs during the larval stage</li>
          <li> emergence occurs when reproduction buffer density hits a threshold</li>
          <li> the (sub)imago does not grow or allocate to reproduction. It mobilises reserve to match constant (somatic plus maturity) maintenance</li>
        </ul>
        The model is further discussed in the
        <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010_c.pdf">comments for Section 7.8</a>.
      </li>

      <li> <a NAME="hex"><i>hex</i></a>:<br>
        The DEB model for holometabolic insects (and some other hexapods). It characteristics are
        <ul> 
          <li> morphological life stages: egg, larva, (pupa), imago; functional stages: embryo, adult, (pupa), imago </li>
          <li> the embryo still behaves like <a href="#std">model <i>std</i></a></li>
          <li> the larval stage accelerates (V1-morph) and behaves as adult, i.e. no maturation, allocation to reproduction</li>
          <li> pupation occurs when reproduction buffer density hits a threshold</li>
          <li> pupa behaves like an isomorphic embryo of <a href="#std">model <i>std</i></a>, but larval structure rapidly transforms to pupal reserve just after start of pupation</li>
          <li> the reproduction buffer remains unchanged during the pupal stage</li>
          <li> the imago does not grow or allocate to reproduction. It mobilises reserve to match constant (somatic plus maturity) maintenance</li>
        </ul>
        Hemi-metabolic insects skip the pupal stage, don't convert larval structure to reserve. 
        Imago structure equals larval stucture when reproduction buffer density hits a threshold.
        The model is further discussed in the
        <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010_c.pdf">comments for Section 7.8</a>.
      </li>
  </ul>

  <li> nat model stands for not-a-typified model. It comes with no constrains or checks. It is meant for non-AmP purposes, such as effects of toxicants.

</ul>
  
<HR>
<H4><A NAME="life cycle">life cycle </A></H4>
  
  Several functions apply to the full life cycle of the individual. 
  The function <a href="../animal/html/animal.html"><code>animal</code></a> runs a demo for the standard model, after editing parameter values in 
  <A HREF="../animal/html/pars_animal.html"><code>pars_animal</code></A>:
  <UL>
    <li> <a href="../animal/html/shmics.html"><code>shmics</code></a>: 
         temp correction, embryo weights, reproduction, reserve residence times </li>
    <li> <a href="../animal/html/shtime_animal.html"><code>shtime_animal</code></a>:
         length, reprod, weight, survival </li>
    <li> <a href="../animal/html/shphase.html"><code>shphase</code></a>:
         phase diagram </li>
    <li> <a href=".../animal/html/shflux.html"><code>shflux</code></a>:
         fluxes of compounds </li>
    <li> <a href="../animal/html/shflux_struc.html"><code>shflux_struc</code></a>:
         structure-specific fluxes </li>
    <li> <a href="../animal/html/shflux_weight.html"><code>shflux_weight</code></a>:
         weight-specific fluxes </li>
    <li> <a href="../animal/html/shratio.html"><code>shratio</code></a>:
         Repiration, Watering, Urination Quotients </li>
    <li> <a href="../animal/html/shpower.html"><code>shpower</code></a>:
         powers and specific powers </li>
    <li> <a href="../animal/html/shscale.html"><code>shscale</code></a>:
         variables versus species' max body weight </li>
    <li> <a href="../animal/html/shssd_iso.html"><code>shssd_iso</code></a>:
         population characteristics versus functional response </li>
  </UL>

   The standard model accounts for:<BR>
   effects of food availability (X) and temperature (T).<BR>
   These environmental parameters are taken to be constant in this demo, but the theory handles varying environmental parameters.
 
   <p>
   The animal (or other organism) is decomposed in:<BR>
   structure (V) and reserve (E)<BR>
   Organic compounds:<BR>
   X = food, V = structure, E = reserve, P = faeces<BR>
   Mineral compounds:<BR>
   C = carbon dioxide, H = water, O = dioxygen, N = nitrogen waste

   <p>
   The animal develops through an embryonic, juvenile and adult phase.<BR>
   Assimilation is switched on at birth<BR>
   Allocation to maturation is redirected to reproduction at puberty

   <p>
   Uptake is proportional to surface area, which is taken to be proportional to the structural volume^(2/3): 
   isomorph

   <p>
   The heating length (this is the volumetric length reduction due to the energy drain that goes into heating or osmotic work) is set to a fixed length in this implementation. 
   The DEB theory has a module on the water balance, with implications for the costs of heating. 
   These implications make the heating length a function of other variables.

   <p>
   All lengths refer to volumetric lengths. Lengths should be divided by a shape coefficients to arrive at shape-specific lengths.

  <p>
  Script <a href="../animal/html/shtraject.html">shtraject</a> runs a simulation of the stochastic variant, where food searching is a time-inhomogeneous Poisson process.
  DEB theory quantifies aging directly in terms of the hazard rate, so for the aging process no deterministic equivalent is available.
  The scripts plot variables as function of scaled time since birth.
  Function <a href="../animal/html/shphase.html"><code>shphase</code></a> presents phase diagrams, which indicate how reserve and structure chnage relative to each other.
  
  <p>
  Script <a href="../animal/html/statistics.html"><code>statistics</code></a> computes quantities that depend on food density,
  while script <a href="../animal/html/parscomp.html"><code>parscomp</code></a> computes quantities that are independent of food density, 
  so functions of parameters, called compound parameters.
 
  <p> Function 
  <a href="../animal/html/shpower.html"><code>shpower</code></a>
  plots the various powers as function of scaled length.
  It is based on 
  <a href="../animal/html/scaled_power.html"><code>scaled_power</code></a>.
  It is similar to 
  <a href="../animal/html/shflux.html"><code>shflux</code></a>
  for mass fluxes and
  <a href="../animal/html/shflux_struc.html"><code>shflux_struc</code></a>
  for structure-specific mass fluxes and
  <a href="../animal/html/shflux_weight.html"><code>shflux_weight</code></a>
  for body weight-specific mass fluxes.
  Likewise
  <a href="../animal/html/shratio.html"><code>shratio</code></a>
  plots ratio's of mineral fluxes.

  <p>
  Maturity is, at constant food density, found from length by functions
  <a href="../animal/html/maturity.html"><code>maturity</code></a>,
  <a href="../animal/html/maturity_j.html"><code>maturity_j</code></a>,
  <a href="../animal/html/maturity_s.html"><code>maturity_s</code></a>.
  The functions relate to non-acceleration, tyupe M acceleration and delayed type M acceleration.
  They can be applied for the full life cycle (although maturity remains constant for adults). 

  <p>
  Since food denisity trajectories uniquely determine state trajectories, the inverse mapping also exists:
  from states trajectories to trajectories of scaled functional response.
  The pair of functions 
  <a href="../animal/html/f2o.html"><code>f2o</code></a> and
  <a href="../animal/html/o2f.html"><code>o2f</code></a> is and example for (fish) otoliths, where otoliths are considered to be products,
  with contributions from assimilations, dissipation and growth.
  See section 4.11.4 of the <a href="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB book</a>.
  Isotops, their dynamics is discussed in Section 4.7, add to the reconstruction to include temperature trajectories as well.
  See function <a href="../animal/html/isotope.html"><code>isotope</code></a>

<HR>
<H4><A NAME="embryo">embryo</A></H4>

  The scaled initial reserve is computed by 
  <a href="../animal/html/get_ue0.html"><code>get_ue0</code></a> for eggs and
  <a href="../animal/html/get_ue0_foetus.html"><code>get_ue0_foetus</code></a> for foetusses.
  The latter amounts to the cumulative energy investment till birth.
  The functions 
  <a href="../animal/html/initial_scaled_reserve.html"><code>initial_scaled reserve</code></a> and
  <a href="../animal/html/initial_scaled_reserve_foetus.html"><code>initial_scaled reserve_foetus</code></a> are shells around these function for vector-arguments and they are not scaled down to dimensionless quantities.

  <p>
  Scaled maturity at birth should not exceed a threshold that is computed in 
  <a href="../animal/html/get_vHb.html"><code>get_vHb</code></a>.

  <p>
  The scaled length at birth is computed by 
  <a href="../animal/html/get_lb.html"><code>get_lb</code></a>,
  <a href="../animal/html/get_lb1.html"><code>get_lb1</code></a>,
  <a href="../animal/html/get_lb2.html"><code>get_lb2</code></a>, and
  <a href="../animal/html/get_lb3.html"><code>get_lb3</code></a>.
  The functions differ in numerical method, from fast and dirty to slow and robust.
  Use function  <a href="../animal/html/get_lb_foetus.html"><code>get_lb_foetus</code></a> for foetal development.
  
  <p>
  The scaled time at birth is computed by
  <a href="../animal/html/get_tb.html"><code>get_tb</code></a>, 
  <a href="../animal/html/get_tb1.html"><code>get_tb1</code></a> and
  <a href="../animal/html/get_tb_foetus.html"><code>get_tb_foetus</code></a>.
  These functions also compute scaled length at birth.
  Age, reserve, length (and maturity) at birth is produced by 
  <a href="../animal/html/get_ael.html"><code>get_ael</code></a>,
  <a href="../animal/html/get_aulh.html"><code>get_aulh</code></a>,
  <a href="../animal/html/get_tul.html"><code>get_tul</code></a> and
  <a href="../animal/html/get_tul_i.html"><code>get_tul_i</code></a> for egg development and
  <a href="../animal/html/get_ael_f.html"><code>get_ael_f</code></a> and
  <a href="../animal/html/get_aulh_f.html"><code>get_aulh_f</code></a> for foetal development.
  The results are obtained by integration and can to used to check the results of other embryo-functions.
  The numerical methods differ between these functions.

  <p>
  The scaled reserve density at which growth and/or maturition ceases at birth is computed by
  <a href="../animal/html/get_eb_min_G.html"><code>get_eb_min_G</code></a>,
  <a href="../animal/html/get_eb_min_R.html"><code>get_eb_min_R</code></a> and
  <a href="../animal/html/get_eb_min.html"><code>get_eb_min</code></a>.
  The levels can be seen as minimum levels to reach birth.

  <p>
  The cumulative energy investment to the various endpoints at birth can be obtained numerically with functions
  <a href="../animal/html/get_EMJHG.html"><code>get_EMJHG</code></a> and
  <a href="../animal/html/get_EMJHG_foetus.html"><code>get_EMJHG_foetus</code></a>,
  and graphically with functions
  <a href="../animal/html/birth_pie.html"><code>birth_pie</code></a> and 
  <a href="../animal/html/birth_pie_foetus.html"><code>birth_pie_foetus</code></a>.


<HR>
<H4><A NAME="juvenile">juvenile</A></H4>

  The scaled times at weaning (for mammals) 
  <a href="../animal/html/get_tx.html"><code>get_tx</code></a> and
  start acceleration
  <a href="../animal/html/get_ts.html"><code>get_ts</code></a> and
  metamorphosis
  <a href="../animal/html/get_tj.html"><code>get_tj</code></a> and
  <a href="../animal/html/get_tj_foetus.html"><code>get_tj_foetus</code></a>
  and puberty
  <a href="../animal/html/get_tp.html"><code>get_tp</code></a> and
  <a href="../animal/html/get_tp_foetus.html"><code>get_tp_foetus</code></a>
are computed in combination with other scaled times and scaled lengths at life history events.
  If you only need scaled lengths, it is more economic to use the corresponding <code>get_l*</code> functions:
  <a href="../animal/html/get_ls.html"><code>get_ls</code></a>,
  <a href="../animal/html/get_lj.html"><code>get_lj</code></a>,
  <a href="../animal/html/get_lj_foetus.html"><code>get_lj_foetus</code></a>,
  <a href="../animal/html/get_lp.html"><code>get_lp</code></a>,
  <a href="../animal/html/get_lp_foetus.html"><code>get_lp_foetus</code></a>.
  If you only need states at birth, see under <a href="#embryo">embryo</a>

  <p>
  The scaled reserve density at which growth and maturition ceases at puberty is computed by
  <a href="../animal/html/get_ep_min.html"><code>get_ep_min</code></a> without acceleration,
  <a href="../animal/html/get_ep_min_metam.html"><code>get_ep_min_metam</code></a> with acceleration.

  <p>
  Scaled functional response is reconstructed from scaled length by functions
  <a href="../animal/html/l2f.html"><code>l2f</code></a> and
  <a href="../animal/html/l2f1.html"><code>l2f1</code></a>.
  They apply to the juvenile and adult stages.

  <p> 
  The reserve residence time as function of length is computed by
  <a href="../animal/html/res_time.html"><code>res_time</code></a>
  and fluxes of masses for parameters and states by
  <a href="../animal/html/flux.html"><code>flux</code></a>.
  It applies to the juvenile and adult stages.

<HR>
<H4><A NAME="adult">adult</A></H4>

  The reproduction rate as function of time can be obtained with functions 
  <a href="../animal/html/reprod_rate.html"><code>reprod_rate</code></a> and
  <a href="../animal/html/reprod_rate_foetus.html"><code>reprod_rate_foetus</code></a>.
  In case of type M acceleration, use functions
  <a href="../animal/html/reprod_rate_j.html"><code>reprod_rate_j</code></a> or 
  <a href="../animal/html/reprod_rate_s.html"><code>reprod_rate_s</code></a>. 

  <p>
  Likewise, the cumulative reproduction as function of time can be obtained with function 
  <a href="../animal/html/cum_reprod.html"><code>cum_reprod</code></a>.
  In case of type M acceleration, use functions
  <a href="../animal/html/cum_reprod_j.html"><code>cum_reprod__j</code></a> or 
  <a href="../animal/html/cum_reprod_s.html"><code>cum_reprod_s</code></a>. 
  
  <p>
  The cumulative energy investment in milk production (most by mammals) from birth to weaning is computed by
  <a href="../animal/html/milk.html"><code>milk</code></a>.
 
  <p>
  The median age at death due to ageing is computed by
  <a href="../animal/html/get_t50_s.html"><code>get_t50_s</code></a>
  for short growth periods.
  The scaled mean age at death due to aging is computed by 
  <a href="../animal/html/get_tm_s.html"><code>get_tm_s</code></a> for short growth periods and for arbitrary growth periods by
  <a href="../animal/html/get_tm.html"><code>get_tm</code></a> and
  <a href="../animal/html/get_tm_foetus.html"><code>get_tm_foetus</code></a>.

  <p>
  Functions
  <a href="../animal/html/get_evh.html"><code>get_evh</code></a> and
  <a href="../animal/html/get_leh.html"><code>get_leh</code></a> get state variables as functions of time over the whole life cycle.

<HR>
<H4><A NAME="pars-data">pars-data</A></H4>

  Functions <code>get_pars_*</code> obtain compound DEB parameters from easy-to-observe quantities and the functions <code>iget_pars_*</code> do the reverse, which can be used for checking. 
  The theory is discussed in <a href="/thb/research/bib/KooySous2008.html">KooySous2008</a>. 
  The heating length L<sub>T</sub> is assumed to be zero in all <code>get_pars_*</code> functions. 
  An example of use is given in <code>mydata_get_pars</code>.
  The routines are organized as follows:

  <table border rules=groups>
    <colgroup span = 1 align = left>
    <colgroup span = 3 align = center>
    <colgroup span = 3 align = center>
    <tr>
       <th></th>
       <th colspan = 3> get_pars</th>
       <th colspan = 3> iget_pars</th>
    </tr>
    <tr>
       <th> food level</th>
       <th colspan = 1> one</th>
       <th colspan = 2> several</th>
       <th colspan = 1> one</th>
       <th colspan = 2> several</th>
    </tr>
    <tr>
      <th>constraint</th>
      <th> k<sub>J</sub> = k<sub>M</sub> </th> 
      <th> k<sub>J</sub> != k<sub>M</sub></th>
      <th> k<sub>J</sub> = k<sub>M</sub></th>
      <th> k<sub>J</sub> = k<sub>M</sub> </th> 
      <th> k<sub>J</sub> != k<sub>M</sub></th>
      <th> k<sub>J</sub> = k<sub>M</sub></th>
    </tr>
    <tr> 
      <th> growth </th> 
      <td> <a HREF="../animal/html/get_pars_g.html"><code>get_pars_g</code></a> </td>
      <td> <a HREF="../animal/html/get_pars_h.html"><code>get_pars_h</code></a> </td> 
      <td> <a HREF="../animal/html/get_pars_i.html"><code>get_pars_i</code></a> </td>
      <td> <a HREF="../animal/html/iget_pars_g.html"><code>iget_pars_g</code></a> </td>
      <td> <a HREF="../animal/html/iget_pars_h.html"><code>iget_pars_h<code></a> </td> 
      <td> <a HREF="../animal/html/iget_pars_i.html"><code>iget_pars_i</code></a> </td>
    </tr>
    <tr> 
      <th> growth & reprod</th> 
      <td> <a HREF="../animal/html/get_pars_r.html"><code>get_pars_</code></a> </td>
      <td> <a HREF="../animal/html/get_pars_s.html"><code>get_pars_s</code></a> </td> 
      <td> <a HREF="../animal/html/get_pars_t.html"><code>get_pars_t</code></a> </td>
      <td> <a HREF="../animal/html/iget_pars_r.html"><code>iget_pars_r</code></a> </td>
      <td> <a HREF="../animal/html/iget_pars_s.html"><code>iget_pars_s</code></a> </td> 
      <td> <a HREF="../animal/html/iget_pars_s.html"><code>iget_pars_s</code></a> </td>
    </tr>
  </table>

  Functions for several food levels do not use age at birth data. 
  If one food level is available, we have to make use of the assumption of stage transitions at fixed amounts of structure (k_M = k_J). 
  If several food levels are available, we no longer need to make this assumption, but it does simplify matters considerably. 
  Functions <a HREF="../animal/html/elas_pars_g.html"><code>elas_pars_g</code></a> and 
  <a HREF="../animal/html/elas_pars_r.html"><code>elas_pars_r</code></a> give elasticity coefficients.
  Function <a HREF="../animal/html/get_pars_u.html"><code>get_pars_u</code></a> converts compound parameters into unscaled primary parameters at abundant food.

  <p>
  Another group of <code>get_pars</code> functions obtain primary (rather than compound) parameters from data at abundant food.
  This strategy comes with assumptions about particular (chemical) parameter values (chemical potentials and the like). 
  Again, all functions assume absence of surface-area linked maintenance.
  They don't make use of the assumption k_J = k_M, but assume that k_J is known.
  By increasing the number of known parameters, we can decrease the amount of data that is needed to get the remaining parameters, as reflected in the different <code>get_par</code>s varieties:
  <a href="../animal/html/get_pars_9.html"> <code>get_pars_9</code></a>,
  <a href="../animal/html/get_pars_8.html"> <code>get_pars_8</code></a>,
  <a href="../animal/html/get_pars_7.html"> <code>get_pars_7</code></a>,
  <a href="../animal/html/get_pars_6.html"> <code>get_pars_6</code></a>,
  <a href="../animal/html/get_pars_6a.html"> <code>get_pars_6a</code></a>,
  <a href="../animal/html/get_pars_5.html"> <code>get_pars_5</code></a>,
  <a href="../animal/html/get_pars_4.html"> <code>get_pars_4</code></a>,
  <a href="../animal/html/get_pars_3.html"> <code>get_pars_3</code></a>,
  <a href="../animal/html/get_pars_2.html"> <code>get_pars_2</code></a>,
  <a href="../animal/html/get_pars_2a.html"> <code>get_pars_2a</code></a>.
  Functions
  <a href="../animal/html/iget_pars_9.html"> <code>iget_pars_9</code></a> and
  <a href="../animal/html/iget_pars_8.html"> <code>iget_pars_8</code></a> are inverse functions, from parameters to data.
  Functions   <a href="../animal/html/get_pars_9_foetus.html"> <code>get_pars_9_foetus</code></a> and 
  <a href="../animal/html/iget_pars_9_foetus.html"> <code>iget_pars_9_foetus</code></a> are for foetal development.
  One strategy to set values of "known" parameters is to use the generalized animal settings of Table 8.1 in the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book</A>.
  The maximum number of parameters than can be obtained at abundant food only is 9.

  <p>
  Functions 
  <a href="../animal/html/filter_pars_9.html"> <code>filter_pars_9</code></a> and
  <a href="../animal/html/filter_data_9.html"> <code>filter_data_9</code></a> filter allowable parameter and data combinations in the case of 9 parameters (including type M acceleration).
  Functions 
  <a href="../animal/html/filter_pars_8.html"> <code>filter_pars_8</code></a> and
  <a href="../animal/html/filter_data_8.html"> <code>filter_data_8</code></a> filter allowable parameter and data combinations in the case of 8 parameters (no acceleration).
  

<HR>
<H4><A NAME="population">population</A></H4>

The specific population growth rate at constant food density is obtained by 
  <a href="../animal/html/sgr_std.html"><code>sgr_mod</code></a>, where mod is one of the 10 DEB models 
     <a href="../animal/html/sgr_std.html"><code>std</code></a>,
     <a href="../animal/html/sgr_stf.html"><code>stf</code></a>,
     <a href="../animal/html/sgr_stx.html"><code>stx</code></a>,
     <a href="../animal/html/sgr_ssj.html"><code>ssj</code></a>,
     <a href="../animal/html/sgr_sbp.html"><code>sbp</code></a>,
     <a href="../animal/html/sgr_abj.html"><code>abj</code></a>,
     <a href="../animal/html/sgr_asj.html"><code>asj</code></a>,
     <a href="../animal/html/sgr_abp.html"><code>sbp</code></a>,
     <a href="../animal/html/sgr_hep.html"><code>hep</code></a>,
     <a href="../animal/html/sgr_hex.html"><code>hex</code></a>.
The mean age, length, squared and cubed length in the population at constant food density is computed by
  <a href="../animal/html/ssd_std.html"><code>ssd_mod</code></a>, where mod is again rplaced by one of the 10 DEB models.

<P>
The scaled functional response at which the specific population growth rate is zero is found by 
  <a href="../animal/html/f_ris0_std.html"><code>f_ris0_mod</code></a>.
Population characteristics are plotted against scaled functional response by 
  <a href="../animal/html/shssd_iso.html"><code>shssd_iso</code></a>.
See further <a href="http://www.bio.vu.nl/thb/deb/deblab/add_my_pet/popDyn/popDyn.html" target="_blank">the popDyn page of Amp</a>.

<HR>
<H4><A NAME="comparison">comparison</A></H4>

Parameter values are individual-specific, but the general idea is that intra-specific variations are small relative to inter-species variations. With this idea in mind, we can concieve the parameter values of a species as a kind of mean among all individuals of that species. DEB theory has rules for the co-variation of parameter values. Function 
<a href="../animal/html/scale.html"><code>scale</code></a> obtains eco-physiological qantities as function of the zoom-factor and function
<a href="../animal/html/shscale.html"><code>shscale</code></a> plots these quanties against maximum body weight, which itself is just one such quantity.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>docs/DEBtool_iso_21.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_iso_21</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: iso_21</H3>

Life cycle of an isomorph with 2 reserves, 1 structure and several food types.
In the present version, reserve 1 is a protein reserve and reserve 2 a non-protein reserve (carbohydrates, lipids etc).
Somatic maintenance is preferably from non-protein reserve; 
growth has a fixed stoichemetry for protein and non-protein.
Each type of food contributes to both protein and non-protein reserve, but in a type-specific way.
Feeding (including selection) follows the rules of SU-dynamics with interaction, where binding probabilities are linked to the difference between maximum and actual reserves.
Model-details and algorithms are discussed in the Comments for Section 5.2.7.

<HR>
<H4><A NAME="iso_21">iso_21</A></H4>

Obtains length and age at birth and the initial amounts of reserves, given the reserve densities at birth and parameters.

<p>
Inputs:
<ul>
 <li>m<sub>E1</sub><sup>b</sup>: scalar with reserve density 1 at birth (mol/mol)</li>
 <li>m<sub>E2</sub><sup>b</sup>: scalar with reserve density 2 at birth (mol/mol)</li>
 <li>14-vector with parameters
  <ol>
    <li>v, cm/d, energy conductance</li>
    <li>kap, -, allocation fraction to soma</li>
    <li>mu<sub>E1</sub>, J/mol, chemical potential of reserve 1</li>
    <li>mu<sub>E2<sub>, J/mol, chemical potential of reserve 2</li>
    <li>mu<sub>V</sub>, J/mol, chemical potenial of structure</li>
    <li>j<sub>E1M</sub>, mol/d.mol, specific som maint costs</li>
    <li>[M<sub>V</sub>], mol/cm^3, density of structure</li>
    <li>rho<sub>1</sub>, -, preference for reserve 1 (protein) to be used for somatic maintenance</li>
    <li>y<sub>VE1</sub>, mol/mol, yield of structure on reserve 1</li>
    <li>y<sub>VE2</sub>, mol/mol, yield of structure on reserve 2</li>
    <li>E<sub>H</sub><sup>b</sup>, J, maturity at birth</li>
   </ol>
 </li>
</ul>

<p>
Ouputs:
<ul>
  <li> L<sub>b</sub>, cm, scalar with length at birth</li>
  <li> a<sub>b</sub>, d, scalar with age at birth</li>
  <li> M<sub>E1</sub><sup>0</sup>, mol, scalar with initial reserve 1</li>
  <li> M<sub>E2</sub><sup>0</sup>, mol, scalar with initial reserve 2</li>
  <li> info: indicator for failure (0) or success (1)</li>
</ul>

<p>
<code>iso_21</code> is used in <A HREF="#iso_221"><code>iso_221</code></A>

<HR>
<H4><A NAME="iso_221">iso_221</A></H4>

Obtains a number of variables as functions of time, given profiles of 2 types of food densities and temperature and parameters.

<p>
Inputs:
<ul>
  <li> tXT: (n,4)-matrix of time since birth, food densities, temperature
      tXT(1; [2 3]) serves to specify the maternal effect, otherwise food before birth is ignored</li>
  <li>34-vector of parameters (listed in pairs of frequently related parameters):
    <ol>
      <li>M<sub>X1</sub>, M<sub>X2</sub>, mol, size of food particle of type i</li>
      <li>{F<sub>X1m</sub>}, {F<sub>X2m</sub>}, dm^2/d.cm^2, spec searching rates</li>
      <li>y<sub>P1X1</sub>, y<sub>P2X2</sub>, mol/mol, yield of feaces i on food i</li>
      <li>y<sub>E1X1</sub>, y<sub>E2X1</sub>, mol/mol, yield of reserve Ei on food X1</li>
      <li>y<sub>E1X2</sub>, y<sub>E2X2</sub>, mol/mol, yield of reserve Ei on food X2</li>
      <li>{J<sub>X1Am</sub>}, {J<sub>X2Am</sub>}, mol/d.cm^2, max specific ingestion rate for food Xi</li>
      <li>v, kappa, cm/d, energy conductance,  -, allocation fraction to soma</li>
      <li>mu<sub>E1</sub>, mu<sub>E2</sub>, J/mol, chemical potential of reserve i</li>
      <li>mu<sub>V</sub>, j<sub>E1M</sub>, J/mol, chemical potenial of structure, mol/d.mol, specific som maint costs</li>
      <li>{J<sub>E1T</sub>}, [M<sub>V</sub>], mol/d.cm^2, spec surface-area-linked som maint costs J_E1T/ J_E2T = j_E1M/ j_E2M, mol/cm^3, density of structure</li>
      <li>k<sub>J</sub>, k<sub>J</sub><sup>1</sup>, 1/d, mat maint rate coeff, spec rejuvenation rate</li>
      <li>rho<sub>1</sub>, del<sub>V</sub>, -, preference for reserve 1 to be used for som maint, -, threshold for death by shrinking</li>
      <li>y<sub>VE1</sub>, y<sub>VE2</sub>, mol/mol, yield of structure on reserve i</li>
      <li>kappa<sub>E1</sub>, kappa<sub>E2</sub>, -, fraction of rejected mobilised flux that is returned to reserve</li>
      <li>kappa<sub>R1</sub>, kappa<sub>R2</sub>, -, reproduction efficiency for reserve i</li>
      <li>E<sub>H</sub><sup>b</sup>, E<sub>H</sub><sup>p</sup>, J, maturity thresholds at birth, puberty</li>
      <li>T<sub>A</sub>, h<sub>H</sub>, K, Arrhenius temperature, 1/d, hazerd due to rejuvenation</li>
   </ol>
  <li>n<sub>O</sub>: (4,7)-matrix with chemical indices for organics X1, X2, V, E1, E2, P1, P2</li>
  <li>n<sub>M</sub>: (4,4)-matrix with chemical indices for minerals C, H, O, N</li>
</ul>

<p>
Outputs:
<ul>
  <li>(n,9)-matrix with state variables:
      cum food eaten (2), reserves (2), (max)structure, (max)maturity , cumulative allocation to reprod (2), hazard</li>
  <li>(n,6)-matrix with other variables:
      scaled functional responses (2), stress coefficients (2), competition coefficients(2)</li>
  <li>a_b, d, scalar with age at birth</li>
  <li>M_E10, M_E20: scalars with intitial reserves</li>
</ul>

<p>
Example of use: see <code>mydata_iso_221</code>

<HR>
<H4><A NAME="sgr_iso_21">sgr_iso_21</A></H4>

Obtains the specific growth rate d/dt ln V with 2 reserves as function of the reserve densities (protein and non-protein) and parameters, allowing for shrinking.
It uses a Newton Raphson method with continuation.
Notice that the reserve turnover rate k<sub>E</sub> (input number 8) and the specific somatic maintenance j<sub>EiS</sub> generally change in time (i.e. the surface-linked part of somatic maintenance).
See <A HREF="#gr_iso_21"><code>gr_iso_21</code></A> for growth rate d/dt L (for embryo case)

<p>
Inputs: 10 or 11 scalars, the first 6 are listed in pairs of related quantities
<ul>
 <li>m<sub>E1</sub>, m<sub>E2</sub>:   mol/mol, scalars with reserve density</li>
 <li>j<sub>E1S</sub>, j<sub>E2S</sub>: mol/d.mol, scalars with spec maintenance flux if from reserve</li>
 <li>y<sub>VE1</sub>, y<sub>VE2</sub>: mol/mol, scalars with yield of structure on reserve</li>
 <li>mu<sub>E1</sub>/ mu<sub>V</sub>: -, scalar with ratio of chemical potentials (mu<sub>E1</sub> j<sub>E1S</sub> = mu<sub>E2</sub> j<sub>E2S</sub>)</li>
 <li>k<sub>E</sub>:  1/d, scalar with reserve turnover rate v/ L</li>
 <li>kappa: -, scalar with allowcation fraction to soma</li>
 <li>rho<sub>1/sub>: -, scalar with preference for reserve 1 (protein) to be used from somatic maintenance (default 0)</li>
 <li>r<sub>0</sub>: 1/d, optional scalar with initial estimate for r<br>
     if empty or undefined: 0; else previous result is used</li>
</ul>

<p>
Outputs:
<ul>
  <li>r: 1/d, scalar with spec growth rate</li>
  <li>j<sub>E1</sub><sup>S</sup>, j<sub>E2</sub><sup>S</sup>: 
      mol/d.mol, scalars with  spec som maintenance flux</li>
  <li>j<sub>E1C</sub>, j<sub>E2C</sub>: \
      mol/d.mol, scalars with rejected flux of reserve fro growth SUs</li>
  <li>info: -, scalar with numerical failure (0) or success (1)</li>
</ul>

<p>
Example of use: 
<code>[r, j_E1_S, j_E2_S, j_E1C, j_E2C, info] = sgr_iso_21 (.4, .6, .02, .04, .8, .8, 1, .1, .8, .1)</code>

<HR>
<H4><A NAME="gr_iso_21">gr_iso_21</A></H4>

Obtains the growth rate d/dt L with 2 reserves as function of the reserve densities (protein and non-protein) and parameters, not allowing for shrinking.
It uses a Newton Raphson method with continuation.
See <A HREF="#sgr_iso_21"><code>sgr_iso_21</code></A> for specific growth rate d/dt ln V (for juveniles and adults); <code>gr_21</code> is meant for embryos.

<p>
Inputs: 10 or 11 scalars; after the first one, 3 are listed in pairs of related quantities
<ul>
  <li>L: cm, scalar with structural length</li>
  <li>m<sub>E1</sub>, m<sub>E2</sub>:   mol/mol,   scalars with reserve density</li>
  <li>j<sub>E1M</sub>, j<sub>E2M</sub>: mol/d.mol, scalars with spec maintenance flux if from that reserve</li>
  <li>y<sub>VE1</sub>, y<sub>VE2</sub>: mol/mol, scalars with yield of structure on reserve</li>
  <li>v: cm/d, scalar with energy conductance</li>
  <li>kappa: -, scalar with allowcation fraction to soma</li>
  <li>rho<sub>1</sub>: -, scalar with preference for reserve 1 (protein) to be used for somatic maintenance (default 0)</li>
  <li>v<sub>B</sub><sup>0</sup>: cm/d, optional scalar with initial estimate for v<sub>B</sub><br>
      if empty or undefined v/3, else previous result is used</li>
</ul>

<p>
Outputs:
<ul>
  <li>v<sub>B</sub>: cm/d, scalar with growth rate d/dt L</li>
  <li>j_<sub>E1</sub><sup>M</sup>, j<sub>E2</sub><sup>M</sup>: mol/d.mol, scalars with spec som maintenance flux</li>
  <li>j<sub>E1C</sub>, j<sub>E2C</sub>: mol/d.mol, scalars with rejected flux of reserve fro growth SUs</li>
  <li>info: -, scalar with numerical failure (0) or success (1)</li>
</ul>

<p>
Example of use: 
<code>[v_B, j_E1_S, j_E2_S, j_E1C, j_E2C, info] = gr_iso_21 (.1, .4, .6, .02, .04, .8, .8, 1, .02, .8, .1)</code>

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>animal/html/read_Species.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>read_Species</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="read_Species.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">Reads Species.xls and assigns parameters and variables</a></li><li><a href="#2">species_list</a></li><li><a href="#3">primary_parameters at T_ref</a></li><li><a href="#4">statistics at T and f</a></li></ul></div><h2>Reads Species.xls and assigns parameters and variables<a name="1"></a></h2><pre class="codeinput">  <span class="comment">% file = 'Species.xls'; file + path is set in sh-scripts</span>
</pre><h2>species_list<a name="2"></a></h2><pre class="codeinput">  <span class="comment">% read TYPE, FIT, COMPLETE</span>
  sheet = 1; <span class="comment">% species_list; xlsread in new versions of Matlab cannot read names of sheets</span>
  COMPLETE = xlsread(file, sheet, <span class="string">'I2:I1000'</span>); <span class="comment">% read COMPLETE marks</span>
  <span class="comment">% TYPE: 0 = weird; 1 = standard DEB; 2 = foetus; 3 = acceleration; 4 = foetus + acceleration</span>
  TYPE = xlsread(file, sheet, <span class="string">'G2:G1000'</span>); <span class="comment">% read types</span>
  FIT = xlsread(file, sheet, <span class="string">'H2:H1000'</span>);  <span class="comment">% read FIT marks</span>
  n_species = size(COMPLETE,1);

  <span class="comment">% read taxa</span>
  txt_n = num2str(1+n_species); <span class="comment">% xlsread in new versions of Matlab reads txt-columns till space-rows minus one</span>
  [x phylum]  = xlsread(file, sheet, [<span class="string">'A2:A'</span>, txt_n]); <span class="comment">% read phylum name</span>
  [x class]   = xlsread(file, sheet, [<span class="string">'B2:B'</span>, txt_n]); <span class="comment">% read class name</span>
  [x order]   = xlsread(file, sheet, [<span class="string">'C2:C'</span>, txt_n]); <span class="comment">% read order name</span>
  [x family]  = xlsread(file, sheet, [<span class="string">'D2:D'</span>, txt_n]); <span class="comment">% read family name</span>
  [x species] = xlsread(file, sheet, [<span class="string">'E2:E'</span>, txt_n]); <span class="comment">% read species name</span>

  <span class="comment">% identify taxa</span>
  n0 = zeros(n_species,1); <span class="comment">% number of species</span>
  <span class="comment">% initiate taxa</span>
  superphylum = phylum; genus = species; spec = species;
  radiata = n0; bilateria = n0; platyzoa = n0; lophotrochozoa = n0; ecdysozoa = n0;
  deuterostomata = n0; vertebrata = n0; endotherms = n0; fish = n0; Aves = n0; Mammalia = n0;
  <span class="comment">% assign taxa spec, genus &amp; superphylum as cells and some high taxa as boleans</span>
  <span class="keyword">for</span> i = 1:n_species
      radiata(i) =  <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Ctenophora'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Cnidaria'</span>);
      bilateria(i) =  <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Chaetognatha'</span>);
      platyzoa(i) =  <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Platyhelminthes'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Acanthocephala'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Rotifera'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Gastrotricha'</span>);
      lophotrochozoa(i) = <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Annelida'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Mollusca'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Bryozoa'</span>);
      ecdysozoa(i) = <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Nematoda'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Tardigrada'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Arthropoda'</span>);
      deuterostomata(i) = <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Echinodermata'</span>)| <span class="keyword">...</span>
             strcmp(phylum{i}, <span class="string">'Chordata'</span>);
      vertebrata(i) = <span class="keyword">...</span>
             strcmp(class{i}, <span class="string">'Myxini'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Cephalaspidomorphi'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Chondrichthyes'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Actinopterygii'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Sarcopterygii'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Amphibia'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Reptilia'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Aves'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Mammalia'</span>);
      fish(i) = <span class="keyword">...</span>
             strcmp(class{i}, <span class="string">'Myxini'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Cephalaspidomorphi'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Chondrichthyes'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Actinopterygii'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Sarcopterygii'</span>);
      endotherms(i) = <span class="keyword">...</span><span class="comment">;</span>
             strcmp(class{i}, <span class="string">'Aves'</span>)| <span class="keyword">...</span><span class="comment">.</span>
             strcmp(class{i}, <span class="string">'Mammalia'</span>);
      Aves(i) = strcmp(class{i}, <span class="string">'Aves'</span>);
      Mammalia(i) = strcmp(class{i}, <span class="string">'Mammalia'</span>);
      <span class="keyword">if</span> radiata(i) == 1
          superphylum{i} = <span class="string">'radiata'</span>;
      <span class="keyword">elseif</span> bilateria(i) == 1
          superphylum{i} = <span class="string">'bilateria'</span>;
      <span class="keyword">elseif</span> platyzoa(i) == 1
          superphylum{i} = <span class="string">'platyzoa'</span>;
      <span class="keyword">elseif</span> lophotrochozoa(i) == 1
          superphylum{i} = <span class="string">'lophotrochozoa'</span>;
      <span class="keyword">elseif</span> ecdysozoa(i) == 1
          superphylum{i} = <span class="string">'ecdysozoa'</span>;
      <span class="keyword">elseif</span> deuterostomata(i) == 1
          superphylum{i} = <span class="string">'deuterostomata'</span>;
      <span class="keyword">end</span>
      <span class="keyword">if</span> strcmp(class{i}, <span class="string">'Insecta'</span>)
          TYPE(i) = 0;
      <span class="keyword">end</span>
      txt = species{i}; s = [findstr(<span class="string">'_'</span>, txt), 1 + size(txt,2)];
      genus{i} = txt(1: s(1) - 1); spec{i} = txt(s(1) + 1 : s(2) - 1);
  <span class="keyword">end</span>

  n_radi = sum(radiata); n_bila = sum(bilateria); n_plat = sum(platyzoa);
  n_loph = sum(lophotrochozoa); n_ecdy = sum(ecdysozoa); n_deut = sum(deuterostomata);
  n_vert = sum(vertebrata); n_endo = sum(endotherms);
  <span class="comment">% set colours for taxa</span>
  color = zeros(n_species,3);           <span class="comment">% RGB colours, black by default</span>
  col_radi = [0 0 1]; color(radiata == 1,:) = ones(n_radi,1) * col_radi; <span class="comment">% blue</span>
  col_bila = [.8 .8 0]; color(bilateria == 1,:) = ones(n_bila,1) * col_bila;<span class="comment">% dark blue</span>
  col_plat = [0 1 1]; color(platyzoa == 1, :) = ones(n_plat,1) * col_plat; <span class="comment">% turquoise</span>
  col_loph = [0 .8 .8]; color(lophotrochozoa == 1, :) = ones(n_loph,1) * col_loph;<span class="comment">% dark turquoise</span>
  col_ecdy = [0 1 0]; color(ecdysozoa == 1,:) = ones(n_ecdy,1) * col_ecdy; <span class="comment">% green</span>
  col_deut = [0 0 0]; <span class="comment">% invertebrate deuterostomata, black</span>
  col_vert = [1 0 1]; color(vertebrata == 1,:) = ones(n_vert,1) * col_vert; <span class="comment">% magenta</span>
  col_endo = [1 0 0]; color(endotherms == 1,:) = ones(n_endo,1) * col_endo; <span class="comment">% red</span>
  marker(1:n_species,1) = <span class="string">'*'</span>;
  taxa = {<span class="string">'radi'</span>; <span class="string">'bila'</span>; <span class="string">'plat'</span>; <span class="string">'loph'</span>; <span class="string">'ecdy'</span>; <span class="string">'deut'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>};
  col_taxa = [col_radi; col_bila; col_plat; col_loph; col_ecdy; col_deut; col_vert; col_endo];

  <span class="comment">% define selections for plotting</span>
  sel_1 = (TYPE == 1 | TYPE == 2) &amp; ~vertebrata;
  sel_2 = (TYPE == 1 | TYPE == 2) &amp; vertebrata;
  sel_3 = (TYPE == 1 | TYPE == 2) &amp; endotherms;
  sel_4 = (TYPE == 3 | TYPE == 4) &amp; ~vertebrata;
  sel_5 = (TYPE == 3 | TYPE == 4) &amp; vertebrata;
  sel_6 = (TYPE == 3 | TYPE == 4) &amp; endotherms;
</pre><h2>primary_parameters at T_ref<a name="3"></a></h2><pre class="codeinput">  sheet = 2; <span class="comment">% primary_parameters: xlsread in new versions of Matlab cannot read names of sheets</span>
  pars = xlsread(file, sheet , <span class="string">'B2:AS1000'</span>); <span class="comment">% read parameters</span>

  <span class="comment">% unpack pars, z, pAm, v refer to neonate settings (in case of acceleration)</span>
  z    = pars(:,8);
  pAm  = pars(:,13);                        <span class="comment">% pAm_j = pAm .* sM;</span>
  v    = pars(:,14);                        <span class="comment">% vj = v .* sM; % cm/d, energy conductance after metamorphosis</span>
  kap  = pars(:,15);
  kapR = pars(:,16);
  pM   = pars(:,17);
  pT   = pars(:,18);
  kJ   = pars(:,19);
  EG   = pars(:,20);
  EHb  = pars(:,21);
  EHj  = pars(:,22);
  EHp  = pars(:,23);
  ha   = pars(:,24);
  sG   = pars(:,25);
  mu_E = pars(:,28);
  dV   = pars(:,31);
  wV   = 12 + pars(:,37:39) * [1; 16; 14];
  wE   = 12 + pars(:,40:42) * [1; 16; 14];

  <span class="comment">% compound parameters</span>
  kM = pM ./ EG;                           <span class="comment">% 1/d, somatic maintenance rate coefficient</span>
  k = kJ ./ kM;                            <span class="comment">% -, maintenance ratio</span>
  Em = pAm ./ v;                           <span class="comment">% J/cm^3, max reserve capacity</span>
  g = EG ./ kap ./ Em;                     <span class="comment">% -, energy investment ratio</span>
  LT = pT ./ pM;                           <span class="comment">% cm, heating length</span>
  Lm = kap .* pAm ./ pM;                   <span class="comment">% cm, max structural length: refers to neonate</span>
  lT = LT ./ Lm;                           <span class="comment">% -, scaled heating length</span>
  U_Hb = EHb ./ pAm;                       <span class="comment">% cm^2 d, scaled maturity at birth</span>
  V_Hb = U_Hb ./ (1 - kap);                <span class="comment">% cm^2 d, scaled maturity at birth</span>
  v_Hb = V_Hb .* g.^2 .* kM.^3 ./ v.^2;    <span class="comment">% -, scaled maturity at birth</span>
  U_Hj = EHj ./ pAm;                       <span class="comment">% cm^2 d, scaled maturity at metamorphosis</span>
  V_Hj = U_Hj ./ (1 - kap);                <span class="comment">% cm^2 d, scaled maturity at metamorposis</span>
  v_Hj = V_Hj .* g.^2 .* kM.^3 ./ v.^2;    <span class="comment">% -, scaled maturity at metamorphosis</span>
  U_Hp = EHp ./ pAm;                       <span class="comment">% cm^2 d, scaled maturity at puberty</span>
  V_Hp = U_Hp ./ (1 - kap);                <span class="comment">% cm^2 d, scaled maturity at puberty</span>
  v_Hp = V_Hp .* g.^2 .* kM.^3 ./ v.^2;    <span class="comment">% -, scaled maturity at puberty</span>
</pre><h2>statistics at T and f<a name="4"></a></h2><pre class="codeinput">  sheet = 3; <span class="comment">% statistics: xlsread in new versions of Matlab cannot read names of sheets</span>
  vars = xlsread(file, sheet, <span class="string">'A2:DB1000'</span>); <span class="comment">% read statistics</span>

  <span class="comment">% z relates to before acceleration (birth), zj to after acceleration (metamorphosis)</span>
  TC = vars(:,3);  <span class="comment">% -, temp correction factor</span>
  E0 = vars(:,8);  <span class="comment">% J, initial (egg) reserve mass</span>
  Lb = vars(:,11); <span class="comment">% cm, structural length at birth</span>
  Lj = vars(:,16); <span class="comment">% cm, structural length at metamorphosis</span>
  Lp = vars(:,21); <span class="comment">% cm, structural length at puberty</span>
  Li = vars(:,27); <span class="comment">% cm, ultimate structural length (after metam)</span>
  Li(TYPE==0) = Lj(TYPE==0); <span class="comment">% set ultimate length to length at metam for insects</span>

  s_M = Lj ./ Lb;  <span class="comment">% -, acceleration</span>
  vj = v .* s_M;    <span class="comment">% cm/d, energy conductance after metamorphosis</span>
  pAmj = pAm .* s_M;<span class="comment">% J/d.cm^2, max spec assim rate after metamorphosis</span>

  l_p = Lp ./ Li;  <span class="comment">% -, determinateness</span>
  zj = z .* s_M;   <span class="comment">% -, zoom factor for late juveniles and adults</span>
  zj3 = zj .* zj .* zj; <span class="comment">% -, cubed zj</span>

  s_H = log10(EHp ./ EHb); <span class="comment">% altriciality index</span>

  M_E0_min = vars(:,4);
  M_E0_max = vars(:,7);
  twin = M_E0_max ./ M_E0_min;
  s_E = log10(twin);     <span class="comment">% -, yolkiness</span>
  Wdm = vars(:,30);      <span class="comment">% g, max dry weight</span>
  Wwm = Wdm ./ dV;       <span class="comment">% g, max wet weight</span>

  fmin = vars(:,44);     <span class="comment">% -, f at which growth and mat ceases at p</span>
  VO = vars(:,77) ./ TC; <span class="comment">% mol O2/d, respiration at 20 C</span>
  kapG = vars(:,79);     <span class="comment">% -, growth efficiency</span>
  rB = vars(:,81) ./ TC; <span class="comment">% 1/d, von Bertalanffy growth rate</span>
  Ri = vars(:,82) ./ TC; <span class="comment">% #/d, reprod rate at 20 C</span>
  ab = vars(:,84) .* TC; <span class="comment">% d, age at birth at 20 C</span>
  ap = vars(:,86) .* TC; <span class="comment">% d, age at puberty at 20 C</span>
  am = vars(:,88) .* TC; <span class="comment">% d, age at death at 20 C</span>
  rm = max(1e-10, vars(:,97)) ./ TC; <span class="comment">% 1/d, population growth rate at 20 C</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% Reads Species.xls and assigns parameters and variables
 
  % file = 'Species.xls'; file + path is set in sh-scripts
  
%% species_list

  % read TYPE, FIT, COMPLETE
  sheet = 1; % species_list; xlsread in new versions of Matlab cannot read names of sheets
  COMPLETE = xlsread(file, sheet, 'I2:I1000'); % read COMPLETE marks
  % TYPE: 0 = weird; 1 = standard DEB; 2 = foetus; 3 = acceleration; 4 = foetus + acceleration
  TYPE = xlsread(file, sheet, 'G2:G1000'); % read types
  FIT = xlsread(file, sheet, 'H2:H1000');  % read FIT marks
  n_species = size(COMPLETE,1); 
  
  % read taxa 
  txt_n = num2str(1+n_species); % xlsread in new versions of Matlab reads txt-columns till space-rows minus one
  [x phylum]  = xlsread(file, sheet, ['A2:A', txt_n]); % read phylum name
  [x class]   = xlsread(file, sheet, ['B2:B', txt_n]); % read class name
  [x order]   = xlsread(file, sheet, ['C2:C', txt_n]); % read order name
  [x family]  = xlsread(file, sheet, ['D2:D', txt_n]); % read family name
  [x species] = xlsread(file, sheet, ['E2:E', txt_n]); % read species name
    
  % identify taxa
  n0 = zeros(n_species,1); % number of species
  % initiate taxa
  superphylum = phylum; genus = species; spec = species;
  radiata = n0; bilateria = n0; platyzoa = n0; lophotrochozoa = n0; ecdysozoa = n0; 
  deuterostomata = n0; vertebrata = n0; endotherms = n0; fish = n0; Aves = n0; Mammalia = n0;
  % assign taxa spec, genus & superphylum as cells and some high taxa as boleans
  for i = 1:n_species
      radiata(i) =  ...
             strcmp(phylum{i}, 'Ctenophora')| ...
             strcmp(phylum{i}, 'Cnidaria');
      bilateria(i) =  ...
             strcmp(phylum{i}, 'Chaetognatha');
      platyzoa(i) =  ...
             strcmp(phylum{i}, 'Platyhelminthes')| ...
             strcmp(phylum{i}, 'Acanthocephala')| ...
             strcmp(phylum{i}, 'Rotifera')| ...
             strcmp(phylum{i}, 'Gastrotricha'); 
      lophotrochozoa(i) = ...
             strcmp(phylum{i}, 'Annelida')| ...
             strcmp(phylum{i}, 'Mollusca')| ...
             strcmp(phylum{i}, 'Bryozoa'); 
      ecdysozoa(i) = ...  
             strcmp(phylum{i}, 'Nematoda')| ...
             strcmp(phylum{i}, 'Tardigrada')| ...
             strcmp(phylum{i}, 'Arthropoda'); 
      deuterostomata(i) = ... 
             strcmp(phylum{i}, 'Echinodermata')| ...
             strcmp(phylum{i}, 'Chordata');
      vertebrata(i) = ...
             strcmp(class{i}, 'Myxini')| ....
             strcmp(class{i}, 'Cephalaspidomorphi')| ....
             strcmp(class{i}, 'Chondrichthyes')| ....
             strcmp(class{i}, 'Actinopterygii')| ....
             strcmp(class{i}, 'Sarcopterygii')| ....
             strcmp(class{i}, 'Amphibia')| ....
             strcmp(class{i}, 'Reptilia')| ....
             strcmp(class{i}, 'Aves')| ....
             strcmp(class{i}, 'Mammalia');
      fish(i) = ...
             strcmp(class{i}, 'Myxini')| ....
             strcmp(class{i}, 'Cephalaspidomorphi')| ....
             strcmp(class{i}, 'Chondrichthyes')| ....
             strcmp(class{i}, 'Actinopterygii')| ....
             strcmp(class{i}, 'Sarcopterygii');
      endotherms(i) = ...;
             strcmp(class{i}, 'Aves')| ....
             strcmp(class{i}, 'Mammalia');
      Aves(i) = strcmp(class{i}, 'Aves');
      Mammalia(i) = strcmp(class{i}, 'Mammalia');
      if radiata(i) == 1
          superphylum{i} = 'radiata';
      elseif bilateria(i) == 1
          superphylum{i} = 'bilateria';
      elseif platyzoa(i) == 1
          superphylum{i} = 'platyzoa';
      elseif lophotrochozoa(i) == 1
          superphylum{i} = 'lophotrochozoa';
      elseif ecdysozoa(i) == 1
          superphylum{i} = 'ecdysozoa';
      elseif deuterostomata(i) == 1
          superphylum{i} = 'deuterostomata';
      end
      if strcmp(class{i}, 'Insecta')
          TYPE(i) = 0;
      end
      txt = species{i}; s = [findstr('_', txt), 1 + size(txt,2)];
      genus{i} = txt(1: s(1) - 1); spec{i} = txt(s(1) + 1 : s(2) - 1);
  end

  n_radi = sum(radiata); n_bila = sum(bilateria); n_plat = sum(platyzoa);
  n_loph = sum(lophotrochozoa); n_ecdy = sum(ecdysozoa); n_deut = sum(deuterostomata);
  n_vert = sum(vertebrata); n_endo = sum(endotherms);
  % set colours for taxa
  color = zeros(n_species,3);           % RGB colours, black by default
  col_radi = [0 0 1]; color(radiata == 1,:) = ones(n_radi,1) * col_radi; % blue 
  col_bila = [.8 .8 0]; color(bilateria == 1,:) = ones(n_bila,1) * col_bila;% dark blue 
  col_plat = [0 1 1]; color(platyzoa == 1, :) = ones(n_plat,1) * col_plat; % turquoise
  col_loph = [0 .8 .8]; color(lophotrochozoa == 1, :) = ones(n_loph,1) * col_loph;% dark turquoise
  col_ecdy = [0 1 0]; color(ecdysozoa == 1,:) = ones(n_ecdy,1) * col_ecdy; % green
  col_deut = [0 0 0]; % invertebrate deuterostomata, black
  col_vert = [1 0 1]; color(vertebrata == 1,:) = ones(n_vert,1) * col_vert; % magenta
  col_endo = [1 0 0]; color(endotherms == 1,:) = ones(n_endo,1) * col_endo; % red
  marker(1:n_species,1) = '*';
  taxa = {'radi'; 'bila'; 'plat'; 'loph'; 'ecdy'; 'deut'; 'vert'; 'endo'};
  col_taxa = [col_radi; col_bila; col_plat; col_loph; col_ecdy; col_deut; col_vert; col_endo];

  % define selections for plotting
  sel_1 = (TYPE == 1 | TYPE == 2) & ~vertebrata;
  sel_2 = (TYPE == 1 | TYPE == 2) & vertebrata;
  sel_3 = (TYPE == 1 | TYPE == 2) & endotherms;
  sel_4 = (TYPE == 3 | TYPE == 4) & ~vertebrata;
  sel_5 = (TYPE == 3 | TYPE == 4) & vertebrata;
  sel_6 = (TYPE == 3 | TYPE == 4) & endotherms;

  
%% primary_parameters at T_ref

  sheet = 2; % primary_parameters: xlsread in new versions of Matlab cannot read names of sheets
  pars = xlsread(file, sheet , 'B2:AS1000'); % read parameters                             
  
  % unpack pars, z, pAm, v refer to neonate settings (in case of acceleration)
  z    = pars(:,8);
  pAm  = pars(:,13);                        % pAm_j = pAm .* sM;
  v    = pars(:,14);                        % vj = v .* sM; % cm/d, energy conductance after metamorphosis
  kap  = pars(:,15);
  kapR = pars(:,16);
  pM   = pars(:,17);
  pT   = pars(:,18);
  kJ   = pars(:,19);
  EG   = pars(:,20);
  EHb  = pars(:,21);
  EHj  = pars(:,22);
  EHp  = pars(:,23);
  ha   = pars(:,24);
  sG   = pars(:,25);
  mu_E = pars(:,28);
  dV   = pars(:,31); 
  wV   = 12 + pars(:,37:39) * [1; 16; 14];
  wE   = 12 + pars(:,40:42) * [1; 16; 14];

  % compound parameters
  kM = pM ./ EG;                           % 1/d, somatic maintenance rate coefficient
  k = kJ ./ kM;                            % -, maintenance ratio
  Em = pAm ./ v;                           % J/cm^3, max reserve capacity
  g = EG ./ kap ./ Em;                     % -, energy investment ratio
  LT = pT ./ pM;                           % cm, heating length
  Lm = kap .* pAm ./ pM;                   % cm, max structural length: refers to neonate
  lT = LT ./ Lm;                           % -, scaled heating length
  U_Hb = EHb ./ pAm;                       % cm^2 d, scaled maturity at birth
  V_Hb = U_Hb ./ (1 - kap);                % cm^2 d, scaled maturity at birth
  v_Hb = V_Hb .* g.^2 .* kM.^3 ./ v.^2;    % -, scaled maturity at birth
  U_Hj = EHj ./ pAm;                       % cm^2 d, scaled maturity at metamorphosis 
  V_Hj = U_Hj ./ (1 - kap);                % cm^2 d, scaled maturity at metamorposis
  v_Hj = V_Hj .* g.^2 .* kM.^3 ./ v.^2;    % -, scaled maturity at metamorphosis
  U_Hp = EHp ./ pAm;                       % cm^2 d, scaled maturity at puberty 
  V_Hp = U_Hp ./ (1 - kap);                % cm^2 d, scaled maturity at puberty
  v_Hp = V_Hp .* g.^2 .* kM.^3 ./ v.^2;    % -, scaled maturity at puberty

%% statistics at T and f

  sheet = 3; % statistics: xlsread in new versions of Matlab cannot read names of sheets
  vars = xlsread(file, sheet, 'A2:DB1000'); % read statistics
  
  % z relates to before acceleration (birth), zj to after acceleration (metamorphosis)
  TC = vars(:,3);  % -, temp correction factor
  E0 = vars(:,8);  % J, initial (egg) reserve mass
  Lb = vars(:,11); % cm, structural length at birth
  Lj = vars(:,16); % cm, structural length at metamorphosis
  Lp = vars(:,21); % cm, structural length at puberty
  Li = vars(:,27); % cm, ultimate structural length (after metam)
  Li(TYPE==0) = Lj(TYPE==0); % set ultimate length to length at metam for insects

  s_M = Lj ./ Lb;  % -, acceleration
  vj = v .* s_M;    % cm/d, energy conductance after metamorphosis
  pAmj = pAm .* s_M;% J/d.cm^2, max spec assim rate after metamorphosis
  
  l_p = Lp ./ Li;  % -, determinateness
  zj = z .* s_M;   % -, zoom factor for late juveniles and adults
  zj3 = zj .* zj .* zj; % -, cubed zj

  s_H = log10(EHp ./ EHb); % altriciality index

  M_E0_min = vars(:,4); 
  M_E0_max = vars(:,7); 
  twin = M_E0_max ./ M_E0_min;
  s_E = log10(twin);     % -, yolkiness
  Wdm = vars(:,30);      % g, max dry weight
  Wwm = Wdm ./ dV;       % g, max wet weight
  
  fmin = vars(:,44);     % -, f at which growth and mat ceases at p
  VO = vars(:,77) ./ TC; % mol O2/d, respiration at 20 C
  kapG = vars(:,79);     % -, growth efficiency
  rB = vars(:,81) ./ TC; % 1/d, von Bertalanffy growth rate
  Ri = vars(:,82) ./ TC; % #/d, reprod rate at 20 C
  ab = vars(:,84) .* TC; % d, age at birth at 20 C
  ap = vars(:,86) .* TC; % d, age at puberty at 20 C
  am = vars(:,88) .* TC; % d, age at death at 20 C
  rm = max(1e-10, vars(:,97)) ./ TC; % 1/d, population growth rate at 20 C

##### SOURCE END #####
--></body></html>

<|start_filename|>animal/html/mydata_ue0.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_ue0</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="mydata_ue0.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">test on constraints on parameters</a></li><li><a href="#4">return</a></li><li><a href="#6">first obtain lb for foetus case</a></li><li><a href="#7">get lb via Newton Raphson on y(x_b) = y_b with Euler</a></li><li><a href="#8">get lb via Newton Raphson on y(x_b) = y_b with ode solver</a></li><li><a href="#9">get lb, tb lb uE0 by shooting method on d/dx y</a></li><li><a href="#10">get lb via shooting on d/d u_H tau u_E l</a></li><li><a href="#11">compare results for uE0 tB uHb uEb lb</a></li><li><a href="#12">differences are mainly due to differences in lb</a></li><li><a href="#13">prepare plotting</a></li><li><a href="#14">the better the curves uH(tau_b) matches uH_b,</a></li><li><a href="#15">the more accurate the estimation of l_b has been</a></li></ul></div><pre class="codeinput"><span class="comment">%  created by <NAME>, modified 2009/09/29</span>

<span class="comment">% get (u_E^0, \tau_b, l_b) from (kap, g, k, u_H^b) and e_b = f</span>
<span class="comment">% strategy: get first l_b, then u_E^0 and \tau_b</span>
<span class="comment">%</span>
<span class="comment">% Scaling:</span>
<span class="comment">%  u_E = U_E g^2 k_M^3/ v^2; U_E = M_E/ {J_EAm}      reserve</span>
<span class="comment">%  u_H = U_H g^2 k_M^3/ v^2; U_H = M_H/ {J_EAm}      maturity</span>
<span class="comment">%  l_b = L_b/ L_m = Lb g k_M/ v                      length at birth</span>
<span class="comment">%  \tau = a k_M                                      age</span>
<span class="comment">%  k = k_J/ k_M                                      maintenance ratio</span>

<span class="keyword">global</span> g k kap <span class="comment">% for plotting (tranfer to dhul)</span>

f = 1; <span class="comment">% scaled functional response</span>
g = 6; k = 6; kap = .8; uHb = .001; vHb = uHb/ (1 - kap);

par = [g k vHb]; <span class="comment">% pack parameters</span>
</pre><h2>test on constraints on parameters<a name="2"></a></h2><pre class="codeinput"><span class="keyword">if</span> kap &lt; 0 || kap &gt; 1 || g &lt; 0 || <span class="keyword">...</span>
</pre><pre class="codeinput">      k &lt; 0 || k &gt; (1 - kap) * f^3/ uHb || <span class="keyword">...</span><span class="comment"> % else d/d tau l|tau_b &lt; 0</span>
      uHb + kap &lt; 0 || <span class="keyword">...</span><span class="comment"> % else l_b &gt; 1</span>
      k^2 * uHb/ (1 - kap) - k * g - k + g &gt; g^3 * (k - 1)/ k^2 * <span class="keyword">...</span>
      (1 - 3/ g - exp(-3 * k/ g)) * 2/ 9
  fprintf(<span class="string">'parameters out of range \n'</span>);
</pre><h2>return<a name="4"></a></h2><pre class="codeinput"><span class="keyword">end</span>
</pre><h2>first obtain lb for foetus case<a name="6"></a></h2><pre>might speed up get_lb and get_lb1 for k neq 1</pre><pre class="codeinput">lb_foetus = get_lb_foetus(par);
</pre><h2>get lb via Newton Raphson on y(x_b) = y_b with Euler<a name="7"></a></h2><pre>'fast and dirty'</pre><pre class="codeinput">[lb, info] = get_lb(par,f,lb_foetus);
tb = get_tb(par,f,lb);
uE0 = get_ue0(par,f,lb);
uEb = f * lb^3/ g;
result = [info uE0 tb uEb lb]'; <span class="comment">% collect results</span>
</pre><h2>get lb via Newton Raphson on y(x_b) = y_b with ode solver<a name="8"></a></h2><pre>more acurate and slower than get_lb</pre><pre class="codeinput">[lb1, info1] = get_lb1(par,f,lb_foetus);
tb1 = get_tb(par,f,lb1);
uE01 = get_ue0(par,f,lb1);
uEb1 = f * lb1^3/ g;
result1 = [info1 uE01 tb1 uEb1 lb1]'; <span class="comment">% collect results</span>
</pre><h2>get lb, tb lb uE0 by shooting method on d/dx y<a name="9"></a></h2><pre class="codeinput">[lb2, info2] = get_lb2(par,f,lb_foetus);
tb2 = get_tb(par,f,lb2);
uE02 = get_ue0(par,f,lb2);
uEb2 = f * lb2^3/ g;
result2 = [info2 uE02 tb2 uEb2 lb2]'; <span class="comment">% collect results</span>
</pre><h2>get lb via shooting on d/d u_H tau u_E l<a name="10"></a></h2><pre>not recommended; just for checking
small domain of attraction; slow</pre><pre class="codeinput">[tul_b, uE03, info3] = get_tul(par,f,lb_foetus);
tb3 = tul_b(1); uEb3 = tul_b(2); lb3 = tul_b(3); <span class="comment">% unpack results</span>
result3 = [info3 uE03 tb3 uEb3 lb3]'; <span class="comment">% collect results</span>
</pre><h2>compare results for uE0 tB uHb uEb lb<a name="11"></a></h2><pre class="codeinput">txt = [{<span class="string">'info'</span>}; {<span class="string">'uE0'</span>}; {<span class="string">'tB'</span>}; {<span class="string">'uEb'</span>}; {<span class="string">'lb'</span>}];
</pre><h2>differences are mainly due to differences in lb<a name="12"></a></h2><pre class="codeinput">fprintf(<span class="string">'      get_lb    get_lb1   get_lb2   get_tul \n'</span>);
print_txt_var(txt, [result result1 result2 result3])
</pre><pre class="codeoutput">      get_lb    get_lb1   get_lb2   get_tul 
info  1.000000  1.000000  1.000000  1.000000
uE0  0.008171  0.008163  0.008155  0.008167
tB  0.147049  0.147002  0.146955  0.146890
uEb  0.001109  0.001108  0.001107  0.001107
lb  0.188068  0.188007  0.187948  0.188072
</pre><h2>prepare plotting<a name="13"></a></h2><pre class="codeinput">  t = linspace(0,tb,100)';
  t1 = linspace(0,tb1,100)';
  t2 = linspace(0,tb2,100)';
  t3 = linspace(0,tb3,100)';

  l0 = 1e-6;
  vH0 = uE0 * l0^2 * (g + l0)/ (uE0 + l0^3)/ k;
  hul_0 = [vH0; uE0; l0];
  [t, hul_t] = ode23s(<span class="string">'dhul'</span>, t, hul_0);
  vH = hul_t(:,1); uE = hul_t(:,2); l = hul_t(:,3);

  vH01 = uE01 * l0^2 * (g + l0)/ (uE01 + l0^3)/ k;
  hul1_0 = [vH01; uE01; l0];
  [t1, hul1_t] = ode23s(<span class="string">'dhul'</span>, t1, hul1_0);
  vH1 = hul1_t(:,1); uE1 = hul1_t(:,2); l1 = hul1_t(:,3);

  vH02 = uE02 * l0^2 * (g + l0)/ (uE02 + l0^3)/ k;
  hul2_0 = [vH02; uE02; l0];
  [t2, hul2_t] = ode23s(<span class="string">'dhul'</span>, t2, hul2_0);
  vH2 = hul2_t(:,1); uE2 = hul2_t(:,2); l2 = hul2_t(:,3);

  vH03 = uE03 * l0^2 * (g + l0)/ (uE03 + l0^3)/ k;
  hul3_0 = [vH03; uE03; l0];
  [t3, hul3_t] = ode23s(<span class="string">'dhul'</span>, t3, hul3_0);
  vH3 = hul3_t(:,1); uE3 = hul3_t(:,2); l3 = hul3_t(:,3);
</pre><h2>the better the curves uH(tau_b) matches uH_b,<a name="14"></a></h2><h2>the more accurate the estimation of l_b has been<a name="15"></a></h2><pre class="codeinput">  subplot(1,3,1)
  xlabel(<span class="string">'tau'</span>)
  ylabel(<span class="string">'v_H'</span>)
  plot(t, vH, <span class="string">'r'</span>, tb, uHb, <span class="string">'or'</span>, <span class="keyword">...</span>
       t1, vH1, <span class="string">'m'</span>, tb1, uHb, <span class="string">'om'</span> , <span class="keyword">...</span>
       t2, vH2, <span class="string">'b'</span>, tb2, uHb, <span class="string">'ob'</span>, <span class="keyword">...</span>
       t3, vH3, <span class="string">'g'</span>, tb3, uHb, <span class="string">'og'</span>)

  subplot(1,3,2)
  xlabel(<span class="string">'tau'</span>)
  ylabel(<span class="string">'u_E'</span>)
  plot(t, uE, <span class="string">'r'</span>, 0, uE0, <span class="string">'or'</span>, tb, uEb, <span class="string">'or'</span>, <span class="keyword">...</span>
       t1, uE1, <span class="string">'m'</span>, 0, uE01, <span class="string">'om'</span>, tb1, uEb1, <span class="string">'om'</span>, <span class="keyword">...</span>
       t2, uE2, <span class="string">'b'</span>, 0, uE02, <span class="string">'ob'</span>, tb2, uEb2, <span class="string">'ob'</span>, <span class="keyword">...</span>
       t3, uE3, <span class="string">'g'</span>, 0, uE03, <span class="string">'og'</span>, tb3, uEb3, <span class="string">'og'</span>)

  subplot(1,3,3)
  xlabel(<span class="string">'tau'</span>)
  ylabel(<span class="string">'l'</span>)
  plot(t,l,<span class="string">'r'</span>, tb, lb, <span class="string">'or'</span>, <span class="keyword">...</span>
       t1, l1, <span class="string">'m'</span>, tb1, lb1, <span class="string">'om'</span>, <span class="keyword">...</span>
       t2, l2, <span class="string">'b'</span>, tb2, lb2, <span class="string">'ob'</span>, <span class="keyword">...</span>
       t3, l3, <span class="string">'g'</span>, tb3, lb3, <span class="string">'og'</span>)
</pre><img vspace="5" hspace="5" src="mydata_ue0_01.png" alt=""> <p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%  created by <NAME>, modified 2009/09/29

% get (u_E^0, \tau_b, l_b) from (kap, g, k, u_H^b) and e_b = f
% strategy: get first l_b, then u_E^0 and \tau_b
%
% Scaling:
%  u_E = U_E g^2 k_M^3/ v^2; U_E = M_E/ {J_EAm}      reserve
%  u_H = U_H g^2 k_M^3/ v^2; U_H = M_H/ {J_EAm}      maturity
%  l_b = L_b/ L_m = Lb g k_M/ v                      length at birth
%  \tau = a k_M                                      age
%  k = k_J/ k_M                                      maintenance ratio

global g k kap % for plotting (tranfer to dhul)

f = 1; % scaled functional response
g = 6; k = 6; kap = .8; uHb = .001; vHb = uHb/ (1 - kap);

par = [g k vHb]; % pack parameters

%% test on constraints on parameters
if kap < 0 || kap > 1 || g < 0 || ...
      k < 0 || k > (1 - kap) * f^3/ uHb || ... % else d/d tau l|tau_b < 0
      uHb + kap < 0 || ... % else l_b > 1
      k^2 * uHb/ (1 - kap) - k * g - k + g > g^3 * (k - 1)/ k^2 * ...
      (1 - 3/ g - exp(-3 * k/ g)) * 2/ 9
  fprintf('parameters out of range \n');
  %% return
end

%% first obtain lb for foetus case
%  might speed up get_lb and get_lb1 for k neq 1
lb_foetus = get_lb_foetus(par);

%% get lb via Newton Raphson on y(x_b) = y_b with Euler
%  'fast and dirty'
[lb, info] = get_lb(par,f,lb_foetus);
tb = get_tb(par,f,lb);
uE0 = get_ue0(par,f,lb);
uEb = f * lb^3/ g;
result = [info uE0 tb uEb lb]'; % collect results 

%% get lb via Newton Raphson on y(x_b) = y_b with ode solver
%  more acurate and slower than get_lb
[lb1, info1] = get_lb1(par,f,lb_foetus);
tb1 = get_tb(par,f,lb1);
uE01 = get_ue0(par,f,lb1);
uEb1 = f * lb1^3/ g;
result1 = [info1 uE01 tb1 uEb1 lb1]'; % collect results 

%% get lb, tb lb uE0 by shooting method on d/dx y
[lb2, info2] = get_lb2(par,f,lb_foetus);
tb2 = get_tb(par,f,lb2);
uE02 = get_ue0(par,f,lb2);
uEb2 = f * lb2^3/ g;
result2 = [info2 uE02 tb2 uEb2 lb2]'; % collect results 

%% get lb via shooting on d/d u_H tau u_E l
%  not recommended; just for checking
%  small domain of attraction; slow
[tul_b, uE03, info3] = get_tul(par,f,lb_foetus);
tb3 = tul_b(1); uEb3 = tul_b(2); lb3 = tul_b(3); % unpack results
result3 = [info3 uE03 tb3 uEb3 lb3]'; % collect results 

%% compare results for uE0 tB uHb uEb lb
txt = [{'info'}; {'uE0'}; {'tB'}; {'uEb'}; {'lb'}];

%% differences are mainly due to differences in lb
fprintf('      get_lb    get_lb1   get_lb2   get_tul \n');
print_txt_var(txt, [result result1 result2 result3])

%% prepare plotting
  t = linspace(0,tb,100)';
  t1 = linspace(0,tb1,100)';
  t2 = linspace(0,tb2,100)';
  t3 = linspace(0,tb3,100)';

  l0 = 1e-6;
  vH0 = uE0 * l0^2 * (g + l0)/ (uE0 + l0^3)/ k;
  hul_0 = [vH0; uE0; l0];
  [t, hul_t] = ode23s('dhul', t, hul_0);
  vH = hul_t(:,1); uE = hul_t(:,2); l = hul_t(:,3);

  vH01 = uE01 * l0^2 * (g + l0)/ (uE01 + l0^3)/ k;
  hul1_0 = [vH01; uE01; l0];
  [t1, hul1_t] = ode23s('dhul', t1, hul1_0);
  vH1 = hul1_t(:,1); uE1 = hul1_t(:,2); l1 = hul1_t(:,3);

  vH02 = uE02 * l0^2 * (g + l0)/ (uE02 + l0^3)/ k;
  hul2_0 = [vH02; uE02; l0];
  [t2, hul2_t] = ode23s('dhul', t2, hul2_0);
  vH2 = hul2_t(:,1); uE2 = hul2_t(:,2); l2 = hul2_t(:,3);

  vH03 = uE03 * l0^2 * (g + l0)/ (uE03 + l0^3)/ k;
  hul3_0 = [vH03; uE03; l0];
  [t3, hul3_t] = ode23s('dhul', t3, hul3_0);
  vH3 = hul3_t(:,1); uE3 = hul3_t(:,2); l3 = hul3_t(:,3);

  %% the better the curves uH(tau_b) matches uH_b,
  %% the more accurate the estimation of l_b has been
  
  subplot(1,3,1)
  xlabel('tau')
  ylabel('v_H')
  plot(t, vH, 'r', tb, uHb, 'or', ...
       t1, vH1, 'm', tb1, uHb, 'om' , ...
       t2, vH2, 'b', tb2, uHb, 'ob', ...
       t3, vH3, 'g', tb3, uHb, 'og')

  subplot(1,3,2)
  xlabel('tau')
  ylabel('u_E')
  plot(t, uE, 'r', 0, uE0, 'or', tb, uEb, 'or', ...
       t1, uE1, 'm', 0, uE01, 'om', tb1, uEb1, 'om', ...
       t2, uE2, 'b', 0, uE02, 'ob', tb2, uEb2, 'ob', ...
       t3, uE3, 'g', 0, uE03, 'og', tb3, uEb3, 'og')
        
  subplot(1,3,3)
  xlabel('tau')
  ylabel('l')
  plot(t,l,'r', tb, lb, 'or', ...
       t1, l1, 'm', tb1, lb1, 'om', ...
       t2, l2, 'b', tb2, lb2, 'ob', ...
       t3, l3, 'g', tb3, lb3, 'og')


##### SOURCE END #####
--></body></html>

<|start_filename|>lib/regr/html/psurv.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>psurv</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="psurv.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">Description</a></li><li><a href="#3">Input</a></li><li><a href="#4">Output</a></li><li><a href="#5">Example of use</a></li><li><a href="#6">Code</a></li><li><a href="#7">obtain time intervals and numbers of death</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [cov, cor, sd, dev] = psurv (func, p, <span class="keyword">...</span><span class="comment"> )</span>
  <span class="comment">%  created: 2002/02/08 by <NAME></span>
  <span class="comment">%</span>
</pre><h2>Description<a name="2"></a></h2><pre>calculates covariance and correlation matrix of parameters standard deviation and sum of squared deviations
  of model predictions with respect to observations</pre><h2>Input<a name="3"></a></h2><pre>func: string with name of user-defined function
   f = func (p, tn) with
     p: k-vector with parameters; tn: (n,c)-matrix; f: n-vector
   [f1, f2, ...] = func (p, tn1, tn2, ...) with  p: k-vector  and
    tni: (ni,k)-matrix; fi: ni-vector with model predictions
   The dependent variable in the output f; For tn see below.</pre><h2>Output<a name="4"></a></h2><pre>p: (k,2) matrix with
   p(:,1) initial guesses for parameter values
   p(:,2) binaries with yes or no iteration (optional)
tni (read as tn1, tn2, .. ): (ni,2) matrix with
   tni(:,1) time: must be increasing with rows
   tni(:,2) number of survivors: must be non-increasing with rows
   tni(:,3, 4, ... ) data-pont specific information data (optional)
   The number of data matrices tn1, tn2, ... is optional but &gt;0
cov: (np,np) matrix with covariances
cor: (np,np) matrix with correlation coefficients
sd: (np,1) matrix with standard deviations
dev: scalar with deviance</pre><h2>Example of use<a name="5"></a></h2><pre>assuming that function_name, pars, and tn1 (and possibly more data matrices) are defined properly:
[cov, cor, sd, ss] = psurv('function_name', pars, tn1, tn2, ...).</pre><h2>Code<a name="6"></a></h2><pre class="codeinput">  <span class="keyword">global</span> index l n ntn listt listtn listf listg

  i = 1; <span class="comment">% initiate data set counter</span>
  ci = num2str(i); <span class="comment">% character string with value of i</span>
  nntn = nargin -1; <span class="comment">% initial 'while' condition (will count down)</span>
  ntn = nntn -1; <span class="comment">% number of data sets</span>
  va_start (); <span class="comment">% set pointer to first unnamed argument</span>
  <span class="keyword">while</span> (--nntn) <span class="comment">% loop across data sets</span>
    eval([<span class="string">'tn'</span>, ci, <span class="string">' = va_arg();'</span>]); <span class="comment">% assing unnamed arguments to tni</span>
    eval([<span class="string">'[n('</span>, ci, <span class="string">') k] = size(tn'</span>, ci, <span class="string">');'</span>]); <span class="comment">% number of data points</span>
    <span class="keyword">if</span> i == 1
</pre><h2>obtain time intervals and numbers of death<a name="7"></a></h2><pre class="codeinput">      D = tn1(:,2) - [tn1(2:n(i),2);0]; <span class="comment">% initiate death count</span>
      n0 =  tn1(1,2)*ones(n(1),1); <span class="comment">% initiate start number</span>
      listtn = [<span class="string">'tn'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list tn</span>
      listt = [<span class="string">'tn'</span>, ci]; <span class="comment">% initiate list tn for global declaration</span>
      listf = [<span class="string">'f'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list f</span>
      listg = [<span class="string">'g'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list g</span>
</pre><pre class="codeinput">    <span class="keyword">else</span>
      eval([<span class="string">'D = [D; tn'</span>, ci,<span class="string">'(:,2) - [tn'</span>, ci, <span class="string">'(2:n(i),2);0];'</span>]);
                                <span class="comment">% append death counts</span>
      eval([<span class="string">'n0 = [n0; tn'</span>, ci, <span class="string">'(1,2)*ones(n('</span>, ci,<span class="string">'),1)];'</span>]);
				<span class="comment">% append initial numbers</span>
      listtn = [listtn, <span class="string">' tn'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list tn</span>
      listt = [listt, <span class="string">' tn'</span>, ci]; <span class="comment">% append list tn for global declaration</span>
      listf = [listf, <span class="string">' f'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list f</span>
      listg = [listg, <span class="string">' g'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list g</span>
    <span class="keyword">end</span>
    i++;
    ci = num2str(i); <span class="comment">% character string with value of i</span>
  <span class="keyword">end</span>

  [i nl] = size(listtn); listtn = listtn(1:(nl-1)); <span class="comment">% remove last ','</span>
  [i nl] = size(listf); listf = listf(1:(nl-1)); <span class="comment">% remove last ','</span>
  [i nl] = size(listg); listg = listg(1:(nl-1)); <span class="comment">% remove last ','</span>
  eval([<span class="string">'global '</span>, listt,<span class="string">';'</span>]); <span class="comment">% make data sets global</span>

  likmax = D'*log(max(1e-10,D./ n0)); <span class="comment">% max of log lik function</span>

  [np, k] = size(p); <span class="comment">% k: number of parameters</span>
  index = 1:np;
  <span class="keyword">if</span> k&gt;1
    index = index(1 == p(:,2)); <span class="comment">% indices of estimated parameters</span>
  <span class="keyword">end</span>
  l = max(size(index));  <span class="comment">% l: number of estimated parameters</span>
  <span class="keyword">if</span> (l == 0)
    <span class="keyword">return</span>; <span class="comment">% no parameters to present statistics</span>
  <span class="keyword">end</span>

  [prob, dprob] = scdsurv(func, p(:,1));
				<span class="comment">% obtain death prob and derivatives</span>

  dev = 2 * (likmax - D' * log(max(1e-10,prob)));
				<span class="comment">% deviance: 2* log lik minus its supremum</span>
  cov(index, index) = inv((n0./prob * ones(1,l).*dprob)'*dprob);
				<span class="comment">% inv of information matrix</span>
  sd = sqrt(diag(cov)); <span class="comment">% standard deviations</span>
  cor = cov./(sd*sd'); <span class="comment">% correlation matrix</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [cov, cor, sd, dev] = psurv (func, p, ... )
  %  created: 2002/02/08 by <NAME>
  %
  %% Description
  %  calculates covariance and correlation matrix of parameters standard deviation and sum of squared deviations 
  %    of model predictions with respect to observations
  %
  %% Input
  %  func: string with name of user-defined function
  %     f = func (p, tn) with
  %       p: k-vector with parameters; tn: (n,c)-matrix; f: n-vector
  %     [f1, f2, ...] = func (p, tn1, tn2, ...) with  p: k-vector  and
  %      tni: (ni,k)-matrix; fi: ni-vector with model predictions
  %     The dependent variable in the output f; For tn see below.
  %
  %% Output
  %  p: (k,2) matrix with
  %     p(:,1) initial guesses for parameter values
  %     p(:,2) binaries with yes or no iteration (optional)
  %  tni (read as tn1, tn2, .. ): (ni,2) matrix with
  %     tni(:,1) time: must be increasing with rows
  %     tni(:,2) number of survivors: must be non-increasing with rows
  %     tni(:,3, 4, ... ) data-pont specific information data (optional)
  %     The number of data matrices tn1, tn2, ... is optional but >0
  %  cov: (np,np) matrix with covariances
  %  cor: (np,np) matrix with correlation coefficients
  %  sd: (np,1) matrix with standard deviations
  %  dev: scalar with deviance
  %
  %% Example of use
  %  assuming that function_name, pars, and tn1 (and possibly more data matrices) are defined properly: 
  %  [cov, cor, sd, ss] = psurv('function_name', pars, tn1, tn2, ...). 
   
  %% Code
  global index l n ntn listt listtn listf listg

  i = 1; % initiate data set counter
  ci = num2str(i); % character string with value of i
  nntn = nargin -1; % initial 'while' condition (will count down)
  ntn = nntn -1; % number of data sets
  va_start (); % set pointer to first unnamed argument
  while (REPLACE_WITH_DASH_DASHnntn) % loop across data sets
    eval(['tn', ci, ' = va_arg();']); % assing unnamed arguments to tni
    eval(['[n(', ci, ') k] = size(tn', ci, ');']); % number of data points
    if i == 1
      %% obtain time intervals and numbers of death
      D = tn1(:,2) - [tn1(2:n(i),2);0]; % initiate death count
      n0 =  tn1(1,2)*ones(n(1),1); % initiate start number
      listtn = ['tn', ci,',']; % initiate list tn
      listt = ['tn', ci]; % initiate list tn for global declaration
      listf = ['f', ci,',']; % initiate list f
      listg = ['g', ci,',']; % initiate list g
    else     
      eval(['D = [D; tn', ci,'(:,2) - [tn', ci, '(2:n(i),2);0];']);
                                % append death counts
      eval(['n0 = [n0; tn', ci, '(1,2)*ones(n(', ci,'),1)];']);
				% append initial numbers
      listtn = [listtn, ' tn', ci,',']; % append list tn
      listt = [listt, ' tn', ci]; % append list tn for global declaration
      listf = [listf, ' f', ci,',']; % append list f
      listg = [listg, ' g', ci,',']; % append list g
    end
    i++;
    ci = num2str(i); % character string with value of i
  end

  [i nl] = size(listtn); listtn = listtn(1:(nl-1)); % remove last ','
  [i nl] = size(listf); listf = listf(1:(nl-1)); % remove last ','
  [i nl] = size(listg); listg = listg(1:(nl-1)); % remove last ','
  eval(['global ', listt,';']); % make data sets global

  likmax = D'*log(max(1e-10,D./ n0)); % max of log lik function

  [np, k] = size(p); % k: number of parameters
  index = 1:np;
  if k>1
    index = index(1 == p(:,2)); % indices of estimated parameters
  end
  l = max(size(index));  % l: number of estimated parameters
  if (l == 0)
    return; % no parameters to present statistics
  end
  
  [prob, dprob] = scdsurv(func, p(:,1));
				% obtain death prob and derivatives

  dev = 2 * (likmax - D' * log(max(1e-10,prob)));
				% deviance: 2* log lik minus its supremum
  cov(index, index) = inv((n0./prob * ones(1,l).*dprob)'*dprob);
				% inv of information matrix
  sd = sqrt(diag(cov)); % standard deviations
  cor = cov./(sd*sd'); % correlation matrix
##### SOURCE END #####
--></body></html>

<|start_filename|>docs/oct_matl.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  -->
  </STYLE>

  <TITLE>
    DEBtool
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="DEBtool, Dynamic Energy Budget
    theory, Dynamic Energy Budgets, DEB theory, DEB" >
  <META 
    NAME="description" CONTENT="Software package DEBtool">
  <META NAME="distribution" CONTENT="global">
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>Octave versus Matlab</H1>

Some small differences between Octave 3.2.2 and Matlab 7.3.0 exist. 
The following list is not meant to be exhaustive, but aims the solve practical
problems in conversions

<table>
<TR>
 <TH ALIGN=left>Octave</TH>
q <TH ALIGN=left>Matlab</TH>
 <TH ALIGN=left>remarks</TH>
</TR>
 
<TR>
  <TD>yes</TD>
  <TD>no </TD>
  <TD>function definition allowed in script file</TD>
</TR>
   
<TR>
  <TD><CODE>exist("in")==0</CODE></TD>
  <TD><CODE>in==[]</CODE></TD>
  <TD>check existence of input in: function <CODE>f = fnname(in)</CODE></TD>
</TR>
   
<TR>
  <TD><CODE>x</CODE></TD>
  <TD><CODE>[t x]</CODE></TD>
  <TD>result of ODE-solver: <CODE>x = lsode("nm",x0,t)</CODE>
      versus <CODE>[t,x] = ode45("nm",t,x0)</CODE></TD>
</TR>
   
<TR>
  <TD><CODE>(x,t)</CODE></TD>
  <TD><CODE>(t,x)</CODE></TD>
  <TD>arguments for user defined functions for ODE-solver.
      Matlab's output <CODE>t</CODE> and <CODE>x</CODE> are large 
      if the input <CODE>t</CODE> has 2 elements.</TD>
</TR>
         
<TR>
  <TD>no</TD>
  <TD>yes</TD>
  <TD>plot of emtpy vectors</TD>
</TR>
   
</table>

<HR>
<P>
Go to the <A HREF="/thb/deb/" TARGET="_top"> DEB information page</A>
or the <A HREF="/thb/deb/deblab/" TARGET="_top"> DEB laboratory</A>

</BODY>
</HTML>


<|start_filename|>animal/html/shparameters.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>shparameters</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-06"><meta name="DC.source" content="shparameters.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">Description</a></li><li><a href="#3">Input</a></li><li><a href="#4">Output</a></li><li><a href="#5">Remarks</a></li><li><a href="#6">Example of use</a></li></ul></div><pre class="codeinput"><span class="comment">%  created at 2013/08/01 by <NAME></span>
<span class="comment">%</span>
</pre><h2>Description<a name="2"></a></h2><pre>plots  variables (= functions of parameters) in Species.xls, which can be found at http://www.bio.vu.nl/thb/deb/deblab/
the present path-setting assumes that the file Species.xls is in subdir add_my_pet</pre><h2>Input<a name="3"></a></h2><pre>the file Species.xls</pre><h2>Output<a name="4"></a></h2><pre>lots of figures</pre><h2>Remarks<a name="5"></a></h2><pre>A desciption of pars and vars can be found in report_init</pre><h2>Example of use<a name="6"></a></h2><pre>shparameters</pre><pre class="codeinput">  clear <span class="string">all</span>
  close <span class="string">all</span>

  file = <span class="string">'add_my_pet/Species.xls'</span>;
  read_Species

<span class="keyword">if</span> 0 <span class="comment">% taxonomic distance - parameter distance</span>

  d_t = dist_taxon(spec, genus, family, order, class, phylum, superphylum);
  d_t = d_t(:); <span class="comment">% taxonomic distances between pairs of species</span>

  p =  [pAm ./ zj, v, kap, pM, kJ, EG, EHb ./ zj3, EHj ./ zj3, EHp ./ zj3, ha ./ zj, sG];
  d_p = dist_stat(p);  d_p = d_p(:); <span class="comment">% relative distances in energetics between pairs of species</span>
  md_p = [mean(d_p(d_t == 0)); mean(d_p(d_t == 1)); mean(d_p(d_t == 2));
          mean(d_p(d_t == 3)); mean(d_p(d_t == 4)); mean(d_p(d_t == 5));
          mean(d_p(d_t == 6)); mean(d_p(d_t == 7))];
  d_pAm = dist_stat(pAm ./ zj);  d_pAm = d_pAm(:);
  md_pAm = [mean(d_pAm(d_t == 0)); mean(d_pAm(d_t == 1)); mean(d_pAm(d_t == 2));
            mean(d_pAm(d_t == 3)); mean(d_pAm(d_t == 4)); mean(d_pAm(d_t == 5));
            mean(d_pAm(d_t == 6)); mean(d_pAm(d_t == 7))];
  d_v = dist_stat(v);  d_v = d_v(:);
  md_v = [mean(d_v(d_t == 0)); mean(d_v(d_t == 1)); mean(d_v(d_t == 2));
          mean(d_v(d_t == 3)); mean(d_v(d_t == 4)); mean(d_v(d_t == 5));
          mean(d_v(d_t == 6)); mean(d_v(d_t == 7))];
  d_kap = dist_stat(kap);  d_kap = d_kap(:);
  md_kap = [mean(d_kap(d_t == 0)); mean(d_kap(d_t == 1)); mean(d_kap(d_t == 2));
            mean(d_kap(d_t == 3)); mean(d_kap(d_t == 4)); mean(d_kap(d_t == 5));
            mean(d_kap(d_t == 6)); mean(d_kap(d_t == 7))];
  d_pM = dist_stat(pM);  d_pM = d_pM(:);
  md_pM = [mean(d_pM(d_t == 0)); mean(d_pM(d_t == 1)); mean(d_pM(d_t == 2));
           mean(d_pM(d_t == 3)); mean(d_pM(d_t == 4)); mean(d_pM(d_t == 5));
           mean(d_pM(d_t == 6)); mean(d_pM(d_t == 7))];
  d_kJ = dist_stat(kJ);  d_kJ = d_kJ(:);
  md_kJ = [mean(d_kJ(d_t == 0)); mean(d_kJ(d_t == 1)); mean(d_kJ(d_t == 2));
           mean(d_kJ(d_t == 3)); mean(d_kJ(d_t == 4)); mean(d_kJ(d_t == 5));
           mean(d_kJ(d_t == 6)); mean(d_kJ(d_t == 7))];
  d_EG = dist_stat(EG);  d_EG = d_EG(:);
  md_EG = [mean(d_EG(d_t == 0)); mean(d_EG(d_t == 1)); mean(d_EG(d_t == 2));
           mean(d_EG(d_t == 3)); mean(d_EG(d_t == 4)); mean(d_EG(d_t == 5));
           mean(d_EG(d_t == 6)); mean(d_EG(d_t == 7))];
  d_EHb = dist_stat(EHb ./ zj3);  d_EHb = d_EHb(:);
  md_EHb = [mean(d_EHb(d_t == 0)); mean(d_EHb(d_t == 1)); mean(d_EHb(d_t == 2));
            mean(d_EHb(d_t == 3)); mean(d_EHb(d_t == 4)); mean(d_EHb(d_t == 5));
            mean(d_EHb(d_t == 6)); mean(d_EHb(d_t == 7))];
  d_EHj = dist_stat(EHj ./ zj3);  d_EHj = d_EHj(:);
  md_EHj = [mean(d_EHj(d_t == 0)); mean(d_EHj(d_t == 1)); mean(d_EHj(d_t == 2));
          mean(d_EHj(d_t == 3)); mean(d_EHj(d_t == 4)); mean(d_EHj(d_t == 5));
          mean(d_EHj(d_t == 6)); mean(d_EHj(d_t == 7))];
  d_EHp = dist_stat(EHp ./ zj3);  d_EHp = d_EHp(:);
  md_EHp = [mean(d_EHp(d_t == 0)); mean(d_EHp(d_t == 1)); mean(d_EHp(d_t == 2));
            mean(d_EHp(d_t == 3)); mean(d_EHp(d_t == 4)); mean(d_EHp(d_t == 5));
            mean(d_EHp(d_t == 6)); mean(d_EHp(d_t == 7))];
  d_ha = dist_stat(ha ./ zj);  d_ha = d_ha(:);
  md_ha = [mean(d_ha(d_t == 0)); mean(d_ha(d_t == 1)); mean(d_ha(d_t == 2));
           mean(d_ha(d_t == 3)); mean(d_ha(d_t == 4)); mean(d_ha(d_t == 5));
           mean(d_ha(d_t == 6)); mean(d_ha(d_t == 7))];
  d_sG = dist_stat(sG);  d_sG = d_sG(:);
  md_sG = [mean(d_sG(d_t == 0)); mean(d_sG(d_t == 1)); mean(d_sG(d_t == 2));
           mean(d_sG(d_t == 3)); mean(d_sG(d_t == 4)); mean(d_sG(d_t == 5));
           mean(d_sG(d_t == 6)); mean(d_sG(d_t == 7))];


  figure <span class="comment">% taxon distance</span>
  subplot(3,4,1)
  plot(d_t(:), d_p(:), <span class="string">'.m'</span>, 0:7, md_p, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'energetic distance'</span>)

  subplot(3,4,2)
  plot(d_t(:), d_pAm(:), <span class="string">'.m'</span>, 0:7, md_pAm, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'{p_Am}/z distance'</span>)

  subplot(3,4,3)
  plot(d_t(:), d_v(:), <span class="string">'.m'</span>, 0:7, md_v, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'v distance'</span>)

  subplot(3,4,4)
  plot(d_t(:), d_kap(:), <span class="string">'.m'</span>, 0:7, md_kap, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'\kappa distance'</span>)

  subplot(3,4,5)
  plot(d_t(:), d_pM(:), <span class="string">'.m'</span>, 0:7, md_pM, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'[p_M] distance'</span>)

  subplot(3,4,6)
  plot(d_t(:), d_kJ(:), <span class="string">'.m'</span>, 0:7, md_kJ, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'k_J distance'</span>)

  subplot(3,4,7)
  plot(d_t(:), d_EG(:), <span class="string">'.m'</span>, 0:7, md_EG, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'[E_G] distance'</span>)

  subplot(3,4,8)
  plot(d_t(:), d_EHb(:), <span class="string">'.m'</span>, 0:7, md_EHb, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'E_H^b/z^3 distance'</span>)

  subplot(3,4,9)
  plot(d_t(:), d_EHj(:), <span class="string">'.m'</span>, 0:7, md_EHj, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'E_H^j/z^3 distance'</span>)

  subplot(3,4,10)
  plot(d_t(:), d_EHp(:), <span class="string">'.m'</span>, 0:7, md_EHp, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'E_H^p/z^3 distance'</span>)

  subplot(3,4,11)
  plot(d_t(:), d_ha(:), <span class="string">'.m'</span>, 0:7, md_ha, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'h_a/z distance'</span>)

  subplot(3,4,12)
  plot(d_t(:), d_sG(:), <span class="string">'.m'</span>, 0:7, md_sG, <span class="string">'ok'</span>)
  xlabel(<span class="string">'taxon distance'</span>)
  ylabel(<span class="string">'s_G distance'</span>)

<span class="keyword">end</span>

  figure <span class="comment">% Li - acceleration sM</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(log10(Li), log10(s_M), '.r', 'MarkerSize', 20)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(s_M(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(s_M(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  xlim([-2.5; 2.5]);
  ylim([0; 2]);
  txt_taxa(-2.2, 1.5, taxa, col_taxa);

  figure
  subplot(1,3,1) <span class="comment">% Li - ap</span>
  <span class="comment">%plot(log10(Li), log10(ap), '.r', 'MarkerSize', 20)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(ap(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(ap(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log(L_\infty), cm'</span>)
  ylabel(<span class="string">'_{10}log(a_p), d'</span>)
  xlim([-2.5; 2.5]);
  ylim([-1; 6.2]);
  txt_taxa(-2.2, 4, taxa, col_taxa);

  <span class="comment">%figure</span>
  subplot(1,3,2) <span class="comment">% [p_M] - ap</span>
  <span class="comment">%plot(pM, ap, '.r', 'MarkerSize', 20)</span>
  scatter(log10(pM(TYPE&gt;0)), log10(ap(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(pM(TYPE&gt;0 &amp; s_M == 1)), log10(ap(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log [p_M], J cm^{-3} d^{-1}'</span>)
  ylabel(<span class="string">'_{10}log a_p, d'</span>)
  xlim([-1; 5]);
  ylim([-1; 6.2]);
  <span class="comment">%saveas (gca,'../pM_ap.png')</span>

  <span class="comment">%figure</span>
  subplot(1,3,3) <span class="comment">% [p_M] - Li/ap</span>
  <span class="comment">%plot(pM, ap, '.r', 'MarkerSize', 20)</span>
  scatter(log10(pM(TYPE&gt;0)), log10(Li(TYPE&gt;0) ./ ap(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(pM(TYPE&gt;0 &amp; s_M == 1)), log10(Li(TYPE&gt;0 &amp; s_M == 1) ./ ap(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log [p_M], J cm^{-3} d^{-1}'</span>)
  ylabel(<span class="string">'_{10}log (L_\infty/a_p), cm d^{-1}'</span>)
  xlim([-1; 5]);
  <span class="comment">%ylim([-1; 6.2]);</span>
  <span class="comment">%saveas (gca,'../pM_ap.png')</span>

  figure <span class="comment">% Wi - specific respiration</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(lWdm, lVO, '.r', [-20; 20], [-7 - 20*3/4; -7 + 20*3/4], 'b')</span>
  <span class="comment">%plot(lWdm, lVO, '.r', 'MarkerSize', 20)</span>
  scatter(log10(Wdm(TYPE&gt;0)), log10(VO(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Wdm(TYPE&gt;0 &amp; s_M == 1)), log10(VO(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-20; 20], [-3 + 20/4; -3 - 20/4], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-10 10])
  xlabel(<span class="string">'_{10}log max dry weight, g'</span>)
  <span class="comment">%ylabel('_{10}log -J_O, L/h')</span>
  ylabel(<span class="string">'_{10}log(-J_O/W_d), L/g.h'</span>)
  txt_taxa(7, -2, taxa, col_taxa);

  figure <span class="comment">% Li - yolkiness sE0</span>
  hold <span class="string">on</span>
  <span class="comment">%logLi = log10(Li);</span>
  <span class="comment">%plot(logLi(twin&lt;2   &amp; TYPE == 1), s_E(twin&lt;2 &amp; TYPE == 1), '.b', 'MarkerSize', 20)</span>
  <span class="comment">%plot(logLi(twin&lt;2   &amp; TYPE == 3), s_E(twin&lt;2 &amp; TYPE == 3), 'ob', 'LineWidth', 2)</span>
  <span class="comment">%plot(logLi(twin&gt;=2  &amp; twin&lt;4 &amp; TYPE == 1), s_E(twin&gt;=2 &amp; twin&lt;4 &amp; TYPE == 1),  '.g', 'MarkerSize', 20)</span>
  <span class="comment">%plot(logLi(twin&gt;=2  &amp; twin&lt;4 &amp; TYPE == 3), s_E(twin&gt;=2 &amp; twin&lt;4 &amp; TYPE == 3),  'og', 'LineWidth', 2)</span>
  <span class="comment">%plot(logLi(twin&gt;=4  &amp; twin&lt;8 &amp; TYPE == 1), s_E(twin&gt;=4 &amp; twin&lt;8 &amp; TYPE == 1),  '.k', 'MarkerSize', 20)</span>
  <span class="comment">%plot(logLi(twin&gt;=4  &amp; twin&lt;8 &amp; TYPE == 3), s_E(twin&gt;=4 &amp; twin&lt;8 &amp; TYPE == 3),  'ok', 'LineWidth', 2)</span>
  <span class="comment">%plot(logLi(twin&gt;=8  &amp; twin&lt;16 &amp; TYPE == 1),s_E(twin&gt;=8 &amp; twin&lt;16 &amp; TYPE == 1), '.m', 'MarkerSize', 20)</span>
  <span class="comment">%plot(logLi(twin&gt;=8  &amp; twin&lt;16 &amp; TYPE == 3), s_E(twin&gt;=8 &amp; twin&lt;16 &amp; TYPE == 3), 'om', 'LineWidth', 2)</span>
  <span class="comment">%plot(logLi(twin&gt;=16 &amp; TYPE == 1), s_E(twin&gt;=16 &amp; TYPE == 1), '.r', 'MarkerSize', 20)</span>
  <span class="comment">%plot(logLi(twin&gt;=16 &amp; TYPE == 3), s_E(twin&gt;=16 &amp; TYPE == 3), 'or', 'LineWidth', 2)</span>
  scatter(log10(Li(TYPE&gt;0)), s_E(TYPE&gt;0), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), s_E(TYPE&gt;0 &amp; s_M == 1), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-3;3], log10([2;2]), <span class="string">'k-'</span>)
  plot([-3;3], log10([4;4]), <span class="string">'k-'</span>)
  plot([-3;3], log10([8;8]), <span class="string">'k-'</span>)
  ylim([0;2])
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log(E_0^{max}/ E_0^{min})'</span>)
  txt_taxa(-2.5, 1.4, taxa, col_taxa);

  figure <span class="comment">% acceleration - yolkiness: sM - sE0</span>
  hold <span class="string">on</span>
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), s_E(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>,<span class="string">'LineWidth'</span>, 2)
  xlabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  ylabel(<span class="string">'_{10}log(E_0^{max}/ E_0^{min})'</span>)
  txt_taxa(1.7, 0.8, taxa, col_taxa);

  figure <span class="comment">% acceleration - spec maturity at birth : sM - [EHb]</span>
  logEHb = log10(EHb ./ Li.^3);
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), logEHb(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>,<span class="string">'LineWidth'</span>, 2)
  xlabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  ylabel(<span class="string">'_{10}log(E_H^b/ L_\infty^3), J/cm^3'</span>)
  txt_taxa(1.7, 0.8, taxa, col_taxa);

  figure <span class="comment">% acceleration - altriciality: sM - sH</span>
  <span class="comment">%s_H = log10(EHp ./ EHb); % altriciality index</span>
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), s_H(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>,<span class="string">'LineWidth'</span>, 2)
  xlabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  ylabel(<span class="string">'_{10}log(E_H^p/ E_H^b)'</span>)
  txt_taxa(1.8, 9, taxa, col_taxa);

  figure <span class="comment">% acceleration - spec maturity at puberty : sM - [EHp]</span>
  logEHp = log10(EHp ./ Li.^3);
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), logEHp(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>,<span class="string">'LineWidth'</span>, 2)
  xlabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  ylabel(<span class="string">'_{10}log(E_H^p/ L_\infty^3), J/cm^3'</span>)
  txt_taxa(1.8, 5, taxa, col_taxa);

  figure <span class="comment">% neonate energy conductance - acceleration: v - sM</span>
  logv = log10(v);
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), logv(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>,<span class="string">'LineWidth'</span>, 2)
  xlabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  ylabel(<span class="string">'_{10}log(v), cm/d'</span>)
  txt_taxa(1.8, -2.5, taxa, col_taxa);

  figure <span class="comment">% Li - r_B</span>
  hold <span class="string">on</span>
  rB = kM / 3./ (1+1./g);
  scatter(log10(Li(TYPE &gt; 0)), log10(rB(TYPE &gt; 0)), 60, color(TYPE &gt; 0,:), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(rB(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  <span class="comment">% expected from generalised animal:</span>
  L_i = 10.^(linspace(-2, 2, 100)); r_B = 18/ 2800/ 3 ./ (1 + 1 ./ (2800 * .02/ 22.5 ./ L_i));
  plot(log10(L_i), log10(r_B), <span class="string">'k'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>,<span class="string">'LineWidth'</span>, 2)
  xlabel(<span class="string">'_{10}log(L_\infty)'</span>)
  ylabel(<span class="string">'_{10}log(r_B), 1/d'</span>)
  txt_taxa(-2.5, -4, taxa, col_taxa);

  figure <span class="comment">% Li - max spec reprod investment</span>
  hold <span class="string">on</span>
  pJp = kJ .* EHp ./ zj3;
  pRm = (1 - kap) .* pM ./ kap - pJp;
  plot(log10(Li(TYPE == 1 &amp; ~vertebrata)), log10(pRm(TYPE == 1 &amp; ~vertebrata)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(TYPE == 1 &amp; vertebrata)), log10(pRm(TYPE == 1 &amp; vertebrata)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(TYPE == 1 &amp; endotherms)), log10(pRm(TYPE == 1 &amp; endotherms)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(TYPE == 3 &amp; ~vertebrata)), log10(pRm(TYPE == 3 &amp; ~vertebrata)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(TYPE == 3 &amp; vertebrata)), log10(pRm(TYPE == 3 &amp; vertebrata)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(TYPE == 3 &amp; endotherms)), log10(pRm(TYPE == 3 &amp; endotherms)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log(p_R^m/ L_m^3), J/d.cm^3'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -2, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li - max spec mat maintenance</span>
  hold <span class="string">on</span>
  plot(log10(Li(sel_1)), log10(pJp(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), log10(pJp(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), log10(pJp(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), log10(pJp(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), log10(pJp(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), log10(pJp(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log(p_J^p/ L_m^3), J/d.cm^3'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -4, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li - mat maint relative to reprod</span>
  hold <span class="string">on</span>
  kapJ = pJp ./ (pJp + pRm);
  plot(log10(Li(sel_1)), kapJ(sel_1), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), kapJ(sel_2), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), kapJ(sel_3), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), kapJ(sel_4), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), kapJ(sel_5), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), kapJ(sel_6), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'p_J^p/ (p_J^p + p_R^m)'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 0.6, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Wi - max reprod rate</span>
  hold <span class="string">on</span>
  scatter(log10(Wdm(TYPE &gt; 0)), log10(Ri(TYPE &gt; 0)), 60, color(TYPE &gt; 0,:), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Wdm(TYPE&gt;0 &amp; s_M == 1)), log10(Ri(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-10 10])
  xlabel(<span class="string">'_{10}log max dry weight, g'</span>)
  ylabel(<span class="string">'_{10}log max rep rate, #/d'</span>)
  txt_taxa(7, 3, taxa, col_taxa);

  figure <span class="comment">% Li - max reprod rate</span>
  hold <span class="string">on</span>
  plot([-2; 2], log10(3.029) + [0;-4], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2) <span class="comment">% DEB-expectation from Tab 8.1</span>
  <span class="comment">% value obtain from running pars_my_pet for z = 0.01</span>
  plot(log10(Li(sel_1)), log10(Ri(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), log10(Ri(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), log10(Ri(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), log10(Ri(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), log10(Ri(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), log10(Ri(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log R_\infty, #/d'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 5, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li - max life span</span>
  hold <span class="string">on</span>
  plot(log10(Li(sel_1)), log10(am(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), log10(am(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), log10(am(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), log10(am(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), log10(am(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), log10(am(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log a_m, d'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 5, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li - max pop growth rate</span>
  hold <span class="string">on</span>
  plot([-2; 2], log10(.012721) + [0;-4], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2) <span class="comment">% DEB-expectation from Tab 8.1</span>
  <span class="comment">% value obtain from running pars_my_pet for z = 0.01</span>
  plot(log10(Li(sel_1)), log10(rm(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), log10(rm(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), log10(rm(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), log10(rm(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), log10(rm(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), log10(rm(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  ylim([-4 0.75])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log r_m, d^{-1}'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -3, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li - max egg mass</span>
  hold <span class="string">on</span>
  plot([-2; 2], log10(2.509e-12) + [0;16], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2) <span class="comment">% DEB-expectation from Tab 8.1</span>
  <span class="comment">% value obtain from running pars_my_pet for z = 0.01</span>
  plot(log10(Li(sel_1)), log10(M_E0_max(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), log10(M_E0_max(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), log10(M_E0_max(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), log10(M_E0_max(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), log10(M_E0_max(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), log10(M_E0_max(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log M_{E0}^{max}, C-mol'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -3, taxa_loc, col_taxa_loc);

  figure <span class="comment">% altriciality index</span>
  s_H = log10(EHp ./ EHb); <span class="comment">% altriciality index</span>
  <span class="comment">%printpar(species, AI)</span>
  hold <span class="string">on</span>
  s_sH = surv(s_H, 0);
  s_sH_endo = surv(s_H(endotherms == 1), 0);
  plot(s_sH(:,1), s_sH(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot(s_sH_endo(:,1), s_sH_endo(:,2),<span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'altriciality index, _{10}log(E_H^p/ E_H^b)'</span>)
  taxa_loc = {<span class="string">'all'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 1 0; 1 0 0];
  txt_taxa(6, 0.6, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li- altriciality-index</span>
  hold <span class="string">on</span>
  plot(log10(Li(sel_1)), s_H(sel_1), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), s_H(sel_2), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), s_H(sel_3), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), s_H(sel_4), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), s_H(sel_5), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), s_H(sel_6), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log(E_H^p/ E_H^b)'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 8, taxa_loc, col_taxa_loc);

  figure <span class="comment">% acceleration - altriciality-index</span>
  hold <span class="string">on</span>
  plot(log10(s_M(sel_1)), s_H(sel_1), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(s_M(sel_2)), s_H(sel_2), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(s_M(sel_3)), s_H(sel_3), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(s_M(sel_4)), s_H(sel_4), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(s_M(sel_5)), s_H(sel_5), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(s_M(sel_6)), s_H(sel_6), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  <span class="comment">%xlim([0 *])</span>
  xlabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  ylabel(<span class="string">'_{10}log(E_H^p/ E_H^b)'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(1.5, 10, taxa_loc, col_taxa_loc);

  figure <span class="comment">% Li- lp</span>
  hold <span class="string">on</span>
  plot(log10(Li(sel_1)), l_p(sel_1), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_2)), l_p(sel_2), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_3)), l_p(sel_3), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(Li(sel_4)), l_p(sel_4), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_5)), l_p(sel_5), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(Li(sel_6)), l_p(sel_6), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([-2.5 2.5])
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'l_p'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, .9, taxa_loc, col_taxa_loc);

  figure <span class="comment">% determinateness - altriciality</span>
  hold <span class="string">on</span>
  plot(l_p(sel_1), s_H(sel_1), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(l_p(sel_2), s_H(sel_2), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(l_p(sel_3), s_H(sel_3), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(l_p(sel_4), s_H(sel_4), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(l_p(sel_5), s_H(sel_5), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(l_p(sel_6), s_H(sel_6), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  <span class="comment">%xlim([0 *])</span>
  xlabel(<span class="string">'l_p'</span>)
  ylabel(<span class="string">'_{10}log(E_H^p/ E_H^b)'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(.9, 10, taxa_loc, col_taxa_loc);

  figure <span class="comment">% determinateness - acceleration</span>
  hold <span class="string">on</span>
  plot(l_p(sel_1), log10(s_M(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(l_p(sel_2), log10(s_M(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(l_p(sel_3), log10(s_M(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(l_p(sel_4), log10(s_M(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(l_p(sel_5), log10(s_M(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(l_p(sel_6), log10(s_M(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  <span class="comment">%xlim([0 *])</span>
  xlabel(<span class="string">'l_p'</span>)
  ylabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(.9, 1.5, taxa_loc, col_taxa_loc);

  figure <span class="comment">% kappa - acceleration</span>
  hold <span class="string">on</span>
  plot(kap(sel_1), log10(s_M(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(kap(sel_2), log10(s_M(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(kap(sel_3), log10(s_M(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(kap(sel_4), log10(s_M(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(kap(sel_5), log10(s_M(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(kap(sel_6), log10(s_M(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([0 1])
  xlabel(<span class="string">'kap'</span>)
  ylabel(<span class="string">'_{10}log(L_j/ L_b)'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(.1, 1.5, taxa_loc, col_taxa_loc);

  figure <span class="comment">% [p_M] L_b - (1 - kap_G) [E_G] v</span>
  x = pM .* Lb; y = (1 - kapG) .* EG  .* v;
  hold <span class="string">on</span>
  plot(log10(x(sel_1)), log10(y(sel_1)), <span class="string">'.b'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(x(sel_2)), log10(y(sel_2)), <span class="string">'.m'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(x(sel_3)), log10(y(sel_3)), <span class="string">'.r'</span>, <span class="string">'MarkerSize'</span>, 20)
  plot(log10(x(sel_4)), log10(y(sel_4)), <span class="string">'ob'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(x(sel_5)), log10(y(sel_5)), <span class="string">'om'</span>, <span class="string">'LineWidth'</span>, 2)
  plot(log10(x(sel_6)), log10(y(sel_6)), <span class="string">'or'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log([p_M] L_b), J/d.cm^2'</span>)
  ylabel(<span class="string">'_{10}log((1-kap_G) [E_G] v), J/d.cm^2'</span>)
  taxa_loc = {<span class="string">'inve'</span>; <span class="string">'vert'</span>; <span class="string">'endo'</span>}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(3, 0, taxa_loc, col_taxa_loc);
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%  created at 2013/08/01 by <NAME> 
%
%% Description
%  plots  variables (= functions of parameters) in Species.xls, which can be found at http://www.bio.vu.nl/thb/deb/deblab/
%  the present path-setting assumes that the file Species.xls is in subdir add_my_pet
%
%% Input
%  the file Species.xls
%
%% Output
%  lots of figures
%
%% Remarks
%  A desciption of pars and vars can be found in report_init
%
%% Example of use
%  shparameters 


  clear all
  close all

  file = 'add_my_pet/Species.xls';
  read_Species

if 0 % taxonomic distance - parameter distance
  
  d_t = dist_taxon(spec, genus, family, order, class, phylum, superphylum);
  d_t = d_t(:); % taxonomic distances between pairs of species
      
  p =  [pAm ./ zj, v, kap, pM, kJ, EG, EHb ./ zj3, EHj ./ zj3, EHp ./ zj3, ha ./ zj, sG];
  d_p = dist_stat(p);  d_p = d_p(:); % relative distances in energetics between pairs of species
  md_p = [mean(d_p(d_t == 0)); mean(d_p(d_t == 1)); mean(d_p(d_t == 2)); 
          mean(d_p(d_t == 3)); mean(d_p(d_t == 4)); mean(d_p(d_t == 5)); 
          mean(d_p(d_t == 6)); mean(d_p(d_t == 7))]; 
  d_pAm = dist_stat(pAm ./ zj);  d_pAm = d_pAm(:); 
  md_pAm = [mean(d_pAm(d_t == 0)); mean(d_pAm(d_t == 1)); mean(d_pAm(d_t == 2)); 
            mean(d_pAm(d_t == 3)); mean(d_pAm(d_t == 4)); mean(d_pAm(d_t == 5)); 
            mean(d_pAm(d_t == 6)); mean(d_pAm(d_t == 7))]; 
  d_v = dist_stat(v);  d_v = d_v(:);
  md_v = [mean(d_v(d_t == 0)); mean(d_v(d_t == 1)); mean(d_v(d_t == 2)); 
          mean(d_v(d_t == 3)); mean(d_v(d_t == 4)); mean(d_v(d_t == 5)); 
          mean(d_v(d_t == 6)); mean(d_v(d_t == 7))]; 
  d_kap = dist_stat(kap);  d_kap = d_kap(:);
  md_kap = [mean(d_kap(d_t == 0)); mean(d_kap(d_t == 1)); mean(d_kap(d_t == 2)); 
            mean(d_kap(d_t == 3)); mean(d_kap(d_t == 4)); mean(d_kap(d_t == 5)); 
            mean(d_kap(d_t == 6)); mean(d_kap(d_t == 7))]; 
  d_pM = dist_stat(pM);  d_pM = d_pM(:);
  md_pM = [mean(d_pM(d_t == 0)); mean(d_pM(d_t == 1)); mean(d_pM(d_t == 2)); 
           mean(d_pM(d_t == 3)); mean(d_pM(d_t == 4)); mean(d_pM(d_t == 5)); 
           mean(d_pM(d_t == 6)); mean(d_pM(d_t == 7))]; 
  d_kJ = dist_stat(kJ);  d_kJ = d_kJ(:);
  md_kJ = [mean(d_kJ(d_t == 0)); mean(d_kJ(d_t == 1)); mean(d_kJ(d_t == 2)); 
           mean(d_kJ(d_t == 3)); mean(d_kJ(d_t == 4)); mean(d_kJ(d_t == 5)); 
           mean(d_kJ(d_t == 6)); mean(d_kJ(d_t == 7))]; 
  d_EG = dist_stat(EG);  d_EG = d_EG(:);
  md_EG = [mean(d_EG(d_t == 0)); mean(d_EG(d_t == 1)); mean(d_EG(d_t == 2)); 
           mean(d_EG(d_t == 3)); mean(d_EG(d_t == 4)); mean(d_EG(d_t == 5)); 
           mean(d_EG(d_t == 6)); mean(d_EG(d_t == 7))]; 
  d_EHb = dist_stat(EHb ./ zj3);  d_EHb = d_EHb(:);
  md_EHb = [mean(d_EHb(d_t == 0)); mean(d_EHb(d_t == 1)); mean(d_EHb(d_t == 2)); 
            mean(d_EHb(d_t == 3)); mean(d_EHb(d_t == 4)); mean(d_EHb(d_t == 5)); 
            mean(d_EHb(d_t == 6)); mean(d_EHb(d_t == 7))]; 
  d_EHj = dist_stat(EHj ./ zj3);  d_EHj = d_EHj(:);
  md_EHj = [mean(d_EHj(d_t == 0)); mean(d_EHj(d_t == 1)); mean(d_EHj(d_t == 2)); 
          mean(d_EHj(d_t == 3)); mean(d_EHj(d_t == 4)); mean(d_EHj(d_t == 5)); 
          mean(d_EHj(d_t == 6)); mean(d_EHj(d_t == 7))]; 
  d_EHp = dist_stat(EHp ./ zj3);  d_EHp = d_EHp(:);
  md_EHp = [mean(d_EHp(d_t == 0)); mean(d_EHp(d_t == 1)); mean(d_EHp(d_t == 2)); 
            mean(d_EHp(d_t == 3)); mean(d_EHp(d_t == 4)); mean(d_EHp(d_t == 5)); 
            mean(d_EHp(d_t == 6)); mean(d_EHp(d_t == 7))]; 
  d_ha = dist_stat(ha ./ zj);  d_ha = d_ha(:);
  md_ha = [mean(d_ha(d_t == 0)); mean(d_ha(d_t == 1)); mean(d_ha(d_t == 2)); 
           mean(d_ha(d_t == 3)); mean(d_ha(d_t == 4)); mean(d_ha(d_t == 5)); 
           mean(d_ha(d_t == 6)); mean(d_ha(d_t == 7))]; 
  d_sG = dist_stat(sG);  d_sG = d_sG(:);
  md_sG = [mean(d_sG(d_t == 0)); mean(d_sG(d_t == 1)); mean(d_sG(d_t == 2)); 
           mean(d_sG(d_t == 3)); mean(d_sG(d_t == 4)); mean(d_sG(d_t == 5)); 
           mean(d_sG(d_t == 6)); mean(d_sG(d_t == 7))]; 
     
  
  figure % taxon distance
  subplot(3,4,1)
  plot(d_t(:), d_p(:), '.m', 0:7, md_p, 'ok')
  xlabel('taxon distance')
  ylabel('energetic distance')

  subplot(3,4,2)
  plot(d_t(:), d_pAm(:), '.m', 0:7, md_pAm, 'ok')
  xlabel('taxon distance')
  ylabel('{p_Am}/z distance')

  subplot(3,4,3)
  plot(d_t(:), d_v(:), '.m', 0:7, md_v, 'ok')
  xlabel('taxon distance')
  ylabel('v distance')

  subplot(3,4,4)
  plot(d_t(:), d_kap(:), '.m', 0:7, md_kap, 'ok')
  xlabel('taxon distance')
  ylabel('\kappa distance')

  subplot(3,4,5)
  plot(d_t(:), d_pM(:), '.m', 0:7, md_pM, 'ok')
  xlabel('taxon distance')
  ylabel('[p_M] distance')

  subplot(3,4,6)
  plot(d_t(:), d_kJ(:), '.m', 0:7, md_kJ, 'ok')
  xlabel('taxon distance')
  ylabel('k_J distance')

  subplot(3,4,7)
  plot(d_t(:), d_EG(:), '.m', 0:7, md_EG, 'ok')
  xlabel('taxon distance')
  ylabel('[E_G] distance')

  subplot(3,4,8)
  plot(d_t(:), d_EHb(:), '.m', 0:7, md_EHb, 'ok')
  xlabel('taxon distance')
  ylabel('E_H^b/z^3 distance')

  subplot(3,4,9)
  plot(d_t(:), d_EHj(:), '.m', 0:7, md_EHj, 'ok')
  xlabel('taxon distance')
  ylabel('E_H^j/z^3 distance')

  subplot(3,4,10)
  plot(d_t(:), d_EHp(:), '.m', 0:7, md_EHp, 'ok')
  xlabel('taxon distance')
  ylabel('E_H^p/z^3 distance')

  subplot(3,4,11)
  plot(d_t(:), d_ha(:), '.m', 0:7, md_ha, 'ok')
  xlabel('taxon distance')
  ylabel('h_a/z distance')

  subplot(3,4,12)
  plot(d_t(:), d_sG(:), '.m', 0:7, md_sG, 'ok')
  xlabel('taxon distance')
  ylabel('s_G distance')

end

  figure % Li - acceleration sM
  hold on
  %plot(log10(Li), log10(s_M), '.r', 'MarkerSize', 20)
  scatter(log10(Li(TYPE>0)), log10(s_M(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(s_M(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log(L_j/ L_b)')
  xlim([-2.5; 2.5]);
  ylim([0; 2]);
  txt_taxa(-2.2, 1.5, taxa, col_taxa);

  figure 
  subplot(1,3,1) % Li - ap
  %plot(log10(Li), log10(ap), '.r', 'MarkerSize', 20)
  scatter(log10(Li(TYPE>0)), log10(ap(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(ap(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log(L_\infty), cm')
  ylabel('_{10}log(a_p), d')
  xlim([-2.5; 2.5]);
  ylim([-1; 6.2]);
  txt_taxa(-2.2, 4, taxa, col_taxa);

  %figure
  subplot(1,3,2) % [p_M] - ap
  %plot(pM, ap, '.r', 'MarkerSize', 20)
  scatter(log10(pM(TYPE>0)), log10(ap(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(pM(TYPE>0 & s_M == 1)), log10(ap(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log [p_M], J cm^{-3} d^{-1}')
  ylabel('_{10}log a_p, d')
  xlim([-1; 5]);
  ylim([-1; 6.2]);
  %saveas (gca,'../pM_ap.png')

  %figure
  subplot(1,3,3) % [p_M] - Li/ap
  %plot(pM, ap, '.r', 'MarkerSize', 20)
  scatter(log10(pM(TYPE>0)), log10(Li(TYPE>0) ./ ap(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(pM(TYPE>0 & s_M == 1)), log10(Li(TYPE>0 & s_M == 1) ./ ap(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log [p_M], J cm^{-3} d^{-1}')
  ylabel('_{10}log (L_\infty/a_p), cm d^{-1}')
  xlim([-1; 5]);
  %ylim([-1; 6.2]);
  %saveas (gca,'../pM_ap.png')

  figure % Wi - specific respiration
  hold on
  %plot(lWdm, lVO, '.r', [-20; 20], [-7 - 20*3/4; -7 + 20*3/4], 'b')
  %plot(lWdm, lVO, '.r', 'MarkerSize', 20)
  scatter(log10(Wdm(TYPE>0)), log10(VO(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Wdm(TYPE>0 & s_M == 1)), log10(VO(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-20; 20], [-3 + 20/4; -3 - 20/4], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-10 10])
  xlabel('_{10}log max dry weight, g')
  %ylabel('_{10}log -J_O, L/h')
  ylabel('_{10}log(-J_O/W_d), L/g.h')
  txt_taxa(7, -2, taxa, col_taxa);
  
  figure % Li - yolkiness sE0
  hold on
  %logLi = log10(Li);
  %plot(logLi(twin<2   & TYPE == 1), s_E(twin<2 & TYPE == 1), '.b', 'MarkerSize', 20)
  %plot(logLi(twin<2   & TYPE == 3), s_E(twin<2 & TYPE == 3), 'ob', 'LineWidth', 2)
  %plot(logLi(twin>=2  & twin<4 & TYPE == 1), s_E(twin>=2 & twin<4 & TYPE == 1),  '.g', 'MarkerSize', 20)
  %plot(logLi(twin>=2  & twin<4 & TYPE == 3), s_E(twin>=2 & twin<4 & TYPE == 3),  'og', 'LineWidth', 2)
  %plot(logLi(twin>=4  & twin<8 & TYPE == 1), s_E(twin>=4 & twin<8 & TYPE == 1),  '.k', 'MarkerSize', 20)
  %plot(logLi(twin>=4  & twin<8 & TYPE == 3), s_E(twin>=4 & twin<8 & TYPE == 3),  'ok', 'LineWidth', 2)
  %plot(logLi(twin>=8  & twin<16 & TYPE == 1),s_E(twin>=8 & twin<16 & TYPE == 1), '.m', 'MarkerSize', 20)
  %plot(logLi(twin>=8  & twin<16 & TYPE == 3), s_E(twin>=8 & twin<16 & TYPE == 3), 'om', 'LineWidth', 2)
  %plot(logLi(twin>=16 & TYPE == 1), s_E(twin>=16 & TYPE == 1), '.r', 'MarkerSize', 20)
  %plot(logLi(twin>=16 & TYPE == 3), s_E(twin>=16 & TYPE == 3), 'or', 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), s_E(TYPE>0), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), s_E(TYPE>0 & s_M == 1), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-3;3], log10([2;2]), 'k-')
  plot([-3;3], log10([4;4]), 'k-')
  plot([-3;3], log10([8;8]), 'k-')
  ylim([0;2])
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log(E_0^{max}/ E_0^{min})')
  txt_taxa(-2.5, 1.4, taxa, col_taxa);
  
  figure % acceleration - yolkiness: sM - sE0
  hold on
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), s_E(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on','LineWidth', 2)
  xlabel('_{10}log(L_j/ L_b)')
  ylabel('_{10}log(E_0^{max}/ E_0^{min})')
  txt_taxa(1.7, 0.8, taxa, col_taxa);

  figure % acceleration - spec maturity at birth : sM - [EHb]
  logEHb = log10(EHb ./ Li.^3);
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), logEHb(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on','LineWidth', 2)
  xlabel('_{10}log(L_j/ L_b)')
  ylabel('_{10}log(E_H^b/ L_\infty^3), J/cm^3')
  txt_taxa(1.7, 0.8, taxa, col_taxa);

  figure % acceleration - altriciality: sM - sH
  %s_H = log10(EHp ./ EHb); % altriciality index
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), s_H(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on','LineWidth', 2)
  xlabel('_{10}log(L_j/ L_b)')
  ylabel('_{10}log(E_H^p/ E_H^b)')
  txt_taxa(1.8, 9, taxa, col_taxa);

  figure % acceleration - spec maturity at puberty : sM - [EHp]
  logEHp = log10(EHp ./ Li.^3);
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), logEHp(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on','LineWidth', 2)
  xlabel('_{10}log(L_j/ L_b)')
  ylabel('_{10}log(E_H^p/ L_\infty^3), J/cm^3')
  txt_taxa(1.8, 5, taxa, col_taxa);

  figure % neonate energy conductance - acceleration: v - sM
  logv = log10(v);
  scatter(log10(s_M(TYPE == 1 | TYPE == 3)), logv(TYPE == 1 | TYPE == 3), 60, color(TYPE == 1 | TYPE == 3,:), 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on','LineWidth', 2)
  xlabel('_{10}log(L_j/ L_b)')
  ylabel('_{10}log(v), cm/d')
  txt_taxa(1.8, -2.5, taxa, col_taxa);

  figure % Li - r_B
  hold on
  rB = kM / 3./ (1+1./g);
  scatter(log10(Li(TYPE > 0)), log10(rB(TYPE > 0)), 60, color(TYPE > 0,:), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(rB(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  % expected from generalised animal:
  L_i = 10.^(linspace(-2, 2, 100)); r_B = 18/ 2800/ 3 ./ (1 + 1 ./ (2800 * .02/ 22.5 ./ L_i));
  plot(log10(L_i), log10(r_B), 'k', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on','LineWidth', 2)
  xlabel('_{10}log(L_\infty)')
  ylabel('_{10}log(r_B), 1/d')
  txt_taxa(-2.5, -4, taxa, col_taxa);

  figure % Li - max spec reprod investment
  hold on
  pJp = kJ .* EHp ./ zj3;
  pRm = (1 - kap) .* pM ./ kap - pJp;
  plot(log10(Li(TYPE == 1 & ~vertebrata)), log10(pRm(TYPE == 1 & ~vertebrata)), '.b', 'MarkerSize', 20)
  plot(log10(Li(TYPE == 1 & vertebrata)), log10(pRm(TYPE == 1 & vertebrata)), '.m', 'MarkerSize', 20)
  plot(log10(Li(TYPE == 1 & endotherms)), log10(pRm(TYPE == 1 & endotherms)), '.r', 'MarkerSize', 20)
  plot(log10(Li(TYPE == 3 & ~vertebrata)), log10(pRm(TYPE == 3 & ~vertebrata)), 'ob', 'LineWidth', 2)
  plot(log10(Li(TYPE == 3 & vertebrata)), log10(pRm(TYPE == 3 & vertebrata)), 'om', 'LineWidth', 2)
  plot(log10(Li(TYPE == 3 & endotherms)), log10(pRm(TYPE == 3 & endotherms)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log(p_R^m/ L_m^3), J/d.cm^3')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -2, taxa_loc, col_taxa_loc);

  figure % Li - max spec mat maintenance
  hold on
  plot(log10(Li(sel_1)), log10(pJp(sel_1)), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), log10(pJp(sel_2)), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), log10(pJp(sel_3)), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), log10(pJp(sel_4)), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), log10(pJp(sel_5)), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), log10(pJp(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log(p_J^p/ L_m^3), J/d.cm^3')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -4, taxa_loc, col_taxa_loc);

  figure % Li - mat maint relative to reprod
  hold on
  kapJ = pJp ./ (pJp + pRm);
  plot(log10(Li(sel_1)), kapJ(sel_1), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), kapJ(sel_2), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), kapJ(sel_3), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), kapJ(sel_4), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), kapJ(sel_5), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), kapJ(sel_6), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('p_J^p/ (p_J^p + p_R^m)')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 0.6, taxa_loc, col_taxa_loc);

  figure % Wi - max reprod rate
  hold on
  scatter(log10(Wdm(TYPE > 0)), log10(Ri(TYPE > 0)), 60, color(TYPE > 0,:), 'LineWidth', 2)
  scatter(log10(Wdm(TYPE>0 & s_M == 1)), log10(Ri(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-10 10])
  xlabel('_{10}log max dry weight, g')
  ylabel('_{10}log max rep rate, #/d')
  txt_taxa(7, 3, taxa, col_taxa);

  figure % Li - max reprod rate
  hold on
  plot([-2; 2], log10(3.029) + [0;-4], 'b', 'LineWidth', 2) % DEB-expectation from Tab 8.1
  % value obtain from running pars_my_pet for z = 0.01
  plot(log10(Li(sel_1)), log10(Ri(sel_1)), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), log10(Ri(sel_2)), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), log10(Ri(sel_3)), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), log10(Ri(sel_4)), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), log10(Ri(sel_5)), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), log10(Ri(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log R_\infty, #/d')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 5, taxa_loc, col_taxa_loc);

  figure % Li - max life span
  hold on
  plot(log10(Li(sel_1)), log10(am(sel_1)), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), log10(am(sel_2)), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), log10(am(sel_3)), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), log10(am(sel_4)), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), log10(am(sel_5)), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), log10(am(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log a_m, d')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 5, taxa_loc, col_taxa_loc);

  figure % Li - max pop growth rate
  hold on
  plot([-2; 2], log10(.012721) + [0;-4], 'b', 'LineWidth', 2) % DEB-expectation from Tab 8.1
  % value obtain from running pars_my_pet for z = 0.01
  plot(log10(Li(sel_1)), log10(rm(sel_1)), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), log10(rm(sel_2)), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), log10(rm(sel_3)), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), log10(rm(sel_4)), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), log10(rm(sel_5)), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), log10(rm(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  ylim([-4 0.75])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log r_m, d^{-1}')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -3, taxa_loc, col_taxa_loc);

  figure % Li - max egg mass
  hold on
  plot([-2; 2], log10(2.509e-12) + [0;16], 'b', 'LineWidth', 2) % DEB-expectation from Tab 8.1
  % value obtain from running pars_my_pet for z = 0.01
  plot(log10(Li(sel_1)), log10(M_E0_max(sel_1)), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), log10(M_E0_max(sel_2)), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), log10(M_E0_max(sel_3)), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), log10(M_E0_max(sel_4)), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), log10(M_E0_max(sel_5)), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), log10(M_E0_max(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log M_{E0}^{max}, C-mol')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, -3, taxa_loc, col_taxa_loc);
  
  figure % altriciality index
  s_H = log10(EHp ./ EHb); % altriciality index
  %printpar(species, AI)
  hold on
  s_sH = surv(s_H, 0);
  s_sH_endo = surv(s_H(endotherms == 1), 0);
  plot(s_sH(:,1), s_sH(:,2),'g', 'Linewidth', 2)
  plot(s_sH_endo(:,1), s_sH_endo(:,2),'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('altriciality index, _{10}log(E_H^p/ E_H^b)')
  taxa_loc = {'all'; 'endo'}; col_taxa_loc = [0 1 0; 1 0 0];
  txt_taxa(6, 0.6, taxa_loc, col_taxa_loc);

  figure % Li- altriciality-index
  hold on
  plot(log10(Li(sel_1)), s_H(sel_1), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), s_H(sel_2), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), s_H(sel_3), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), s_H(sel_4), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), s_H(sel_5), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), s_H(sel_6), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log(E_H^p/ E_H^b)')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, 8, taxa_loc, col_taxa_loc);

  figure % acceleration - altriciality-index
  hold on
  plot(log10(s_M(sel_1)), s_H(sel_1), '.b', 'MarkerSize', 20)
  plot(log10(s_M(sel_2)), s_H(sel_2), '.m', 'MarkerSize', 20)
  plot(log10(s_M(sel_3)), s_H(sel_3), '.r', 'MarkerSize', 20)
  plot(log10(s_M(sel_4)), s_H(sel_4), 'ob', 'LineWidth', 2)
  plot(log10(s_M(sel_5)), s_H(sel_5), 'om', 'LineWidth', 2)
  plot(log10(s_M(sel_6)), s_H(sel_6), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  %xlim([0 *])
  xlabel('_{10}log(L_j/ L_b)')
  ylabel('_{10}log(E_H^p/ E_H^b)')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(1.5, 10, taxa_loc, col_taxa_loc);

  figure % Li- lp
  hold on
  plot(log10(Li(sel_1)), l_p(sel_1), '.b', 'MarkerSize', 20)
  plot(log10(Li(sel_2)), l_p(sel_2), '.m', 'MarkerSize', 20)
  plot(log10(Li(sel_3)), l_p(sel_3), '.r', 'MarkerSize', 20)
  plot(log10(Li(sel_4)), l_p(sel_4), 'ob', 'LineWidth', 2)
  plot(log10(Li(sel_5)), l_p(sel_5), 'om', 'LineWidth', 2)
  plot(log10(Li(sel_6)), l_p(sel_6), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([-2.5 2.5])
  xlabel('_{10}log L_\infty, cm')
  ylabel('l_p')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(-2, .9, taxa_loc, col_taxa_loc);

  figure % determinateness - altriciality
  hold on
  plot(l_p(sel_1), s_H(sel_1), '.b', 'MarkerSize', 20)
  plot(l_p(sel_2), s_H(sel_2), '.m', 'MarkerSize', 20)
  plot(l_p(sel_3), s_H(sel_3), '.r', 'MarkerSize', 20)
  plot(l_p(sel_4), s_H(sel_4), 'ob', 'LineWidth', 2)
  plot(l_p(sel_5), s_H(sel_5), 'om', 'LineWidth', 2)
  plot(l_p(sel_6), s_H(sel_6), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  %xlim([0 *])
  xlabel('l_p')
  ylabel('_{10}log(E_H^p/ E_H^b)')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(.9, 10, taxa_loc, col_taxa_loc);

  figure % determinateness - acceleration
  hold on
  plot(l_p(sel_1), log10(s_M(sel_1)), '.b', 'MarkerSize', 20)
  plot(l_p(sel_2), log10(s_M(sel_2)), '.m', 'MarkerSize', 20)
  plot(l_p(sel_3), log10(s_M(sel_3)), '.r', 'MarkerSize', 20)
  plot(l_p(sel_4), log10(s_M(sel_4)), 'ob', 'LineWidth', 2)
  plot(l_p(sel_5), log10(s_M(sel_5)), 'om', 'LineWidth', 2)
  plot(l_p(sel_6), log10(s_M(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  %xlim([0 *])
  xlabel('l_p')
  ylabel('_{10}log(L_j/ L_b)')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(.9, 1.5, taxa_loc, col_taxa_loc);

  figure % kappa - acceleration
  hold on
  plot(kap(sel_1), log10(s_M(sel_1)), '.b', 'MarkerSize', 20)
  plot(kap(sel_2), log10(s_M(sel_2)), '.m', 'MarkerSize', 20)
  plot(kap(sel_3), log10(s_M(sel_3)), '.r', 'MarkerSize', 20)
  plot(kap(sel_4), log10(s_M(sel_4)), 'ob', 'LineWidth', 2)
  plot(kap(sel_5), log10(s_M(sel_5)), 'om', 'LineWidth', 2)
  plot(kap(sel_6), log10(s_M(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([0 1])
  xlabel('kap')
  ylabel('_{10}log(L_j/ L_b)')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(.1, 1.5, taxa_loc, col_taxa_loc);

  figure % [p_M] L_b - (1 - kap_G) [E_G] v
  x = pM .* Lb; y = (1 - kapG) .* EG  .* v;
  hold on
  plot(log10(x(sel_1)), log10(y(sel_1)), '.b', 'MarkerSize', 20)
  plot(log10(x(sel_2)), log10(y(sel_2)), '.m', 'MarkerSize', 20)
  plot(log10(x(sel_3)), log10(y(sel_3)), '.r', 'MarkerSize', 20)
  plot(log10(x(sel_4)), log10(y(sel_4)), 'ob', 'LineWidth', 2)
  plot(log10(x(sel_5)), log10(y(sel_5)), 'om', 'LineWidth', 2)
  plot(log10(x(sel_6)), log10(y(sel_6)), 'or', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log([p_M] L_b), J/d.cm^2')
  ylabel('_{10}log((1-kap_G) [E_G] v), J/d.cm^2')
  taxa_loc = {'inve'; 'vert'; 'endo'}; col_taxa_loc = [0 0 1; 1 0 1; 1 0 0];
  txt_taxa(3, 0, taxa_loc, col_taxa_loc);
##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebttint.c<|end_filename|>
/***
   NAME
     ebttint.c
   PURPOSE
     This file contains the specification of the actual time integration
     routine for the Escalator Boxcar Train program.  It includes the
     appropriate source file, dependent on the defined variable
     TIME_METHOD. The source file implements the actual method and supplies to
     routines: PrepareCycle() and IntegrationStep(). These are called by
     NewCohort() to integrate all the variables during the time interval
     between cohort closures. Cohort cycles end at regularly spaced points in
     time or when forced by the ForceCohortEnd() routine (DOPRI5, DOPRI8 and
     RADAU5 methods only).
   NOTES
     
   HISTORY
     AMdR - Nov 08, 1998 : Created.
     AMdR - Jan 08, 2014 : Revised last.
***/

#define EBTTINT_C				/* Identification of file   */
#define EBTLIB					/* and file grouping	    */

#include "escbox.h"				/* Include general header   */
#include "ebtmain.h"
#include "ebtcohrt.h"
#include "ebtutils.h"

/* <NAME> 2020/04/02 */
#include "ebttint.h"

/*==========================================================================*/
/*
 * Including the file with the selected time integration method
 */

#ifndef TIME_METHOD
#define TIME_METHOD	RKCK
#endif /* TIME_METHOD */
#if    (TIME_METHOD ==  RK2)
#include "ebtrk2.c"
#elif  (TIME_METHOD ==  RK4)
#include "ebtrk4.c"
#elif  (TIME_METHOD ==  RKF45)
#include "ebtrkf45.c"
#elif  (TIME_METHOD ==  RKCK)
#include "ebtrkck.c"
#elif  (TIME_METHOD ==  DOPRI5)
#include "ebtdopri5.c"
#elif  (TIME_METHOD ==  DOPRI8)
#include "ebtdopri8.c"
#elif  (TIME_METHOD ==  RADAU5)
#include "ebtradau.c"
#elif  (TIME_METHOD ==  CVODE)
#include "ebtcvode.c"
#elif  (TIME_METHOD ==  CVBDF)
#include "ebtcvode.c"
#else
#error Internal EBT error: TIME_METHOD not specified!
#endif



/*==============================================================================*/


<|start_filename|>popDyn/EBTtool/deb/EBTstd.h<|end_filename|>
/***
  NAME
    deb\EBTstd.h

  PURPOSE
    header file used by the Escalator Boxcar Train program for DEB models

  HISTORY
    SK - 2020/04/13: Created by DEBtool_M/animal/get_EBT
***/

#define POPULATION_NR   1
#define I_STATE_DIM     8 /* a, q, h_a, L, E, E_R, E_H, W */
#define I_CONST_DIM     0
#define ENVIRON_DIM     2 /* time, scaled food density */
#define OUTPUT_VAR_NR   6 /* (time,) scaled food density, nr ind, tot struc length, surface, vol, weight */
#define PARAMETER_NR    32
#define TIME_METHOD     DOPRI5 /* we need events */
#define EVENT_NR        2 /*  birth, puberty */
#define DYNAMIC_COHORTS 0


<|start_filename|>popDyn/EBTtool/fns/ebtinit.h<|end_filename|>
/***
   NAME
     ebtinit.h
   PURPOSE
     Interface header file to the functions defined in ebtinit.c
   NOTES
     
   HISTORY
     AMdR - Jul 19, 1995 : Created.
     AMdR - Nov 15, 2015 : Revised last.
***/

/*==========================================================================*/
#ifndef EBTINIT_H
#define EBTINIT_H

#ifdef	EBTINIT_C
#undef	EXTERN
#define EXTERN
#else
#undef	EXTERN
#define EXTERN	extern
#endif
EXTERN void	Initialize(int, char **);



/*===========================================================================*/
#endif /* EBTINIT_H */


<|start_filename|>animal/html/report_animal.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>report_animal</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="report_animal.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">Description</a></li></ul></div><pre class="codeinput"><span class="comment">% created 2000/10/26 by <NAME>, modified 2012/01/31</span>
<span class="comment">%</span>
</pre><h2>Description<a name="2"></a></h2><p>writes report on compound parameters and statistics called by 'pars_animal', after running 'parscomp', 'statistics'</p><pre class="codeinput"><span class="keyword">if</span> exist(<span class="string">'txt_statistics'</span>,<span class="string">'var'</span>) == 0
  report_init
<span class="keyword">end</span>

val_par = [ <span class="keyword">...</span>
T; T_ref; T_A; T_L; T_H; T_AL ;T_AH <span class="comment">% 1 | 1 2 3 4 5 6 7</span>
f;                                  <span class="comment">% 2 | 8</span>
z; del_M;                           <span class="comment">% 3 | 9 10</span>
F_m; kap_X; kap_X_P;                <span class="comment">% 4 | 11 12 13</span>
v; kap; kap_R;                      <span class="comment">% 5 | 14 15 16</span>
p_M; p_T; k_J;                      <span class="comment">% 6 | 17 18 19</span>
E_G                                 <span class="comment">% 7 | 20</span>
E_Hb; E_Hj; E_Hp;                   <span class="comment">% 8 | 21 22 23</span>
h_a ; s_G                           <span class="comment">% 9 | 24 25</span>
];

val_statistics = [ <span class="keyword">...</span><span class="comment">                      %</span>
    T_ref; T; TC;                           <span class="comment">%  1 | 1 2 3</span>
    M_E0_min_b; M_E0_min_p; M_E0; E_0; W_0; <span class="comment">%  2 | 4 5 6 7 8 9</span>
    del_Ub; L_b; M_Vb; Lw_b; W_b; del_Wb;   <span class="comment">%  3 | 10 11 12 13 14 15</span>
    L_j; M_Vj; Lw_j; W_j; del_Wj;           <span class="comment">%  4 | 16 17 18 19 20</span>
    L_p; M_Vp; Lw_p; W_p; del_Wp;           <span class="comment">%  5 | 21 22 23 24 25</span>
    L_m; L_i; M_Vi; Lw_i; W_m; W_i; del_V;  <span class="comment">%  6 | 26 27 28 29 30 31 32</span>
    FT_m; CR_b; CR_p; CR_i;                 <span class="comment">%  7 | 33 34 35 36</span>
    K; Kb_min; Kp_min;                      <span class="comment">%  8 | 37 38 39 40</span>
    f; eb_min; ep_min;                      <span class="comment">%  9 | 41 42 43 44</span>
    pT_Xm; JT_X_Am; pT_Xb;                  <span class="comment">% 10 | 45 46 47</span>
      JT_XAb; pT_Xp; JT_XAp; pT_Xi; JT_XAi; <span class="comment">%    | 48 49 50 51 52</span>
      t_starve;                             <span class="comment">%    | 53</span>
    pT_Am; JT_E_Am; y_E_X; y_P_X;           <span class="comment">% 11 | 54 55 56 57</span>
    vT; t_E; E_m; m_Em;                     <span class="comment">% 12 | 58 59 60 61</span>
    pT_M; pT_T; L_T; kT_M; kT_J; k;         <span class="comment">% 13 | 62 63 64 65 66 67</span>
      JT_E_M; JT_E_T; jT_E_M; jT_E_J;       <span class="comment">%    | 68 69 70 71</span>
    SDA; RQ; UQ; WQ; p_Tt; VO;              <span class="comment">% 14 | 72 73 74 75 76 77</span>
    y_V_E; kap_G; g; r_B;                   <span class="comment">% 15 | 78 79 80 81</span>
    R_i; GI;                                <span class="comment">% 16 | 82 83</span>
    a_b; a_j; a_p; a_99; a_m; S_b; S_p;     <span class="comment">% 17 | 84 85 86 87 88 89 90</span>
      hT_a; hT_W; hT_G;                     <span class="comment">%    | 91 92 93</span>
    M_V; E_V; xi_W_E;                       <span class="comment">% 18 | 94 95 96</span>
    r_m; Ea_m; EL_m; EL2_m; EL3_m;          <span class="comment">% 19 | 97 98 99 100 101</span>
      f_r; Ea_0; EL_0; EL2_0; EL3_0;        <span class="comment">%    | 102 103 104 105 106</span>
    ];

 <span class="keyword">if</span> E_Hj ~= E_Hb &amp;&amp; foetus == 1
   TYPE = 4; <span class="comment">% acceleration and foetal development</span>
 <span class="keyword">elseif</span> E_Hj ~= E_Hb
   TYPE = 3; <span class="comment">% acceleration</span>
 <span class="keyword">elseif</span> foetus == 1
   TYPE = 2; <span class="comment">% foetal development</span>
 <span class="keyword">else</span>
   TYPE = 1; <span class="comment">% standard</span>
 <span class="keyword">end</span>

<span class="keyword">if</span> exist(<span class="string">'file_name'</span>,<span class="string">'var'</span>) == 0  <span class="comment">% print to screen if no file_name is specified</span>
  printpar(txt_statistics, val_statistics)
<span class="keyword">else</span>
  fprintf([num2str(n_spec), <span class="string">' '</span>, species, <span class="string">'\n'</span>]);
<span class="keyword">end</span>

<span class="comment">% printpar(txt_par, val_par)</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
% created 2000/10/26 by <NAME>, modified 2012/01/31
%
%% Description
% writes report on compound parameters and statistics
% called by 'pars_animal', after running 'parscomp', 'statistics'

if exist('txt_statistics','var') == 0
  report_init
end

val_par = [ ... 
T; T_ref; T_A; T_L; T_H; T_AL ;T_AH % 1 | 1 2 3 4 5 6 7
f;                                  % 2 | 8
z; del_M;                           % 3 | 9 10
F_m; kap_X; kap_X_P;                % 4 | 11 12 13
v; kap; kap_R;                      % 5 | 14 15 16
p_M; p_T; k_J;                      % 6 | 17 18 19
E_G                                 % 7 | 20
E_Hb; E_Hj; E_Hp;                   % 8 | 21 22 23
h_a ; s_G                           % 9 | 24 25
];

val_statistics = [ ...                      % 
    T_ref; T; TC;                           %  1 | 1 2 3
    M_E0_min_b; M_E0_min_p; M_E0; E_0; W_0; %  2 | 4 5 6 7 8 9
    del_Ub; L_b; M_Vb; Lw_b; W_b; del_Wb;   %  3 | 10 11 12 13 14 15
    L_j; M_Vj; Lw_j; W_j; del_Wj;           %  4 | 16 17 18 19 20
    L_p; M_Vp; Lw_p; W_p; del_Wp;           %  5 | 21 22 23 24 25
    L_m; L_i; M_Vi; Lw_i; W_m; W_i; del_V;  %  6 | 26 27 28 29 30 31 32
    FT_m; CR_b; CR_p; CR_i;                 %  7 | 33 34 35 36
    K; Kb_min; Kp_min;                      %  8 | 37 38 39 40
    f; eb_min; ep_min;                      %  9 | 41 42 43 44
    pT_Xm; JT_X_Am; pT_Xb;                  % 10 | 45 46 47
      JT_XAb; pT_Xp; JT_XAp; pT_Xi; JT_XAi; %    | 48 49 50 51 52
      t_starve;                             %    | 53
    pT_Am; JT_E_Am; y_E_X; y_P_X;           % 11 | 54 55 56 57
    vT; t_E; E_m; m_Em;                     % 12 | 58 59 60 61
    pT_M; pT_T; L_T; kT_M; kT_J; k;         % 13 | 62 63 64 65 66 67
      JT_E_M; JT_E_T; jT_E_M; jT_E_J;       %    | 68 69 70 71
    SDA; RQ; UQ; WQ; p_Tt; VO;              % 14 | 72 73 74 75 76 77
    y_V_E; kap_G; g; r_B;                   % 15 | 78 79 80 81
    R_i; GI;                                % 16 | 82 83
    a_b; a_j; a_p; a_99; a_m; S_b; S_p;     % 17 | 84 85 86 87 88 89 90
      hT_a; hT_W; hT_G;                     %    | 91 92 93
    M_V; E_V; xi_W_E;                       % 18 | 94 95 96
    r_m; Ea_m; EL_m; EL2_m; EL3_m;          % 19 | 97 98 99 100 101
      f_r; Ea_0; EL_0; EL2_0; EL3_0;        %    | 102 103 104 105 106
    ];

 if E_Hj ~= E_Hb && foetus == 1
   TYPE = 4; % acceleration and foetal development
 elseif E_Hj ~= E_Hb
   TYPE = 3; % acceleration
 elseif foetus == 1
   TYPE = 2; % foetal development
 else
   TYPE = 1; % standard
 end

if exist('file_name','var') == 0  % print to screen if no file_name is specified
  printpar(txt_statistics, val_statistics)
else
  fprintf([num2str(n_spec), ' ', species, '\n']);
end

% printpar(txt_par, val_par)

##### SOURCE END #####
--></body></html>

<|start_filename|>docs/first.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>
    First steps in Octave
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="Octave Matlab" >

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>First steps in Octave</H1>

<P ALIGN="center"> by <A HREF="mailto:<EMAIL>"><NAME></A>,
5 April 2002


<H2>Purpose</H2> 
 
These notes are prepared for getting started in the computer language <A HREF="http://www.octave.org/" TARGET="_top">Octave 3</A>,
which uses <A HREF="http://www.gnuplot.org/" TARGET="_top">Gnuplot</A> for graphics, which ia included in Octave. 

<P>
This note assumes that Octave 3 is installed, and that you type the codes on Octaves' command line that are shown in magenta (while
skipping the comments, of course).
 
<H2>General recommendations</H2>

<H4>Script files</H4>

Although Octave allows you to work directly on the command line, with handy history memory (arrow keys), it is best to work in script files
as soon as you want to fit a model and display the results or do similar more complex things. 
A script file is a file with a name that has extension <code>.m</code> and does not start with the word <code>function</code>. 
After saving the script file with some editor (such as Emacs) in plain ascii, type the name of the script file on Octave's command line (without extension <code>.m</code>) and Octave executes the file as if all its contents was typed in on the command line.

<P>
Label all script-files well with explanatory text, including your name, date and purpose, such that it makes sense when you see it again much later.

<P>
Add enough explanations in your script files and functions. 
All text on a line after character <code>%</code> is not executed by Octave. Emacs expects <code>%%</code> if a whole line is explanatory text.

<H4>Help</H4>

Type <code>help function-name</code> to get an explantion how a function works.

<P>
Type <code>who</code> or <code>whos</code> to get information about the variables and functions that are known at any given moment.

<P>
Example:<BR>
<code>
  who<BR>
  a = 2;<BR>
  who
</code>

</BODY>
</HTML>








<|start_filename|>docs/DEBtool_tox.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_tox</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: tox</H3>

  Toxicokinetics in relation to effects of chemicals on organisms and populations, i.e. on survival, body growth, reproduction, population growth.

  <p>
  The theory for the models can be found in: <BR> 
  Kooijman, <NAME>. and <NAME>. 1996.
  <A HREF="http://www.bio.vu.nl/thb/research/bib/KooyBeda96.html">
  <I> The analysis of aquatic toxicity data.</I></A>
  VU University Press, Amsterdam.
  <BR>
  Kooijman, <NAME>. 2010 
  <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">
  <I>Dynamic Energy and Mass Budgets theory for Metabolic Organisation.</I></A>
  Cambridge University Press.

<HR>
<H4><A NAME="tox">tox</A></H4>

  Demo that runs:
  <ul>
    <li> <B>mydata_fomort</B>: 
         effects on mortality of individuals </li>
    <li> <B>mydata_algatox</B>:
         effects on nutrient-limited population growth of algae </li>
  </ul>

  <p>
  These files are script-files that illustrate the use of <A HREF="#fomort*"><code>fomort</code></A> and <A HREF="#algatox*"><code>algatox</code></A>. 
  Consult these script-files for further explanation.


<HR>
<H4><A NAME="fomort">fomort</A></H4>

  Meant to be used as subroutine for <A HREF="DEBtool_lib_regr.html#scsurv2"><code>scsurv2</code></A>.<br>
  The name of the routine stands for first-order mortality. 
  The function specifies the survival probability of blank individuals, that are exposed to a constant concentration of toxic compound. 
  The toxicokinetics is assumed to be of the first-order type; 
  the hazard rate is assumed to be linear in the internal concentration. 
  Concentrations below the internal no-effect concentration do not affect survival. 
  The proportionality factor with which the hazard rate increases with concentration minus the no-effect concentration is called the killing rate. 
  The hazard rate in the blank is assumed to be constant.

  <p>
  Parameter interpretation:
  <ol>
    <li> 1/d, hazard rate in the blank (>0) </li>
    <li> M, No-Effect-Concentration </li>
    <li> 1/(d*M), killing rate </li>
    <li> 1/d, elimination rate </li>
  </ol>

  <p>
  An example of application of fomort in regression and plotting routines is given in the script-file <code>mydata_fomort</code>.

<HR>
<H4><A NAME="fomort_c0">fomort_c0</A></H4>

  Meant to be used as subroutine for <A HREF="DEBtool_lib_regr.html#scsurv2"><code>scsurv2</code></A>.<br>
  Like fomort, but the no effect concentrations follows a log normal distribution.

  <p>
  Parameter interpretation:
  <ol>
    <li> 1/d, hazard rate in the blank (>0) </li>
    <li> M, No-Effect-Concentration </li>
    <li> 1/(d*M), killing rate </li>
    <li> 1/d, elimination rate </li>
    <li> -, scatter parameter for the No-Effect-Concentration </li>
  </ol>

  <p>
  The use is similar to fomort.

<HR>
<H4><A NAME="fomortph">fomortph</A></H4>

  Meant to be used as subroutine for <A HREF="DEBtool_lib_regr.html#scsurv2"><code>scsurv2</code></A>.<br>
  The name of the routine stands for first-order mortality with effects on pH. 
  The model is identical to <A HREF="#fomort"><code>fomort</code></A>, except that the NEC and the killing rates depend on the pH, because the these parameters differ for the molecular and the ionic form.

  <p>
  Parameter interpretation:
  <ol>
    <li> 1/d, hazard rate in the blank </li>
    <li> M, No-Effect-Concentration of molecular form </li>
    <li> 1/(d*M), killing rate of molecular form </li>
    <li> 1/d, elimination rate </li>
    <li> M, No-Effect-Concentration of ionic form </li>
    <li> 1/(d*M), killing rate of ionic form </li>
    <li> -, ion-product constant </li>
  </ol>

  <p>
  An example of application of fomortph in regression and plotting routines is given in the script-file <B>mydata_fomortph</B>. 
  Notice that this model does not specify a response surface; 
  thus <A HREF="#shsurv2"><code>shsurv2</code></A> only works properly with option <code>'plotnr' = 1</code>.

<HR>
<H4><A NAME="lfohaz">lfohaz</A></H4>

  Calculates the minus log-likelihood function for first-order mortality, if time-to-death data are available for each individual. 
  The model is otherwise the same as in <A HREF="#fomort"><code>fomort</code></A>. 
  The toxicokinetics is assumed to be of the first-order type; 
  the hazard rate is assumed to be linear in the internal concentration. 
  Concentrations below the internal no-effect concentration do not affect survival. 
  The proportionality factor with which the hazard rate increases with concentration minus the no-effect concentration is called the killing rate. 
  The hazard rate in the blank is assumed to be constant.

  <p>
  Input: 
  <ul>
    <li> (4,k)-matrix with parameters. Parameter interpretation in first column:
      <ol>
        <li> 1/d, hazard rate in the blank (>0) </li>
        <li> M, No-Effect-Concentration </li>
        <li> 1/(d*M), killing rate </li>
        <li> 1/d, elimination rate </li>
      </ol>
    </li>
    <li> (n,2) or (n,3)-matrix with in each row:
      <ol>
        <li> time </li> 
        <li> concentration </li> 
        <li> indicator. 
             If it equals 1 the time is treated as time-to-death, otherwise it is treated as a time at which the subject is still alive. </li>
      </ol>
    </li>
  </ul>

  <p>
  Output:
  <ul>
    <li> scalar with minus log-likelihood </li>
  </ul>

  <p>
  An example of application of lfohaz in combination with <A HREF="DEBtool_lib_misc.html#nmmin"><code>nmmin</code></A> is given in the script-file <code>mydata_fohaz</code>.

<HR>
<H4><A NAME="fomort2">fomort2</A></H4>

  Meant to be used as subroutine for <A HREF="DEBtool_lib_regr.html#scsurv2"><code>scsurv2</code></A>.<br>
  The name of the routine stands for first-order mortality with a mixture of 2 compounds. 
  The function specifies the survival probability of blank individuals, that are exposed to a constant concentration of toxic compound. 
  The toxicokinetics is assumed to be of the first-order type; the hazard rate is assumed to be linear in the internal concentration. The compounds compete for capacity to cancel effects. 
  The effective part, that exceeds to cancel capacity can interact at a rate that can be negetive, zero (independent action), or positive. 
  See further <A HREF="#fomort"><code>fomort</code></A>.

  <p>
  Parameter interpretation:
  <ol>
    <li> 1/d, hazard rate in the blank (>0) </li>
    <li> M, No-Effect-Concentration for compound A </li>
    <li> M, No-Effect-Concentration for compound B </li>
    <li> 1/(d*M), killing rate for compound A </li>
    <li> 1/(d*M), killing rate for compound B </li>
    <li> 1/d, elimination rate for compound A </li>
    <li> 1/d, elimination rate for compound B </li>
    <li> 1/(d*M*M), interaction rate between A and B </li>
  </ol>

  <p>
  An example of application of fomort in regression and plotting routines is given in the script-file <B>mydata_fomort2</B>.

<HR>
<H4><A NAME="algatox">algatox</A></H4>

  Routine that specifies a model for effects on nutrient-limited alga growth, with three modes of action:
  <ul>
    <li> partial killing of inoculum </li>
    <li> killing during growth </li>
    <li> increase of costs for growth </li>
  </ul>
  Instantaneous equilibrium is assumed for the internal concentration.
  Growth is assumed to be nutrient limited, and the nutrient pool is exchanging with a pool that is not available to the algae. 
  Algal mass is measured in Optical Densities. 
  The contribution of living biomass, dead biomass and ghost biomass might differ. 
  The toxic compound can tranfer living into dead biomass, the dead biomass decays to ghost biomass according to a first order process. 
  The no-effect-conc for the three effects are taken to be the same, but they might actually be different, however!  

  <p>
  Input:
  <ul>
    <li> (17,k)-matrix with parameters values in the first column
      <ol>
        <li> mM, background nutrient </li>
        <li> mM, initial nutrient conc </li>
        <li> mM, initial biomass </li>
        <li> OD/mM, weight of living in optical density (redundant par) </li>
        <li> OD/mM, weight of dead in optical density </li>
        <li> OD/mM, weight of ghosts in optical density </li>
        <li> mM, half saturation constant for nutrient </li>
        <li> mM/mM, yield of reserves on structure </li>
        <li> mM/(mM*h), max spec nutrient uptake rate </li>
        <li> 1/h, reserve turnover rate </li>
        <li> 1/h, exchange from nutrient to background </li>
        <li> 1/h, exchange from background to nutrient </li>
        <li> 1/h, dead biomass decay rate to ghost </li>
        <li> mM, no-effect concentration </li>
        <li> mM, tolerance conc for initial mortality </li>
        <li> mM, tolerance concentration for costs of growth </li>
        <li> 1/(mM*h), spec killing rate </li>
      </ol>
    </li>
    <li> vector with exposure times </li>
    <li> vector with concentrations of toxic compound </li> 
  </ul
  
  <p>
  Output:
  <ul>
    <li> matrix with Optical Densities </li>
  </ul>

  <p>
  An example of application of fomort in regression and plotting routines is given in the script-file <code>mydata_algatox</code>.

<HR>
<H4><A NAME="lc50">lcx & lc50 & lc503</A></H4>

  Calculates LC50 and lcx values, given values for the NEC, killing rate and elimination rate.

  <p>
  Input:
  <ul>
    <li> 3-vector with NEC, killing rate and elimination rate </li>
    <li> n-vector with exposure times </li>
    <li> optional scalar for lcx: effect level, expressed as a number between 0 and 1<br>
         Default is 0.5 </li>
  </ul>

  <p>
  Output:
  <ul>
    <li> n-vector with LC50 or LCx values for the exposure times </li>
  </ul>

  <p>
  An example of application of lc50:
  <code>lc50([1, 1, 1], [3 4])</code>, which results in a 2-vector with [LC50.3d LC50.4d]. 
  Another application in regression and plotting routines is given in the script-file <code>mydata_lc50</code>, where LC50 data are used to extract the toxicity parameters (so just opposite to the previous application). 
  Consult the script-file for further explanation. 
  See also <A HREF="#lc503*"><code>lc503</code></A>.

  <p>
  <b>lc503</b> calculates values for the NEC, killing rate and elimination rate given three LC50 values.

  <p>
  Input: 
  <ul>
    <li> (3,2)-matrix with exposure times in column 1 and LC50 values in column 2 </li>
    <li> 3-vector with initial values for NEC, killing rate and elimination rate </li>
  </ul>

  <p>
  Output: 
  <ul>
    <li> 3-vector with final values for NEC, killing rate and elimination rate </li>
    <li> scalar with indicator for failure (0) or success (1) of numerical procedure </li>
  </ul>

  <p>
  An example of application of lc503 is for an appropriate (3,2) matrix <code>tc</code>: 
  <code>[p, err] = lc503(tc, [1, 1, .1])</code>. 
  The effect is very similar to <code>p = nmregr("lc50", [1, 1, .1]', tc)</code>, but <code>lc503</code> is much faster and exact.

<HR>
<H4><A NAME="ecx">ecx</A></H4>

  Calculates ecx values, given parameter values. 
  It uses a symplex method, so the conversion is slow.

  <p>
  Input:
  <ul>
    <li> character-string with function name (e.g. <code>marep</code> or <code>grgrowth</code>) </li>
    <li> parameter-vector with toxicity parameters </li>
    <li> n-vector with exposure times <li>
    <li> optional scalar for ecx: effect level, expressed as a number between 0 and 1<br>
         Default is 0.5 </li>
  </ul>

  <p>
  Output:
  <ul>
    <li> n-vector EC(100x) values for the exposure times </li>
  </ul>

  <p>
  An example of application:
  <code>ecx('marep', [.13 1 .16 15 .1 .13 .42 1]', 21, .99)</code>, 
  which results in the EC99.21d for effects on reproduction via effects on maintenance.

<HR>
<H4><A NAME="acc">acc</A></H4>

  Calculates internal concentrations, given the elimination rate and BioConcentration Factor (BCF) given exposure to a constant external concentration of a compound. 
  The initial internal concentration is assumed to be nil.

  <p>
  Input: 
  <ul>
    <li> (3,1)-matrix with values for the elimination rate, BCF and external concentration </li>
    <li> (nt,1)-matrix with exposure times </li>
  </ul>

  <p>
  Output: 
  <ul>
    <li> (nt,1)-matrix with internal concentrations </li>
  </ul>

  <p>
  An example of application of <code>acc</code> is given in <code>mydata_acc</code> for fitting accumulation data. 
  See also <code>acceli</code> for the case of accumulation and elimination data.

<HR>
<H4><A NAME="acceli">acceli</A></H4>

  Calculates internal concentrations, given the elimination rate and BioConcentration Factor (BCF) given exposure to a constant external concentration of a compound, followed by an elimination in absence of the compound. 
  The initial internal concentration is assumed to be nil.

  <p>
  Input:
  <ul>
    <li> (3,1)-matrix with values for the elimination rate, BCF and external concentration </li> 
    <li> (nt1,1)-matrix with exposure times of accumulation phase </li>
    <li> (nt2,1)-matrix with times during elimination phase </li>
  </ul>

  <p>
  Output: 
  <ul>
    <li> (nt1,1) and (nt2,1)-matrices with internal concentrations </li>
  </ul>
 
  <p>
  An example of application of <code>acceli</code> is given in <code> mydata_acceli </code> for fitting accumulation/elimination data. 
  See also <code>acc</code> for the case of accumulation data only.


<HR>
<H4><A NAME="*growth">*growth</A></H4>

  Calculates body lengths during exposure to a constant external concentration of a compound, given parameter values. 
  The initial internal concentration is assumed to be nill and food availability abundant. 
  Toxico-kinetics is assumed to follow the one-compartment model, but dilution by growth is taken into account. 
  No elimination via reproduction is assumed. 
  The internal concentration and the reserve are treated as hidden variables. 

  <p>
  These functions are meant to be used via parameter estimation procedures <a href="DEBtool_lib_regr.html#nrregr2"><code>nrregr2</code></a>, <a href="DEBtool_lib_regr.html#nmregr2"><code>nmregr2</code></a> or <a href="DEBtool_lib_regr.html#garegr2"><code>garegr2</code></a>. 
  The optional second column of the initial parameter matrix should be used, where most, if not all, of the physiological parameters are fixed (corresponding to value zero in the second column), because toxicity assays hardly contain information about these parameters. 
  In the cases of slow and fast kinetics, the third parameter, the elimination rate, should be kept fixed as well.

  <p>
  Three cases for elimination rates can be chosen and three modes of action, which gives 9 combinations:
  <ol>
    <li>slow kinetics: * stands for
      <ul>
        <li> <code>fe0</code> feeding </li>
        <li> <code>as0</code> assimilation </li>
        <li> <code>ma0</code> maintenance </li>
        <li> <code>gr0</code> growth </li>
      </ul>
    </li>
    <li>normal kinetics: * stands for
      <ul>
        <li> <code>fe</code> feeding </li>
        <li> <code>as</code> assimilation </li>
        <li> <code>ma</code> maintenance </li>
        <li> <code>gr</code> growth </li>
      </ul>
    </li>
    <li> fast kinetics: * stands for
      <ul>
        <li> <code>fei</code> feeding </li>
        <li> <code>asi</code> assimilation </li>
        <li> <code>mai</code> maintenance </li>
        <li> <code>gri</code> growth </li>
      </ul>
    </li>
  </ol>

  <p>
  Input: 
  <ul>
    <li> 7-vector with parameters
      <ol>
        <li> c0, mM, No-Effect-Concentration (external, may be zero) </li>
        <li> cT, mM, tolerance concentration </li>
        <li> ke, 1/d, elimination rate at L = Lm </li>
        <li> g, -, energy investment ratio </li>
        <li> kM, 1/d, somatic maint rate coeff </li>
        <li> v, cm/d, energy conductance </li>
        <li> L0, cm, initial body length </li>
      </ol>
      In the cases of slow (ke = 0) and fast (ke = infty) kinetics, the third parameter is not used. 
      In the case of slow kinetics parameters one and two have a different interpretation:
      concentration-times, rather than concentrations. 
      This is inherent to the fact that the compound accumulates without boundary if the elimiation rate is zero.
    </li>
    <li> (nt,1)-matrix with exposure times </li> 
    <li> (nc,1)-matrix with (external) concentrations </li>
  </ul>

  <p>
  Output:
  <ul>
    <li> (nt,nc)-matrix with lengths </li>
  </ul>
 
  <p>
  An example of application of <code>*growth</code> is given in <code>mydata_growth </code> for fitting length data.

<HR>
<H4><A NAME="*rep">*rep</A></H4>

  Calculates cumulative number of offspring per female during exposure to a constant external concentration of a compound, given parameter
values. 
  The initial internal concentration is assumed to be nill and food availability abundant. 
  Toxico-kinetics is assumed to follow the one-compartment model, but dilution by growth is taken into account. 
  No elimination via reproduction is assumed. 
  The internal concentration, maturity, reserve and structure are treated as hidden variables. 
  The parameters of the embryo are assumed to be affected by the compound in the same way as in the mother; 
  the relevance is in the amount of reserve that is required per egg. 
  The reproduction buffer is assumed to have capacity zero.

  <p>
  These functions are meant to be used via parameter estimation procedures 
  <a href="DEBtool_lib_regr.html#nrregr2"><code>nrregr2</code></a>, 
  <a href="DEBtool_lib_regr.html#nmregr2"><code>nmregr2</code></a> or 
  <a href="DEBtool_lib_regr.html#garegr2"><code>garegr2</code></a>. 
  The optional second column of the initial parameter matrix should be used, where most, if not all, of the physiological parameters are fixed (corresponding to value zero in the second column), because toxicity assays hardly contain information about these parameters. 
  In the cases of slow and fast kinetics, the third parameter, the elimination rate, should be kept fixed as well.

  <p>
  Three cases for elimination rates can be chosen and five modes of action, which gives 15 combinations:
  <ol>
    <li> slow kinetics: * stands for
      <ul>
        <li> <code>fe0</code> feeding </li>
        <li> <code>as0</code> assimilation </li>
        <li> <code>ma0</code> maintenance </li>
        <li> <code>gr0</code> growth </li>
        <li> <code>co0</code> costs per offspring </li>
        <li> <code>ha0</code> hazard of offspring </li>
      </ul>
    </li>
    <li>normal kinetics: * stands for
      <ul>
        <li> <code>fe</code> feeding </li>
        <li> <code>as</code> assimilation </li>
        <li> <code>ma</code> maintenance </li>
        <li> <code>gr</code> growth </li>
        <li> <code>co</code> costs per offspring </li>
        <li> <code>ha</code> hazard of offspring </li>
      </ul>
    </li>
    <li>fast kinetics: * stands for
      <ul>
        <li> <code>fei</code> feeding </li>
        <li> <code>asi</code> assimilation </li>
        <li> <code>mai</code> maintenance </li>
        <li> <code>gri</code> growth </li>
        <li> <code>coi</code> costs per offspring </li>
        <li> <code>hai</code> hazard of offspring </li>
      </ul>
    </li>
  </ol>

  <p>
  Input: 
  <ul>
    <li>12-vector with parameters
      <ol>
        <li> c0, mM, No-Effect-Concentration (external, may be zero) </li>
        <li> cT, mM, tolerance concentration </li>
        <li> ke, 1/d, elimination rate at L = Lm </li>
        <li> kap, -, fraction of mobilised reserve allocated to soma </li>
        <li> kapR, -, reproduction efficiency </li>
        <li> g, -, energy investment ratio </li>
        <li> kJ, 1/d, maturity maint rate coeff </li>
        <li> kM, 1/d, somatic maint rate coeff </li>
        <li> v, cm/d, energy conductance </li>
        <li> Hb, d.cm^2, scaled maturity at birth </li>
        <li> Hp, d.cm^2, scaled maturity at puberty </li>
        <li> L0, cm, initial body length </li>
      </ol>
      In the cases of slow (ke = 0) and fast (ke = infty) kinetics, the third parameter is not used.  
      In the case of slow kinetics parameters one and two have a different interpretation:
      concentration-times, rather than concentrations. 
      This is inherent to the fact that the compound accumulates without boundary if the elimiation rate is zero.
    </li>
    <li> (nt,1)-matrix with exposure times </li> 
    <li> (nc,1)-matrix with (external) concentrations </li>
  </ul>

  <p>
  Output: 
  <ul>
    <li> (nt,nc)-matrix with cumulative number of offspring </li>
  </ul>
 
  <p>
  An example of application of <code>*rep</code> is given in <code>mydata_rep</code> for fitting length data.

<HR>
<H4><A NAME="*pop">*pop</A></H4>

  Calculates (microbial) population size during exposure to a constant external concentration of a compound, given parameter values. 
  The internal concentration is assumed to be equilibrium instantaneously.

  <p>
  Input:
  <ul>
    <li> (4,1)-matrix with values for
      <ol>
        <li> NEC </li>
        <li> tolerance concentration </li>
        <li> initial population size </li>
        <li> spec population growth rate </li>
      </ol>
    </li>
    <li> (nt,1)-matrix with exposure times </li>
    <li> (nc,1)-matrix with external concentrations </li>
  </ul>

  <p>
  * stands for
  <ul>
    <li> <code>gr</code> growth </li>
    <li> <code>ha</code> hazard rate </li>
    <li> <code>ad</code> adaptation </li>
  </ul>

  The adaptiation model is basically the same as the hazard model, but only during the first time increment; 
  the survivors are no longer affected by the compound and the overall effect is a delay of growth only.

  <p>
  Output: 
  <ul>
   <li> (nt,nc)-matrix with population size </li>
  </ul>
 
  <p>
  An example of application of <code>*pop</code> is given in <code>mydata_pop </code> for fitting population growth data.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>lib/MultiCalib4DEB/examples/Clarias/Gariepinus/Clarias_gariepinus_res.html<|end_filename|>
<!DOCTYPE html>
<HTML>
<HEAD>
  <TITLE>Clarias_gariepinus</TITLE>
  <style>
    div.prd {
      width: 50%;
      float: left;
    }

    div.par {
      width: 50%;
      float: right;
    }

    p.clear {
      clear: both;
    }

    .head {
      background-color: #FFE7C6
    }

    .psd {
      color: blue
    }

    #prd {
      border-style: solid hidden solid hidden;
    }

    #par {
      border-style: solid hidden solid hidden;
    }

    tr:nth-child(even){background-color: #f2f2f2}
  </style>
</HEAD>

<BODY>

  <div class="prd">
  <h1>Clarias gariepinus</h1>
  </div>

  <div class="par">
  <h4>COMPLETE = 2.5; MRE =    0.017; SMSE =    0.022 </h4>
  </div>

  <p class="clear"></p>

  <div class="prd">
  <h2>Data & predictions</h2>
  <TABLE id="prd">
    <TR  class="head"><TH>data</TH> <TH>prd</TH> <TH>RE</TH>  <TH>symbol</TH> <TH>units</TH> <TH>description</TH> </TR>
    <TR><TD>1.25</TD> <TD>1.309</TD> <TD>0.04745</TD> <TD>ab25</TD> <TD>d</TD> <TD>age at birth</TD></TR>
    <TR><TD>0.58</TD> <TD>0.5949</TD> <TD>0.02577</TD> <TD>ab33</TD> <TD>d</TD> <TD>age at birth</TD></TR>
    <TR><TD>5475</TD> <TD>5475</TD> <TD>3.418e-05</TD> <TD>am</TD> <TD>d</TD> <TD>life span</TD></TR>
    <TR><TD>170</TD> <TD>170</TD> <TD>8.313e-05</TD> <TD>Li</TD> <TD>cm</TD> <TD>ultimate total length</TD></TR>
    <TR><TD>0.0012</TD> <TD>0.001177</TD> <TD>0.01915</TD> <TD>Wwb</TD> <TD>g</TD> <TD>wet weight at birth</TD></TR>
    <TR><TD>150</TD> <TD>150</TD> <TD>7.919e-05</TD> <TD>Wwp</TD> <TD>g</TD> <TD>wet weight at puberty</TD></TR>
    <TR><TD>6e+04</TD> <TD>6.008e+04</TD> <TD>0.001264</TD> <TD>Wwi</TD> <TD>g</TD> <TD>ultimate wet weight</TD></TR>
    <TR><TD>0.216</TD> <TD>0.2163</TD> <TD>0.001254</TD> <TD>GSI</TD> <TD>g/g</TD> <TD>gonado somatic index</TD></TR>
    <TR><TD colspan="2">see figure</TD> <TD>0.05391</TD> <TD>tW</TD> <TD colspan="2">time, <font color="blue"><i>vs.</i></font> wet weight</TD>
    <TR class="psd"><TD>0.02</TD> <TD>0.05458</TD> <TD>1.729</TD> <TD>psd.v</TD> <TD>cm/d</TD> <TD>energy conductance</TD></TR>
    <TR class="psd"><TD>0.8</TD> <TD>0.9365</TD> <TD>0.1706</TD> <TD>psd.kap</TD> <TD>-</TD> <TD>allocation fraction to soma</TD></TR>
    <TR class="psd"><TD>0.95</TD> <TD>0.95</TD> <TD>  0</TD> <TD>psd.kap_R</TD> <TD>-</TD> <TD>reproduction efficiency</TD></TR>
    <TR class="psd"><TD> 18</TD> <TD>299.7</TD> <TD>15.65</TD> <TD>psd.p_M</TD> <TD>J/d.cm^3</TD> <TD>vol-spec som maint</TD></TR>
    <TR class="psd"><TD>0.002</TD> <TD>0.002</TD> <TD>  0</TD> <TD>psd.k_J</TD> <TD>1/d</TD> <TD>maturity maint rate coefficient</TD></TR>
    <TR class="psd"><TD>0.8</TD> <TD>0.7999</TD> <TD>0.0001776</TD> <TD>psd.kap_G</TD> <TD>-</TD> <TD>growth efficiency</TD></TR>
  </TABLE>
  </div>

  <div class="par">
  <h2>abj parameters at 20.0&deg;C</h2>
  <TABLE id="par">
    <TR class="head"><TH>symbol</TH> <TH>units</TH> <TH>value</TH>  <TH>free</TH> <TH>description</TH> </TR>
    <TR><TD>T_ref</TD> <TD>K</TD> <TD>293.1</TD> <TD>0</TD> <TD>Reference temperature</TD></TR>
    <TR><TD>T_A</TD> <TD>K</TD> <TD>9000</TD> <TD>0</TD> <TD>Arrhenius temperature</TD></TR>
    <TR><TD>z</TD> <TD>-</TD> <TD>14.54</TD> <TD>1</TD> <TD>zoom factor</TD></TR>
    <TR><TD>F_m</TD> <TD>l/d.cm^2</TD> <TD>6.5</TD> <TD>0</TD> <TD>{F_m}, max spec searching rate</TD></TR>
    <TR><TD>kap_X</TD> <TD>-</TD> <TD>0.8</TD> <TD>0</TD> <TD>digestion efficiency of food to reserve</TD></TR>
    <TR><TD>kap_P</TD> <TD>-</TD> <TD>0.1</TD> <TD>0</TD> <TD>faecation efficiency of food to faeces</TD></TR>
    <TR><TD>v</TD> <TD>cm/d</TD> <TD>0.05458</TD> <TD>1</TD> <TD>energy conductance</TD></TR>
    <TR><TD>kap</TD> <TD>-</TD> <TD>0.9365</TD> <TD>1</TD> <TD>allocation fraction to soma</TD></TR>
    <TR><TD>kap_R</TD> <TD>-</TD> <TD>0.95</TD> <TD>0</TD> <TD>reproduction efficiency</TD></TR>
    <TR><TD>p_M</TD> <TD>J/d.cm^3</TD> <TD>299.7</TD> <TD>1</TD> <TD>[p_M], vol-spec somatic maint</TD></TR>
    <TR><TD>p_T</TD> <TD>J/d.cm^2</TD> <TD>  0</TD> <TD>0</TD> <TD>{p_T}, surf-spec somatic maint</TD></TR>
    <TR><TD>k_J</TD> <TD>1/d</TD> <TD>0.002</TD> <TD>0</TD> <TD>maturity maint rate coefficient</TD></TR>
    <TR><TD>E_G</TD> <TD>J/cm^3</TD> <TD>5231</TD> <TD>1</TD> <TD>[E_G], spec cost for structure</TD></TR>
    <TR><TD>E_Hb</TD> <TD>J</TD> <TD>0.02205</TD> <TD>1</TD> <TD>maturity at birth</TD></TR>
    <TR><TD>E_Hj</TD> <TD>J</TD> <TD>0.02205</TD> <TD>1</TD> <TD>maturity at metamorphosis</TD></TR>
    <TR><TD>E_Hp</TD> <TD>J</TD> <TD>2.94e+04</TD> <TD>1</TD> <TD>maturity at puberty</TD></TR>
    <TR><TD>h_a</TD> <TD>1/d^2</TD> <TD>3.845e-10</TD> <TD>1</TD> <TD>Weibull aging acceleration</TD></TR>
    <TR><TD>s_G</TD> <TD>-</TD> <TD>0.0001</TD> <TD>0</TD> <TD>Gompertz stress coefficient</TD></TR>
    <TR><TD>del_M</TD> <TD>-</TD> <TD>0.08554</TD> <TD>1</TD> <TD>shape coefficient for total length</TD></TR>
    <TR><TD>f</TD> <TD>-</TD> <TD>  1</TD> <TD>0</TD> <TD>scaled functional response for 0-var data</TD></TR>
    <TR><TD>f_tW</TD> <TD>-</TD> <TD>0.2929</TD> <TD>1</TD> <TD>scaled functional response for tW data</TD></TR>
  </TABLE>
  </div>

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/Odesolvers/ebtrkf45.c<|end_filename|>
/***
   NAME
     ebtrkf45
   DESCRIPTION
     This file contains the specification of the Runge-Kutta-Fehlberg 4/5th
     order integration method with an adaptive step size for the actual time
     integration of the ODEs in the Escalator Boxcar Train program.  
   NOTES
     
   HISTORY
     AMdR - Nov 08, 1998 : Created.
     AMdR - Jan 07, 2012 : Revised last.
***/
#ifndef EBTRKF45
#define EBTRKF45
#endif



/*==========================================================================*/
/*
 * Defining all constants that are local to this specific file.
 */

#define PSHRINK		-0.2
#define PGROW		-0.2
#define ABS_ERR		(2.0E-13)/accuracy
#define SAFETY		0.9



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define MAFO "Memory allocation failure in ODE integration routine!"
#define REC  "Too many recursions in integration to find suitable stepsize!"
#define SSS  "Step size in integration routine too small!"



/*==========================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

static int		step_failed=0, recur_no;
static long		ODEAllocated = 0L, SystemSize;
static double		abs_err;
static double		*xin = NULL, *xtemp = NULL;
static double		*der1 = NULL, *der2 = NULL, *der3 = NULL;
static double		*der4 = NULL, *der5 = NULL, *der6 = NULL;
#if (POPULATION_NR > 0)
static int		table_size[POPULATION_NR];
static population	u_pop[POPULATION_NR], 	   u_ofs[POPULATION_NR];
static population	u_popgrad1[POPULATION_NR], u_ofsgrad1[POPULATION_NR];
static population	u_popgrad2[POPULATION_NR], u_ofsgrad2[POPULATION_NR];
static population	u_popgrad3[POPULATION_NR], u_ofsgrad3[POPULATION_NR];
static population	u_popgrad4[POPULATION_NR], u_ofsgrad4[POPULATION_NR];
static population	u_popgrad5[POPULATION_NR], u_ofsgrad5[POPULATION_NR];
static population	u_popgrad6[POPULATION_NR], u_ofsgrad6[POPULATION_NR];
#else
static population	*bpoints = NULL;
static population	*u_pop = NULL, 	    *u_ofs = NULL;
static population	*u_popgrad1 = NULL, *u_ofsgrad1 = NULL;
static population	*u_popgrad2 = NULL, *u_ofsgrad2 = NULL;
static population	*u_popgrad3 = NULL, *u_ofsgrad3 = NULL;
static population	*u_popgrad4 = NULL, *u_ofsgrad4 = NULL;
static population	*u_popgrad5 = NULL, *u_ofsgrad5 = NULL;
static population	*u_popgrad6 = NULL, *u_ofsgrad6 = NULL;
#endif // (POPULATION_NR > 0)



/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

void	PrepareCycle()

  /* 
   * PrepareCycle - This routine is called at the beginning of a cohort
   *		    cycle, when the size of the system of ODEs is fixed and
   *		    will not change until the end of the cohort cycle has
   *		    been reached. The different memory copies of the data
   *		    to be integrated and the pointers into the data heap
   *		    can hence safely be set up.
   */

{
  abs_err = ABS_ERR;
  SystemSize    = ENVIRON_DIM;
#if (POPULATION_NR > 0)
  register int		i;

  for(i=0; i<POPULATION_NR; i++)
    {
      table_size[i] = CohortNo[i]+BpointNo[i];
      SystemSize   += table_size[i]*COHORT_SIZE;
    }
#endif //(POPULATION_NR > 0)
  if (!(SystemSize < ODEAllocated))
    {
      ODEAllocated = MemBlocks(SystemSize);
      xin   = (double *)Myalloc((void *)xin, (size_t)ODEAllocated,
				sizeof(double));
      xtemp = (double *)Myalloc((void *)xtemp, (size_t)ODEAllocated,
				sizeof(double));
      der1  = (double *)Myalloc((void *)der1, (size_t)ODEAllocated,
				sizeof(double));
      der2  = (double *)Myalloc((void *)der2, (size_t)ODEAllocated,
				sizeof(double));
      der3  = (double *)Myalloc((void *)der3, (size_t)ODEAllocated,
				sizeof(double));
      der4  = (double *)Myalloc((void *)der4, (size_t)ODEAllocated,
				sizeof(double));
      der5  = (double *)Myalloc((void *)der5, (size_t)ODEAllocated,
				sizeof(double));
      der6  = (double *)Myalloc((void *)der6, (size_t)ODEAllocated,
				sizeof(double));
      if(!(xin && xtemp && der1 && der2 && der3 && der4 && der5 && der6))
	ErrorAbort(MAFO);
    }

  (void)memcpy((DEF_TYPE *)xin,			/* Copy environment vars.   */
	       (DEF_TYPE *)env,
	       ENVIRON_DIM*sizeof(double));
#if (POPULATION_NR > 0)
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)(xin+len),	/* Copy all populations     */
		   (DEF_TYPE *)pop[i],
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      u_pop[i] = (population)(xtemp+len);
      u_ofs[i] = (population)(xtemp+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad1[i] = (population)(der1+len);
      u_ofsgrad1[i] = (population)(der1+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad2[i] = (population)(der2+len);
      u_ofsgrad2[i] = (population)(der2+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad3[i] = (population)(der3+len);
      u_ofsgrad3[i] = (population)(der3+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad4[i] = (population)(der4+len);
      u_ofsgrad4[i] = (population)(der4+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad5[i] = (population)(der5+len);
      u_ofsgrad5[i] = (population)(der5+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad6[i] = (population)(der6+len);
      u_ofsgrad6[i] = (population)(der6+len+CohortNo[i]*COHORT_SIZE);
      len += (table_size[i]*COHORT_SIZE);
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==========================================================================*/

static void	Fehlberg(double dt)

  /* 
   * Fehlberg - Routine performs a RKF45 integration step of the system and 
   *            updates all the variables.
   */

{
  register int		i;
  static CONST double	b11=  	    1.0/     4.0;
  static CONST double	b21=	    3.0/    32.0,  b22=	       9.0/     32.0;
  static CONST double	b31=	 1932.0/  2197.0,  b32= -   7200.0/   2197.0,
			b33=	 7296.0/  2197.0;
  static CONST double	b41=	 8341.0/  4104.0,  b42= -  32832.0/   4104.0,
			b43=	29440.0/  4104.0,  b44= -    845.0/   4104.0;
  static CONST double	b51= -	 6080.0/ 20520.0,  b52=    41040.0/  20520.0, 
			b53= -  28352.0/ 20520.0,  b54=     9295.0/  20520.0, 
			b55= -   5643.0/ 20520.0;
  static CONST double	b61=	 2375.0/ 20520.0,
			b63=	11264.0/ 20520.0,  b64=    10985.0/  20520.0,
			b65= -	 4104.0/ 20520.0;
  static CONST double	b71=   902880.0/7618050.0,
			b73=  3953664.0/7618050.0, b74=  3855735.0/7618050.0,
			b75= -1371249.0/7618050.0, b76=   277020.0/7618050.0;

  initState = xin;
  currentState   = xtemp;
  currentDers[1] = der1;
  currentDers[2] = der2;
  currentDers[3] = der3;
  currentDers[4] = der4;
  currentDers[5] = der5;
  currentDers[6] = der6;
						/* Set all time derivatives */
  der1[0] = der2[0] = der3[0] = der4[0] = der5[0] = der6[0] = 1.0;

						/* Don't do first deriva-   */
  if(!recur_no)					/* tive if already present  */
    {
      (void)memcpy((DEF_TYPE *)xtemp,(DEF_TYPE *)xin,
		   SystemSize*sizeof(double));
      rk_level = 1;
      Gradient(xtemp, u_pop, u_ofs, der1, u_popgrad1, u_ofsgrad1, bpoints);
    }

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + dt*(b11*der1[i]);

  rk_level = 2;
  Gradient(xtemp, u_pop, u_ofs, der2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + dt*(b21*der1[i]+b22*der2[i]);

  rk_level = 3;
  Gradient(xtemp, u_pop, u_ofs, der3, u_popgrad3, u_ofsgrad3, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + dt*(b31*der1[i]+b32*der2[i]+b33*der3[i]);

  rk_level = 4;
  Gradient(xtemp, u_pop, u_ofs, der4, u_popgrad4, u_ofsgrad4, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] +
      dt*(b41*der1[i]+b42*der2[i]+b43*der3[i]+b44*der4[i]);

  rk_level = 5;
  Gradient(xtemp, u_pop, u_ofs, der5, u_popgrad5, u_ofsgrad5, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] +
      dt*(b51*der1[i]+b52*der2[i]+b53*der3[i]+b54*der4[i]+b55*der5[i]);

  rk_level = 6;
  Gradient(xtemp, u_pop, u_ofs, der6, u_popgrad6, u_ofsgrad6, bpoints);

  for (i=0; i<SystemSize; i++)			/* Save 5th order values    */
    xtemp[i] = xin[i] +
      dt*(b71*der1[i]+b73*der3[i]+b74*der4[i]+b75*der5[i]+b76*der6[i]);

						/* Save differences with 4th*/
  for (i=0; i<SystemSize; i++)			/* order values in der2     */
    der2[i] = xin[i] - xtemp[i] +		/* (no longer needed)       */
      dt*(b61*der1[i]+b63*der3[i]+b64*der4[i]+b65*der5[i]);

  return;
}




/*==========================================================================*/

double	  IntegrationStep(double del_tim, double del_max, int recurs)

  /* 
   * IntegrationStep - Performs an integration with adaptable step size but 
   *                   maximum "del_max". Step size control and order 
   *                   increase using Fehlberg's method as implemented by 
   *                   Watts & Shampine (see Forsythe et al., 1977,
   *		       Computer methods for mathematical computations,
   *		       Chapter 6). 
   */
  
{
  register int		i;
  register double	*pin, *perr, *pout;
  double		del_h, ss;
  double		errmax;
  int			adjust = 1;
  
  del_h = del_tim;				/* Adjust stepsize to hit   */
  if(del_max < (2*del_tim))			/* cohort end, look ahead   */
    {						/* two steps to avoid too   */
      del_h = 0.5*del_max;			/* drastic step changes	    */
      if(del_max < del_tim) del_h = del_max;
      adjust = 0;
    }
  if(del_h < SMALLEST_STEP)
    {
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      ErrorExit(0, SSS);
    }
  recur_no = recurs;

  Fehlberg(del_h);				/* Do an integration step   */

  pin = xin; perr = der2; pout = xtemp; errmax=0.0;
  for(i=0; i<SystemSize; i++)
      errmax = max(fabs(perr[i])/(fabs(pin[i])+fabs(pout[i])+abs_err),
		   errmax);			/* Determine relative error */
  errmax *= 2.0*del_h/accuracy;			/* according to Watts &	    */
						/* Shampine (see Forsythe)  */

						/* If bigger than accuracy  */
  if (errmax > 1.0)				/* take smaller step and    */
    {						/* restart. Stepdecrease    */
      recur_no++; step_failed=1;		/* is limited to 0.1.	    */

      if (recur_no > 25)
	{
#if (POPULATION_NR > 0)
	  TransBcohorts();
#endif // (POPULATION_NR > 0)
	  ErrorExit(0, REC);
	}
						/* This part is adapted	    */
      if(errmax < 59049.0)			/* from Watts & Shampine    */
	del_h *= max(SAFETY*pow(errmax, PSHRINK), 0.1);
      else del_h *= 0.1;
      step_size = del_h;
      del_h=IntegrationStep(del_h, del_max, recur_no);
    }						/* Otherwise compute new    */
  else						/* stepsize. Increase is    */
    {						/* limited to factor 5.0    */
      if (adjust && !step_failed)		/* No increase if failed    */
	{					/* just before		    */
	  if(errmax > 1.889568E-4) ss = min(SAFETY*pow(errmax, PGROW), 5.0);
	  else ss = 5.0;
	  step_size=min(ss*del_h, cohort_limit);
	}
      step_failed=0;

						/* Update basic data copy   */
      (void)memcpy((DEF_TYPE *)env,		/* Copy environment vars.   */
                   (DEF_TYPE *)xtemp,
		   ENVIRON_DIM*sizeof(double));
#if (POPULATION_NR > 0)
      int			len, adjust = 1;

      len = ENVIRON_DIM;
      for(i=0; i<POPULATION_NR; i++)
	{
	  (void)memcpy((DEF_TYPE *)pop[i],	/* Copy all populations     */
		       (DEF_TYPE *)(xtemp+len),
		       (table_size[i]*COHORT_SIZE)*sizeof(double));
	  len += (table_size[i]*COHORT_SIZE);
	}
#endif // (POPULATION_NR > 0)
						/* Update local data copy   */
      (void)memcpy((DEF_TYPE *)xin,(DEF_TYPE *)xtemp,
		   SystemSize*sizeof(double));

    }
  
  return del_h;
}



/*==========================================================================*/


<|start_filename|>popDyn/EBTtool/Odesolvers/ebtradau.c<|end_filename|>
/***
   NAME
     ebtradau
   DESCRIPTION
     This file contains the specification of the implicit RADAU5 method with
     step size control and dense output for the actual time integration of the
     ODEs in the Escalator Boxcar Train program. This method is used here
     especially for event location and problems with algebraic restriction
     conditions. 
     The code is translated from the original Fortran source code, written by

		<NAME> & <NAME>
		Universite de Geneve, dept. de Mathematiques
		CH-1211 GENEVE 4, SWITZERLAND
		E-mail : <EMAIL>, <EMAIL>

     The code is described in : <NAME>, <NAME> and <NAME>, Solving
     ordinary differential equations II, Stiff and Differential-Algebraic
     problems, 2nd edition, Springer Series in Computational Mathematics,
     Springer-Verlag (1996).
     
   Last modification: AMdR - Jan 07, 2012
***/
#ifndef EBTRADAU
#define EBTRADAU
#endif

#ifndef RADAU_TEST
#define RADAU_TEST	0
#endif


/*==========================================================================*/
/*
 * Defining all constants that are local to this specific file.
 */
/*==========================================================================*/
/*
 * Return codes
 */
#define SUCCESS		0
#define BAD_CONVERGENCE	10101
#define NO_CONVERGENCE	10102
#define SINGULARITY	10103
#define MAX_ITERATIONS	10104

/*
 * Constants in method
 */
#define THET	0.001		/* Decides when Jacobian is recomputed      */
#define NIT	7		/* Maximum number of newton iterations      */
#define UROUND	1.0E-16		/* Smallest value satisfying 1.0+UROUND>1.0 */
#define SAFE	0.9		/* Safety factor in step size prediction    */
#define FACL	5.0		/* Parameters for step size selection       */
#define FACR	0.125		/* Default: FACL = 5.0; FACR = 0.125        */
#define QUOT1	1.0		/* If QUOT1 < HNEW/HOLD < QUOT2, step size  */
#define QUOT2	1.2		/* is not changed.                          */
#define JACSTEP 1.0E-5		/* Step size for Jacobian computation       */
#define INIT_H	1.0E-2		/* Initial stepsize when restarting         */
#define ABS_ERR	1.0E-13



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define MAFO "Memory allocation failure in ODE integration routine!"
#define REC  "Too many recursions in integration to find suitable stepsize!"
#define SSS  "Step size in integration routine too small!"
#define SIN  "Matrix is repeatedly singular in radau5()!"
#define ZBB  "Root is not bracketed in ZBRENT!"
#define ZBM  "Maximum number of iterations exceeded in ZBRENT!"


/*==========================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

static int		step_failed=0, recur_no;
static long		ODEAllocated = 0L, SystemSize, JacobianSize;

static double		*y      = NULL, *yy1    = NULL, *yy2    = NULL;
static double		*Jac    = NULL, *scal   = NULL, *z0     = NULL;
static double		*E1     = NULL, *E2R    = NULL, *E2I    = NULL;
static double		*z1     = NULL, *z2     = NULL, *z3     = NULL;
static double		*f1     = NULL, *f2     = NULL, *f3     = NULL;
static double		*rcont1 = NULL, *rcont2 = NULL, *rcont3 = NULL;
static int		*daes   = NULL, *ip1    = NULL, *ip2    = NULL;

#if (POPULATION_NR > 0)
static population	u_pop1[POPULATION_NR], 	   u_ofs1[POPULATION_NR];
static population	u_pop2[POPULATION_NR], 	   u_ofs2[POPULATION_NR];

static population_index	i_pop1[POPULATION_NR], 	   i_ofs1[POPULATION_NR];

static population	u_popgrad0[POPULATION_NR], u_ofsgrad0[POPULATION_NR];
static population	u_popgrad1[POPULATION_NR], u_ofsgrad1[POPULATION_NR];
static population	u_popgrad2[POPULATION_NR], u_ofsgrad2[POPULATION_NR];
static population	u_popgrad3[POPULATION_NR], u_ofsgrad3[POPULATION_NR];
static population	u_popgrad4[POPULATION_NR], u_ofsgrad4[POPULATION_NR];
#else
static population	*bpoints = NULL;
static population	*u_pop1 = NULL,     *u_ofs1 = NULL;
static population	*u_pop2 = NULL,     *u_ofs2 = NULL;

static population	*u_popgrad0 = NULL, *u_ofsgrad0 = NULL;
static population	*u_popgrad1 = NULL, *u_ofsgrad1 = NULL;
static population	*u_popgrad2 = NULL, *u_ofsgrad2 = NULL;
static population	*u_popgrad3 = NULL, *u_ofsgrad3 = NULL;
static population	*u_popgrad4 = NULL, *u_ofsgrad4 = NULL;
#endif // (POPULATION_NR > 0)

static const double	_c1    =    .15505102572168219018,
			_c2    =    .64494897427831780982,
			_c1m1  =   -.84494897427831780982,
			_c2m1  =   -.35505102572168219018,
			_c1mc2 =   -.48989794855663561964,
			_dd1   = -10.048809399827415562,
			_dd2   =   1.3821427331607488958,
			_dd3   =   -.33333333333333333333,
			_u1    =   3.6378342527444957322,
			_alph  =   2.6810828736277521338,
			_beta  =   3.0504301992474105693;
  
static const double	_t11  =   .091232394870892942792,
			_t12  =  -.14125529502095420843,
			_t13  =  -.030029194105147424492,
			_t21  =   .24171793270710701896,
			_t22  =   .20412935229379993199,
			_t23  =   .38294211275726193779,
			_t31  =   .96604818261509293619,
			_ti11 =  4.325579890063155351,
			_ti12 =   .33919925181580986954,
			_ti13 =   .54177053993587487119,
			_ti21 = -4.1787185915519047273,
			_ti22 =  -.32768282076106238708,
			_ti23 =   .47662355450055045196,
			_ti31 =  -.50287263494578687595,
			_ti32 =  2.5719269498556054292,
			_ti33 =  -.59603920482822492497;

static int		start_new = 1, jac_new = 1, caljac = 0, dec_new = 1;
static int		newt = 0;
static int		nfcn = 0, njac = 0, ndec = 0, nsol = 0, nsing = 0;
static int		naccpt = 0, nrejct = 0;
static double		faccon, theta, hhfac, erracc, hacc;
static double		dynold, thqold;
static double		dtold = 0.0;
#if (EVENT_NR > 0)
static double		oldELvalue[EVENT_NR] = {0.0},
			newELvalue[EVENT_NR] = {0.0};
static int		located[EVENT_NR] = {0};
#endif


/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

void	PrepareCycle()

  /* 
   * PrepareCycle - This routine is called at the beginning of a cohort
   *		    cycle, when the size of the system of ODEs is fixed and
   *		    will not change until the end of the cohort cycle has
   *		    been reached. The different memory copies of the data
   *		    to be integrated and the pointers into the data heap
   *		    can hence safely be set up.
   */

{
  int				org, len;

  SystemSize    = ENVIRON_DIM;
#if (POPULATION_NR > 0)
  register int			i;

  for(i=0; i<POPULATION_NR; i++)
    SystemSize   += (CohortNo[i]+BpointNo[i])*COHORT_SIZE;
#endif // (POPULATION_NR > 0)
  JacobianSize = SystemSize*SystemSize;

  if (!(SystemSize < ODEAllocated))
    {
      ODEAllocated = MemBlocks(SystemSize);
      y    = (double *)Myalloc((void *)y, (size_t)ODEAllocated,
			       sizeof(double));
      yy1  = (double *)Myalloc((void *)yy1, (size_t)ODEAllocated,
			       sizeof(double));
      yy2  = (double *)Myalloc((void *)yy2, (size_t)ODEAllocated,
			       sizeof(double));
      Jac  = (double *)Myalloc((void *)Jac, (size_t)(ODEAllocated*ODEAllocated),
			       sizeof(double));
      E1   = (double *)Myalloc((void *)E1, (size_t)(ODEAllocated*ODEAllocated),
			       sizeof(double));
      E2R  = (double *)Myalloc((void *)E2R, (size_t)(ODEAllocated*ODEAllocated),
			       sizeof(double));
      E2I  = (double *)Myalloc((void *)E2I, (size_t)(ODEAllocated*ODEAllocated),
			       sizeof(double));
      scal = (double *)Myalloc((void *)scal, (size_t)ODEAllocated,
			       sizeof(double));
      daes = (int *)   Myalloc((void *)daes, (size_t)ODEAllocated,
			       sizeof(int));
      ip1  = (int *)   Myalloc((void *)ip1, (size_t)ODEAllocated,
			       sizeof(int));
      ip2  = (int *)   Myalloc((void *)ip2, (size_t)ODEAllocated,
			       sizeof(int));
      z0   = (double *)Myalloc((void *)z0, (size_t)ODEAllocated,
			       sizeof(double));
      z1   = (double *)Myalloc((void *)z1, (size_t)ODEAllocated,
			       sizeof(double));
      z2   = (double *)Myalloc((void *)z2, (size_t)ODEAllocated,
			       sizeof(double));
      z3   = (double *)Myalloc((void *)z3, (size_t)ODEAllocated,
			       sizeof(double));
      f1   = (double *)Myalloc((void *)f1, (size_t)ODEAllocated,
			       sizeof(double));
      f2   = (double *)Myalloc((void *)f2, (size_t)ODEAllocated,
			       sizeof(double));
      f3   = (double *)Myalloc((void *)f3, (size_t)ODEAllocated,
			       sizeof(double));
      rcont1  = (double *)Myalloc((void *)rcont1, (size_t)ODEAllocated,
				  sizeof(double));
      rcont2  = (double *)Myalloc((void *)rcont2, (size_t)ODEAllocated,
				  sizeof(double));
      rcont3  = (double *)Myalloc((void *)rcont3, (size_t)ODEAllocated,
				  sizeof(double));
      if(!(y && yy1 && yy2 && Jac && E1 && E2R && E2I && scal &&
	   daes && ip1 && ip2 && z0 && z1 && z2 && z3 && f1 && f2 && f3 &&
	   rcont1 && rcont2 && rcont3))
	ErrorAbort(MAFO);
#if RADAU_TEST
      start_new = 1;
      jac_new = 1;
      dec_new = 1;
      nsing = 0;
      step_size = 1.0E-6;
      faccon = 1.0;
#endif
    }

#if (!RADAU_TEST)
  start_new = 1;
  jac_new = 1;
  dec_new = 1;
  nsing = 0;
  step_size = INIT_H;
  faccon = 1.0;
#endif

  org = 0;
  len = ENVIRON_DIM;				/* Copy environment vars.   */
  (void)memcpy((DEF_TYPE *)y, (DEF_TYPE *)env, len*sizeof(double));
  
#if (POPULATION_NR > 0)
  for(i=0; i<POPULATION_NR; i++)
    {
      org += len;
      len  = (BpointNo[i]*COHORT_SIZE);
      (void)memcpy((DEF_TYPE *)(y+org), (DEF_TYPE *)ofs[i], len*sizeof(double));
      u_ofs1[i] = (population)(yy1+org);
      u_ofs2[i] = (population)(yy2+org);
      
      i_ofs1[i] = (population_index)(daes+org);

      u_ofsgrad0[i] = (population)(z0+org);
      u_ofsgrad1[i] = (population)(z1+org);
      u_ofsgrad2[i] = (population)(z2+org);
      u_ofsgrad3[i] = (population)(z3+org);

      u_ofsgrad4[i] = (population)(f1+org);
    }

  for(i=0; i<POPULATION_NR; i++)
    {
      org += len;
      len  = (CohortNo[i]*COHORT_SIZE);
      (void)memcpy((DEF_TYPE *)(y+org), (DEF_TYPE *)pop[i], len*sizeof(double));
      u_pop1[i] = (population)(yy1+org);
      u_pop2[i] = (population)(yy2+org);
      
      i_pop1[i] = (population_index)(daes+org);

      u_popgrad0[i] = (population)(z0+org);
      u_popgrad1[i] = (population)(z1+org);
      u_popgrad2[i] = (population)(z2+org);
      u_popgrad3[i] = (population)(z3+org);

      u_popgrad4[i] = (population)(f1+org);
    }
#endif // (POPULATION_NR > 0)

  /*
   * Here I should set all entries in daes[] to 1 that represent algebraic
   * equations.
   */

  (void)memset((DEF_TYPE *)daes, 0, (size_t)(ODEAllocated*sizeof(int)));

  return;
}




/*==============================================================================*/

static int 	dec(int dimM, double *M, int *perm, int *sign)

  /**
     NAME:
	dec
     NOTES:
	MATRIX TRIANGULARIZATION BY GAUSSIAN ELIMINATION.

	INPUT..
		dimM = DIMENSION OF MATRIX.
		M    = MATRIX TO BE TRIANGULARIZED.
	OUTPUT..
		M(I,J),  I.LE.J = UPPER TRIANGULAR FACTOR, U .
		M(I,J),  I.GT.J = MULTIPLIERS = LOWER TRIANGULAR FACTOR, I - L.
		perm(K), K.LT.N = INDEX OF K-TH PIVOT ROW.
		sign = (-1)**(NUMBER OF INTERCHANGES) OR O.
	RETURNS..
		RETURN = 0 IF MATRIX M IS NONSINGULAR, OR `SINGULARITY'

	USE  SOL  TO OBTAIN SOLUTION OF LINEAR SYSTEM.
	DETERM(M) = sign*M(1,1)*M(2,2)*...*M(N,N).
	IF sign=O, M IS SINGULAR, SOL WILL DIVIDE BY ZERO.

  REFERENCE..
     <NAME>, ALGORITHM 423, LINEAR EQUATION SOLVER,
     C.A.C.M. 15 (1972), P. 274.
  
**/

{
  register int		i, j, k, m;
  int			nm1, kp1;
  double		T;
  
  *sign = 1;
  nm1 = dimM - 1;
  for (k = 0; k < nm1; k++)
    {
      kp1 = k + 1;
      m = k;
      for (i = kp1; i < dimM; i++)
	if (fabs(M[i*dimM+k]) > fabs(M[m*dimM+k])) m = i;
      perm[k] = m;
      T = M[m*dimM+k];
      if (m != k)
	{
	  *sign = -(*sign);
	  M[m*dimM+k] = M[k*dimM+k];
	  M[k*dimM+k] = T;
	}
      if (fabs(T) < UROUND)
	{
	  *sign = 0;
	  return SINGULARITY;
	}

      T = -1.0/T;
      for (i = kp1; i < dimM; i++) M[i*dimM+k] *= T;

      for (j = kp1; j < dimM; j++)
	{
	  T = M[m*dimM+j];
	  M[m*dimM+j] = M[k*dimM+j];
	  M[k*dimM+j] = T;
	  if (fabs(T) < UROUND) continue;
	  for (i = kp1; i < dimM; i++) M[i*dimM+j] += M[i*dimM+k]*T;
	}
    }

  if (fabs(M[dimM*dimM-1]) < UROUND)
    {
      *sign = 0;
      return SINGULARITY;
    }
  
  return 0;
} /* dec */




/*==============================================================================*/

static int 	decc(int dimM, double *MR, double *MI, int *perm, int *sign)

  /**
     NAME:
	decc
     NOTES:
	MATRIX TRIANGULARIZATION BY GAUSSIAN ELIMINATION.
	------ MODIFICATION FOR COMPLEX MATRICES --------

	INPUT..
		dimM   = DIMENSION OF MATRIX.
		MR, MI = MATRIX TO BE TRIANGULARIZED.
	OUTPUT..
		MR(I,J),  I.LE.J = UPPER TRIANGULAR FACTOR, U; REAL PART.
		MI(I,J),  I.LE.J = UPPER TRIANGULAR FACTOR, U; IMAGINARY PART.
		MR(I,J),  I.GT.J = MULTIPLIERS = LOWER TRIANGULAR FACTOR, I - L.
							       REAL PART.
		MI(I,J),  I.GT.J = MULTIPLIERS = LOWER TRIANGULAR FACTOR, I - L.
							       IMAGINARY PART.
		perm(K), K.LT.N = INDEX OF K-TH PIVOT ROW.
		sign = (-1)**(NUMBER OF INTERCHANGES) OR O.
	RETURNS..
		RETURN = 0 IF MATRIX M IS NONSINGULAR, OR `SINGULARITY'

	USE  SOLC  TO OBTAIN SOLUTION OF LINEAR SYSTEM.
	IF sign=O, M IS SINGULAR, SOL WILL DIVIDE BY ZERO.

  REFERENCE..
     <NAME>, ALGORITHM 423, LINEAR EQUATION SOLVER,
     C.A.C.M. 15 (1972), P. 274.
  
**/

{
  register int		i, j, k, m;
  int			nm1, kp1;
  double		TR, TI, PRODR, PRODI, DEN;
  
  *sign = 1;
  nm1 = dimM - 1;
  for (k = 0; k < nm1; k++)
    {
      kp1 = k + 1;
      m = k;
      for (i = kp1; i < dimM; i++)
	if ((fabs(MR[i*dimM+k])+fabs(MI[i*dimM+k])) >
	    (fabs(MR[m*dimM+k])+fabs(MI[m*dimM+k]))) m = i;
      perm[k] = m;
      TR = MR[m*dimM+k];
      TI = MI[m*dimM+k];
      if (m != k)
	{
	  *sign = -(*sign);
	  MR[m*dimM+k] = MR[k*dimM+k];
	  MI[m*dimM+k] = MI[k*dimM+k];
	  MR[k*dimM+k] = TR;
	  MI[k*dimM+k] = TI;
	}
      if ((fabs(TR)+fabs(TI)) < UROUND)
	{
	  *sign = 0;
	  return SINGULARITY;
	}

      DEN = TR*TR+TI*TI;
      TR /=  DEN;
      TI /= -DEN;
      for (i = kp1; i < dimM; i++)
	{
	  PRODR = MR[i*dimM+k]*TR - MI[i*dimM+k]*TI;
	  PRODI = MI[i*dimM+k]*TR + MR[i*dimM+k]*TI;
	  MR[i*dimM+k] = -PRODR;
	  MI[i*dimM+k] = -PRODI;
	}
      for (j = kp1; j < dimM; j++)
	{
	  TR = MR[m*dimM+j];
	  TI = MI[m*dimM+j];
	  MR[m*dimM+j] = MR[k*dimM+j];
	  MI[m*dimM+j] = MI[k*dimM+j];
	  MR[k*dimM+j] = TR;
	  MI[k*dimM+j] = TI;
	  if ((fabs(TR)+fabs(TI)) < UROUND) continue;
	  else
	    {
	      for (i = kp1; i < dimM; i++)
		{
		  PRODR = MR[i*dimM+k]*TR - MI[i*dimM+k]*TI;
		  PRODI = MI[i*dimM+k]*TR + MR[i*dimM+k]*TI;
		  MR[i*dimM+j] += PRODR;
		  MI[i*dimM+j] += PRODI;
		}
	    }
	}
    }

  if ((fabs(MR[dimM*dimM-1])+fabs(MI[dimM*dimM-1])) < UROUND)
    {
      *sign = 0;
      return SINGULARITY;
    }
  
  return 0;
} /* decc */




/*==============================================================================*/

static void 	sol(int dimM, double *M, double *V, int *perm)

  /**
     NAME:
	sol
     NOTES:
	SOLUTION OF LINEAR SYSTEM, M*X = V.

     INPUT..
	dimM = ORDER OF MATRIX.
	M    = TRIANGULARIZED MATRIX OBTAINED FROM DEC.
	V    = RIGHT HAND SIDE VECTOR.
	perm = PIVOT VECTOR OBTAINED FROM DEC.

	DO NOT USE IF DEC HAS RETURNED A SINGULARITY

     OUTPUT..
	V    = SOLUTION VECTOR, X.
**/

{
  register int		i, j, k, m;
  int			kp1, km1, nm1;
  double 		T;
  
  nm1 = dimM - 1;
  for (k = 0; k < nm1; k++)
    {
      kp1 = k + 1;
      m = perm[k];
      T = V[m];
      V[m] = V[k];
      V[k] = T;
      for (i = kp1; i < dimM; i++) V[i] += M[i*dimM+k]*T;
    }
  for (j = 0; j < nm1; j++)
    {
      km1 = dimM - 1 - j;
      k   = km1;
      V[k] /= M[k*dimM+k];
      T = -V[k];
      for (i = 0; i < km1; i++) V[i] += M[i*dimM+k]*T;
    }
  *V /= *M;
  
  return;
} /* sol */





/*==============================================================================*/

static void 	solc(int dimM, double *MR, double *MI, double *VR, double *VI,
		     int *perm)

  /**
     NAME:
	solc
     NOTES:
	SOLUTION OF LINEAR SYSTEM, M*X = V.
	------ MODIFICATION FOR COMPLEX MATRICES --------
     INPUT..
	dimM   = ORDER OF MATRIX.
	MR, MI = TRIANGULARIZED MATRIX OBTAINED FROM DECC.
	VR, VI = RIGHT HAND SIDE VECTOR.
	perm   = PIVOT VECTOR OBTAINED FROM DECC.

	DO NOT USE IF DECC HAS RETURNED A SINGULARITY

     OUTPUT..
	VR, VI = SOLUTION VECTOR, X.
**/

{
  register int		i, j, k, m;
  int			kp1, km1, nm1;
  double 		TR, TI, PRODR, PRODI, DEN;
  
  nm1 = dimM - 1;
  for (k = 0; k < nm1; k++)
    {
      kp1 = k + 1;
      m = perm[k];
      TR    = VR[m];
      TI    = VI[m];
      VR[m] = VR[k];
      VI[m] = VI[k];
      VR[k] = TR;
      VI[k] = TI;
      for (i = kp1; i < dimM; i++)
	{
	  PRODR  = MR[i*dimM+k]*TR - MI[i*dimM+k]*TI;
	  PRODI  = MI[i*dimM+k]*TR + MR[i*dimM+k]*TI;
	  VR[i] += PRODR;
	  VI[i] += PRODI;
	}
    }
  for (j = 0; j < nm1; j++)
    {
      km1   = dimM - 1 - j;
      k     = km1;
      DEN   = MR[k*dimM+k]*MR[k*dimM+k] + MI[k*dimM+k]*MI[k*dimM+k];
      PRODR = VR[k]*MR[k*dimM+k] + VI[k]*MI[k*dimM+k];
      PRODI = VI[k]*MR[k*dimM+k] - VR[k]*MI[k*dimM+k];
      VR[k] = PRODR/DEN;
      VI[k] = PRODI/DEN;
      TR    = -VR[k];
      TI    = -VI[k];
      for (i = 0; i < km1; i++)
	{
	  PRODR  = MR[i*dimM+k]*TR - MI[i*dimM+k]*TI;
	  PRODI  = MI[i*dimM+k]*TR + MR[i*dimM+k]*TI;
	  VR[i] += PRODR;
	  VI[i] += PRODI;
	}
    }
  DEN   = (*MR)*(*MR) + (*MI)*(*MI);
  PRODR = (*VR)*(*MR) + (*VI)*(*MI);
  PRODI = (*VI)*(*MR) - (*VR)*(*MI);
  *VR   = PRODR/DEN;
  *VI   = PRODI/DEN;
  
  return;
} /* solc */





/*==============================================================================*/

static int   rad_core(double dt, int jn, int dn)

  /* 
   * rad_core - Routine performs an integration step of the system using the
   *	        RADAU5 integration method. The code is translated from the
   *	        Fortran source code by <NAME> & <NAME>.
   */

{
  register int		i, j;
  int			error = 0, done = 0;
  int			signE1, signE2;
  double		ysafe, delt;
  double		_hv1, _hv2, _hv3;
  double		fac1, alphn, betan;
  double		c1q, c2q, c3q = 1.0;
  double		dyn, dyth, thq, qnewt, fnewt;

  _hv1 = 0.1*pow(accuracy, 2.0/3.0);
  fnewt= max(10*UROUND/_hv1, min(0.03, pow(_hv1, 0.5)));

						/* Don't do first deriva-   */
  if(!recur_no)					/* tive if already present  */
    {
      (void)memcpy((DEF_TYPE *)yy1, (DEF_TYPE *)y, SystemSize*sizeof(double));
      rk_level = 1;
      hhfac = dt;
      Gradient(yy1, u_pop1, u_ofs1, z0, u_popgrad0, u_ofsgrad0, bpoints);
      nfcn++;
#if (EVENT_NR > 0)
      for (i=0; i<EVENT_NR; i++) oldELvalue[i] = NO_EVENT;
      EventLocation(yy1, u_pop1, u_ofs1, bpoints, oldELvalue);
#endif
    }

  /* 
   * Compute the Jacobian
   */
  if (jn)
    {
#if RADAU_TEST
      Jac[0] = 0.0; Jac[1] = 0.0; Jac[2] = 0.0; 
      Jac[3] = 0.0; Jac[4] = 0.0; Jac[5] = 1.0; 
      Jac[6] = 0.0; 
      Jac[7] = (-2.0*yy1[1]*yy1[2]-1.0)/(1.0E-6);
      Jac[8] = (1.0-yy1[1]*yy1[1])/(1.0E-6);
#else
      for (i = 0; i < SystemSize; i++)
	{
	  ysafe  = yy1[i];
	  delt   = sqrt(UROUND * max(JACSTEP, fabs(ysafe)));
	  yy1[i] = ysafe + delt;
	  Gradient(yy1, u_pop1, u_ofs1, yy2, u_pop2, u_ofs2, bpoints);
	  nfcn++;
	  for (j = 0; j < SystemSize; j++)
	    Jac[j*SystemSize+i] = (yy2[j] - z0[j]) / delt;
	  yy1[i] = ysafe;
	}
#endif
      njac++;
      caljac = 1;
    }
  /*
   * LU decompose of the E1 and E2 matrices
   */
  fac1  = _u1/dt;
  alphn = _alph/dt;
  betan = _beta/dt;

  if (jn || dn)
    {
      for (i = 0; i < JacobianSize; i++) E1[i] = -Jac[i];

      (void)memcpy((DEF_TYPE *)E2R, (DEF_TYPE *)E1, JacobianSize*sizeof(double));
      (void)memset((DEF_TYPE *)E2I, 0, (size_t)(JacobianSize*sizeof(double)));

      for (i = 0; i < SystemSize; i++)
	{
	  if (daes[i]) continue;
	  j = i*SystemSize+i;
	  E1[j]  += fac1;
	  E2R[j] += alphn;
	  E2I[j] += betan;
	}

      error = dec(SystemSize, E1, ip1, &signE1);
      if (error) return SINGULARITY;

      error = decc(SystemSize, E2R, E2I, ip2, &signE2);
      if (error) return SINGULARITY;
      ndec++;
    }
  
  /*
   *  Starting values for the newton iterations
   */
  if (start_new)
    {
      c3q = dt;
      c1q = _c1*c3q;
      c2q = _c2*c3q;
      for (i = 0; i < SystemSize; i++)
	{
	  if (daes[i])
	    {
	      z1[i] = 0.0;
	      z2[i] = 0.0;
	      z3[i] = 0.0;
	    }
	  else
	    {
	      z1[i] = c1q*z0[i];
	      z2[i] = c2q*z0[i];
	      z3[i] = c3q*z0[i];
	    }
	}
    }
  else
    {
      c3q = dt/dtold;
      c1q = _c1*c3q;
      c2q = _c2*c3q;
      for (i = 0; i < SystemSize; i++)
	{
	  _hv1 = rcont1[i];
	  _hv2 = rcont2[i];
	  _hv3 = rcont3[i];
	  z1[i] = c1q*(_hv1+(c1q - _c2m1)*(_hv2+(c1q - _c1m1)*_hv3));
	  z2[i] = c2q*(_hv1+(c2q - _c2m1)*(_hv2+(c2q - _c1m1)*_hv3));
	  z3[i] = c3q*(_hv1+(c3q - _c2m1)*(_hv2+(c3q - _c1m1)*_hv3));
	}
    }

  for (i = 0; i < SystemSize; i++)
    {
      _hv1 = z1[i];
      _hv2 = z2[i];
      _hv3 = z3[i];
      f1[i] = _ti11*_hv1+_ti12*_hv2+_ti13*_hv3;
      f2[i] = _ti21*_hv1+_ti22*_hv2+_ti23*_hv3;
      f3[i] = _ti31*_hv1+_ti32*_hv2+_ti33*_hv3;
    }

  faccon = pow(max(faccon, UROUND), 0.8);
  theta  = fabs(THET);
  
  for (newt = 0; (!done) && (newt < NIT); newt++)
    {
      for (i = 0; i < SystemSize; i++) yy2[i] = yy1[i] + z1[i];
      Gradient(yy2, u_pop2, u_ofs2, z1, u_popgrad1, u_ofsgrad1, bpoints);

      for (i = 0; i < SystemSize; i++) yy2[i] = yy1[i] + z2[i];
      Gradient(yy2, u_pop2, u_ofs2, z2, u_popgrad2, u_ofsgrad2, bpoints);
	
      for (i = 0; i < SystemSize; i++) yy2[i] = yy1[i] + z3[i];
      Gradient(yy2, u_pop2, u_ofs2, z3, u_popgrad3, u_ofsgrad3, bpoints);
      nfcn +=3;
      
      for (i = 0; i < SystemSize; i++)
	{
	  _hv1 = z1[i];
	  _hv2 = z2[i];
	  _hv3 = z3[i];
	  z1[i] = _ti11*_hv1 + _ti12*_hv2 + _ti13*_hv3;
	  z2[i] = _ti21*_hv1 + _ti22*_hv2 + _ti23*_hv3;
	  z3[i] = _ti31*_hv1 + _ti32*_hv2 + _ti33*_hv3;
	}
      /*
       * Here we have to solve the linear system
       */
      for (i = 0; i < SystemSize; i++)
	{
	  if (daes[i]) continue;
	  _hv1 = -f1[i];
	  _hv2 = -f2[i];
	  _hv3 = -f3[i];
	  z1[i] += _hv1*fac1;
	  z2[i] += _hv2*alphn - _hv3*betan;
	  z3[i] += _hv3*alphn + _hv2*betan;
	}
      
      sol(SystemSize,  E1, z1, ip1);
      solc(SystemSize, E2R, E2I, z2, z3, ip2);
      nsol++;

      /*
       * Compute deviations
       */
      for (i = 1, dyn = 0.0; i < SystemSize; i++)
	dyn += (z1[i]*z1[i] + z2[i]*z2[i] + z3[i]*z3[i])/(scal[i]*scal[i]);
      dyn = sqrt(dyn/(3*(SystemSize-1)));

      /*
       * Here handle bad convergence or too many recursion steps
       */
      if (newt)
	{
	  thq = dyn/dynold;
	  if (newt == 1) theta = thq;
	  else theta = sqrt(thq*thqold);
	  thqold = thq;
	  if (theta < 0.99)
	    {
	      faccon = theta/(1.0-theta);
	      dyth = faccon * dyn * pow(theta, NIT-2-newt) / fnewt;
	      if (dyth >= 1.0)
		{
		  qnewt = max(1.0E-4, min(20.0, dyth));
		  hhfac = 0.8 * pow(qnewt, -1.0/(4.0+NIT-2-newt));
		  return BAD_CONVERGENCE;
		}
	      /*
	       * If dyth < 1.0 continue with Newton iterations
	       */
	    }
	  else return NO_CONVERGENCE;
	}
      dynold = max(dyn, UROUND);
      for (i = 0; i < SystemSize; i++)
	{
	  _hv1 = f1[i] + z1[i];
	  _hv2 = f2[i] + z2[i];
	  _hv3 = f3[i] + z3[i];
	  f1[i] = _hv1;
	  f2[i] = _hv2;
	  f3[i] = _hv3;
	  z1[i] = _t11*_hv1 + _t12*_hv2 + _t13*_hv3;
	  z2[i] = _t21*_hv1 + _t22*_hv2 + _t23*_hv3;
	  z3[i] = _t31*_hv1 +      _hv2;
	}
      done = ((faccon * dyn) < fnewt);
    }

  if (done) return SUCCESS;
  else return MAX_ITERATIONS;
} /* rad_core */




/*==============================================================================*/

static double	radau5(double h)

{
  int		error;
  double	del_h;
  char		msg[128];
  
  del_h = h;
  while (1)
    {						/* Do an integration step   */
      if (!(error = rad_core(del_h, jac_new, dec_new))) return del_h;
      switch (error)
	{
	case BAD_CONVERGENCE:
	  strcpy(msg, "Bad convergence");
	  recur_no++; step_failed = 1;
	  del_h *= hhfac;
	  break;
	case SINGULARITY:
	  strcpy(msg, "Singular matrix");
	  nsing++;
	  recur_no++; step_failed = 1;
	  hhfac  = 0.1;
	  del_h *= hhfac;
	  if (nsing > 5)
	    {
#if (POPULATION_NR > 0)
	      TransBcohorts();
#endif // (POPULATION_NR > 0)
	      ErrorExit(0, SIN);
	    }
	  break;
	case NO_CONVERGENCE:
	  strcpy(msg, "No convergence");
	  recur_no++; step_failed = 1;
	  hhfac  = 0.1;
	  del_h *= hhfac;
	  break;
	case MAX_ITERATIONS:
	  strcpy(msg, "Max. iterations");
	  recur_no++; step_failed = 1;
	  hhfac  = 0.1;
	  del_h *= hhfac;
	  break;
	default:
	  break;
	}
      jac_new = !caljac;
      dec_new = 1;

      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil,
		  "%15s: T = %15.8f dt = %12.7E recurs = %2d\n",
		  msg, env[0], del_h, recur_no);
	  fflush(dbgfil);
	  fprintf(dbgfil, "Naccpt: %8d    Nrejct: %8d    Nfcn:  %8d    Njac: %8d\n",
		  naccpt, nrejct, nfcn, njac);
	  fprintf(dbgfil, "Ndec:   %8d    Nsol:   %8d    Nsing: %8d    Newt: %8d\n",
		  ndec, nsol, nsing, newt);
	  fflush(dbgfil);
	}
      if (recur_no > 25)
	{
#if (POPULATION_NR > 0)
	  TransBcohorts();
#endif // (POPULATION_NR > 0)
	  ErrorExit(0, REC);
	}
    }

  return del_h;
}




/*==============================================================================*/

static double	estrad(double h)

  /*
   * Routine estimates the local integration error
   */

{
  register int		i;
  double		_hv1, _hv2, _hv3;
  double		err = 0.0;
  
  _hv1 = _dd1/h;
  _hv2 = _dd2/h;
  _hv3 = _dd3/h;
  
  for (i = 0; i < SystemSize; i++)
    {
      f2[i]  = 0.0;
      if (!(daes[i]))
	f2[i]  = _hv1*z1[i] + _hv2*z2[i] + _hv3*z3[i];
      yy2[i] = f2[i] + z0[i];
    }
  sol(SystemSize, E1, yy2, ip1);
  
  for (i = 1, err = 0.0; i < SystemSize; i++)	/* Exclude the time here    */
    err += pow(yy2[i]/scal[i], 2.0);
  err = max(sqrt(err/(SystemSize-1)), MIN_ACCURACY);

  if ((err > 1.0) && (start_new || step_failed))
    {
      for (i = 0; i < SystemSize; i++) yy2[i] += yy1[i];
      Gradient(yy2, u_pop2, u_ofs2, f1, u_popgrad4, u_ofsgrad4, bpoints);
      nfcn++;
      for (i = 0; i < SystemSize; i++) yy2[i] = f1[i] + f2[i];
      sol(SystemSize, E1, yy2, ip1);

      for (i = 0, err = 0.0; i < SystemSize; i++)
	err += pow(yy2[i]/scal[i], 2.0);
      err = max(sqrt(err/SystemSize), MIN_ACCURACY);
    }

  return err;
}



/*==============================================================================*/
#if (EVENT_NR > 0)

static double 	delvalue(double theta, int eventindex)

{
  register int		i;
  double   		result[EVENT_NR];

  for (i = 0; i < SystemSize; i++)
    yy2[i] = yy1[i]
      +theta*(rcont1[i]+(theta-_c2m1)*(rcont2[i]+(theta-_c1m1)*rcont3[i]));

  for (i=0; i<EVENT_NR; i++) result[i] = NO_EVENT;
  EventLocation(yy2, u_pop2, u_ofs2, bpoints, result);
  
  return result[eventindex];
}




/*==============================================================================*/
#define ITMAX		500
#define EPS		1.0e-16

static double	zbrent(double olddel, double newdel, int eventindex)

{
  int			iter;
  double		a, b, c = 0.0, d = 0.0, e = 0.0, min1, min2;
  double		fa, fb, fc, p, q, r, s, tol1, xm;

  a = -1.0; fa=olddel;
  b =  0.0; fb=newdel;

  if (fb*fa > 0.0)
    {
      Warning(ZBB);
      return -1.0;
    }

  fc = fb;
  for (iter=0; iter<ITMAX; iter++)
    {
      if (fb*fc > 0.0)
	{
	  c = a; fc=fa;
	  e = d = b-a;
	}
      if (fabs(fc) < fabs(fb))
	{
	  a = b; fa = fb;
	  b = c; fb = fc;
	  c = a; fc = fa;
	}
      tol1 = 2.0*EPS*fabs(b)+0.5*identical_zero;
      xm = 0.5*(c-b);

      if ((fabs(xm) <= tol1 && fb*fc <=0.0) || fb == 0.0) return b;

      if (fabs(e) >= tol1 && fabs(fa) > fabs(fb))
	{
	  s = fb/fa;
	  if (a == c)
	    {
	      p=2.0*xm*s;
	      q=1.0-s;
	    }
	  else
	    {
	      q = fa/fc;
	      r = fb/fc;
	      p = s*(2.0*xm*q*(q-r)-(b-a)*(r-1.0));
	      q = (q-1.0)*(r-1.0)*(s-1.0);
	    }
	  if (p > 0.0) q = -q;
	  p = fabs(p);
	  min1 = 3.0*xm*q-fabs(tol1*q);
	  min2 = fabs(e*q);
	  if (2.0*p < (min1 < min2 ? min1 : min2))
	    {
	      e = d;
	      d = p/q;
	    }
	  else
	    {
	      d = xm;
	      e = d;
	    }
	}
      else
	{
	  d = xm;
	  e = d;
	}
      a = b; fa = fb;
      if (fabs(d) > tol1) b += d;
      else b += (xm > 0.0 ? fabs(tol1) : -fabs(tol1));
      fb = delvalue(b, eventindex);
    }
  Warning(ZBM);

  return -1.0;
}



#undef ITMAX
#undef EPS

/*===========================================================================*/

static void	LocateEvent(double prev_dt, int *doloc, int *located)

  /* 
   * LocateEvent - This routine is called to locate the events that are
   *		   triggered by the user-defined routine EventLocation()
   *	           It is assumed that on entrance to this routine, the array
   *		   doloc[] flags which events to locate, i.e. for which
   *		   event indicator oldELvalue[] and newELvalue[] have sound
		   values, i.e. both non-zero and their product negative.
   */

{
  register int		i;
  int			index = -1;
  double		new_dt, level;
  double		stepfrac[EVENT_NR], smallest = 2.0;

  for (i=0; i<EVENT_NR; i++)
    {
      located[i] = 0;
      if (doloc[i])
	{
	  stepfrac[i] = zbrent(oldELvalue[i], newELvalue[i], i);
	  if ((stepfrac[i] > 0.0) || (stepfrac[i] < -1.0))
	    {
	      if (EBTDEBUG(1))
		{
		  (void)fprintf(dbgfil, "Problem locating event %d at T = %15.8f",
				i, yy1[0]);
		  (void)fprintf(dbgfil,	"  Start = %12.7E", oldELvalue[i]);
		  (void)fprintf(dbgfil,	"  Stop = %12.7E", newELvalue[i]);
		  (void)fprintf(dbgfil,	"  dt old = %12.7E", prev_dt);
		  (void)fprintf(dbgfil,	"  dt new = %12.7E\n",
				(1.0+stepfrac[index])*prev_dt);
		  fflush(dbgfil);
		}
	    }
	  else if (stepfrac[i] < smallest)
	    {
	      smallest = stepfrac[i];
	      index = i;
	    }
	}
    }

  if (index < 0)
    {
      (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
      return;
    }
  
  new_dt = prev_dt*(1.0+stepfrac[index]);

  /*  radau5(new_dt);		Use the continuous output state to continue */

  for (i = 0; i < SystemSize; i++)
    yy1[i] +=
      stepfrac[index]*(rcont1[i]+
		       (stepfrac[index]-_c2m1)*(rcont2[i]+
						(stepfrac[index]-_c1m1)*rcont3[i]));
  located[index] = 1;
  LocatedEvent = index;

  for (i=0; i<EVENT_NR; i++) newELvalue[i] = NO_EVENT;
  EventLocation(yy1, u_pop1, u_ofs1, bpoints, newELvalue);

  equal2zero = max(identical_zero,
		   pow(10, ceil(log10(fabs(newELvalue[index]) + ABS_ERR))));

  cohort_end = ForceCohortEnd(yy1, u_pop1, u_ofs1, bpoints);

  if (EBTDEBUG(1))				/* Report performance if    */
    {						/* required by user         */
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "%-14s%3d: T = %15.8f     dt = %12.7E\n",
		  "Step to event", index, env[0], new_dt);
	  fflush(dbgfil);
	}
  
      if (EBTDEBUG(2) ||
	  (EBTDEBUG(1) && (fabs(newELvalue[index]) >= identical_zero)))
	{
	  if (cohort_end)
	    (void)fprintf(dbgfil, "%-18s T = %15.8f",
			  "Cohort closed:", yy1[0]);
	  else
	    (void)fprintf(dbgfil, "%-18s T = %15.8f",
			  "Event located:", yy1[0]);
	  (void)fprintf(dbgfil, "  Value = %12.7E", newELvalue[index]);
	  if (fabs(newELvalue[index]) >= identical_zero)
	    {
	      (void)fprintf(dbgfil, " ");
	      level = (ceil(log10(fabs(newELvalue[index])/identical_zero))-
		       identical_zero);
	      for (i=0; i<level; i++) (void)fprintf(dbgfil, "*");
	    }
	  (void)fprintf(dbgfil, "\n");
	  (void)fflush(dbgfil);
	}
    }

  return;
} /* LocateEvent */
#endif /* EVENT_NR > 0 */



/*==============================================================================*/

static void	  IntermediateState(double S)

  /* 
   * IntermediateState - Routine computes the state of the system at an
   *			 intermediate time point by interpolation. 
   *			 Values are stored in basic data copy for further use
   *			 in output routines.
   */
  
{
  register int		i;
  int			org, len;
  
  for (i = 0; i < SystemSize; i++)
    yy2[i] = yy1[i]
      +S*(rcont1[i]+(S-_c2m1)*(rcont2[i]+(S-_c1m1)*rcont3[i]));
  org = 0; len = ENVIRON_DIM;
  (void)memcpy((DEF_TYPE *)env, (DEF_TYPE *)(yy2+org),
	       len*sizeof(double));

#if (POPULATION_NR > 0)
  register int		j, k;

  for(i=0; i<POPULATION_NR; i++)
    {
      org += len;
      len  = (BpointNo[i]*COHORT_SIZE);
      (void)memcpy((DEF_TYPE *)ofs[i], (DEF_TYPE *)(yy2+org),
		   len*sizeof(double));
      for(j=0; j<BpointNo[i]; j++)
	{
	  if(ofs[i][j][number] > 0)
	    {
	      for(k=1; k<COHORT_SIZE; k++)
		ofs[i][j][k] /= ofs[i][j][number];
	    }
	  for(k=1; k<COHORT_SIZE; k++)
	    ofs[i][j][k] += bpoints[i][j][k];
	}
    }

  for(i=0; i<POPULATION_NR; i++)
    {
      org += len;
      len  = (CohortNo[i]*COHORT_SIZE);
      (void)memcpy((DEF_TYPE *)pop[i], (DEF_TYPE *)(yy2+org),
		   len*sizeof(double));
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==============================================================================*/

double	  IntegrationStep(double del_tim, double del_max, int recurs)

  /* 
   * IntegrationStep - Performs an integration with adaptable step size but 
   *                   maximum "del_max". Step size control and event
   *                   location as implemented by <NAME> & <NAME>.
   */
  
{
  register int		i;
  double		del_h;
  double		err;
  double		fac, quot, facgus, hnew;
  double		_hv1, _hv2;
  int			org, len, adjust = 1, intermediate = 0;
#if (EVENT_NR > 0)
  int			dolocation[EVENT_NR], events = 0;
#endif
 
  del_h = del_tim;				/* Adjust stepsize to hit   */
  if(del_max < (2*del_tim))			/* cohort end, look ahead   */
    {						/* two steps to avoid too   */
      del_h = 0.5*del_max;			/* drastic step changes	    */
      if(del_max < del_tim) del_h = del_max;
      adjust = 0;
    }
  if(del_h < SMALLEST_STEP)
    {
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      ErrorExit(0, SSS);
    }
  recur_no = recurs;
  LocatedEvent = -1;

  if (EBTDEBUG(4))
    {
      fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
	      "Starting step:", env[0], del_h, recurs);
      fflush(dbgfil);
    }

#if RADAU_TEST
  _hv1 = 0.1*pow(accuracy, 2.0/3.0);
  for (i = 0; i < SystemSize; i++)
    scal[i] = _hv1 + _hv1 * fabs(y[i]);
#else
  for (i = 0; i < SystemSize; i++)
    scal[i] = ABS_ERR + accuracy * fabs(y[i]);
#endif

  del_h = radau5(del_h);			/* integration step         */
  err = estrad(del_h);				/* error estimation         */

  if (err > 1.0)				/* Step rejected            */
    {
      nrejct++;
      if (EBTDEBUG(3))
	{
	  fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
		  "Step failed:", env[0], del_h, recur_no);
	  fflush(dbgfil);
	}

      /*
       * If bigger than accuracy take smaller step and restart
       */
      recur_no++; step_failed=1;
      if (recur_no > 25)
	{
#if (POPULATION_NR > 0)
	  TransBcohorts();
#endif // (POPULATION_NR > 0)
	  ErrorExit(0, REC);
	}

      fac  = min(SAFE, SAFE*(2*NIT+1)/(2*NIT+newt));
      quot = max(FACR, min(FACL, pow (err, 0.25)/fac));
      hnew = del_h/quot;
      if (start_new) hhfac  = 0.1;
      else hhfac = hnew/del_h;
      del_h *= hhfac;
      jac_new = !caljac;
	
      step_size = del_h;
      del_h  = IntegrationStep(del_h, del_max, recur_no);
    }
  else						/* Step accepted            */
    {
      naccpt++;
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
		  "Step OK:", env[0], del_h, recur_no);
	  fprintf(dbgfil, "Naccpt: %8d    Nrejct: %8d    Nfcn:  %8d    Njac: %8d\n",
		  naccpt, nrejct, nfcn, njac);
	  fprintf(dbgfil, "Ndec:   %8d    Nsol:   %8d    Nsing: %8d    Newt: %8d\n",
		  ndec, nsol, nsing, newt);
	  fflush(dbgfil);
	}

      /*
       * Step size adjustment using Gustafsson controller, if not first cycle
       * step. No increase if failed just before 
       */
      fac   = min(SAFE, SAFE*(2*NIT+1)/(2*NIT+newt));
      quot  = max(FACR, min(FACL, pow (err, 0.25)/fac));
      hnew  = del_h/quot;
      dtold = del_h;
      if (!start_new)
	{
	  facgus = (hacc/del_h)*pow(err*err/erracc, 0.25)/SAFE;
	  facgus = max(FACR, min(FACL, facgus));
	  quot   = max(quot, facgus);
	  hnew   = del_h/quot;
	}
      hacc   = del_h;
      erracc = max(0.01, err);

      hnew = min(hnew, cohort_limit);
      hnew = min(hnew, LARGEST_STEP);
      if (step_failed) hnew = min(hnew, del_h);
      
      quot = hnew/del_h;
      if ((theta <= THET) && (quot >= QUOT1) && (quot <= QUOT2))
	{
	  jac_new   = 0;
	  dec_new   = 0;
	  step_size = del_h;
	}
      else
	{
	  jac_new   = (theta > THET);
	  dec_new   = 1;
	  if (adjust) step_size = hnew;
	}
      start_new   = 0;
      step_failed = 0;
      caljac      = 0;

      /*
       * Update variables for next step, the basic data copy, and the local
       * copy 
       */
      for (i = 0; i < SystemSize; i++)
	{
	  yy1[i] += z3[i];
	  _hv1 = (z1[i] - z2[i])/_c1mc2;
	  _hv2 = z1[i]/_c1;
	  _hv2 = (_hv1-_hv2)/_c2;
	  rcont1[i] = (z2[i] - z3[i])/_c2m1;
	  rcont2[i] = (_hv1-rcont1[i])/_c1m1;
	  rcont3[i] = rcont2[i]-_hv2;
	}

      /* 
       * Location of events: If located in previous and no change in ELvalue do
       * not locate.
       * WARNING: The order of these statements seems odd but is OK! What is
       * 	  checked is whether the newELvalue from before cohort closure
       *	  equals the value computed at the beginning of this time
       *	  integration step!
       */
#if (EVENT_NR > 0)
      for(i=0; i<EVENT_NR; i++)
	{
	  dolocation[i] = 1;
	  if (located[i] && isequal(oldELvalue[i], newELvalue[i]))
	    dolocation[i] = 0;
	}
      
      for (i=0; i<EVENT_NR; i++) newELvalue[i] = NO_EVENT;
      EventLocation(yy1, u_pop1, u_ofs1, bpoints, newELvalue);

      for(i=0, events=0; i<EVENT_NR; i++)
	{
	  if (((oldELvalue[i] < 0.0) && (newELvalue[i] < 0.0)) ||
	      ((oldELvalue[i] > 0.0) && (newELvalue[i] > 0.0)))
	    dolocation[i] = 0;
	  if (dolocation[i]) events++;
	}
      if (events) LocateEvent(del_h, dolocation, located);
      else for(i=0; i<EVENT_NR; i++) located[i] = 0;
#endif

      intermediate = ((next_output < (yy1[0]-identical_zero)) ||
		      ((state_out > 0.0) &&
		       (next_state_output < (yy1[0]-identical_zero))));

      if (intermediate)
	{
	  /*
	   * Produce intermediate output and state output if requested
	   */
#if (POPULATION_NR > 0)
	  for(i=0; i<POPULATION_NR; i++) CohortNo[i] += BpointNo[i];
#endif // (POPULATION_NR > 0)
	  while (next_output < (yy1[0]-identical_zero))
	    {
	      IntermediateState((next_output-yy1[0])/del_h);
#if (RADAU_TEST)
	      fprintf(stderr, "X =%5.2f    Y =%18.9E%18.9E    NSTEP =%4d\n",
		      yy2[0], yy2[1], yy2[2], naccpt);
#endif	  
	      FileOut();
	      next_output += delt_out;
	    }
      
#if (POPULATION_NR > 0)
	  while ((state_out > 0.0) && (next_state_output < (yy1[0]-identical_zero)))
	    {
	      IntermediateState((next_state_output-yy1[0])/del_h);
	      FileState();
	      next_state_output += state_out;
	    }
	  for(i=0; i<POPULATION_NR; i++) CohortNo[i] -= BpointNo[i];
	  for(i=0; i<POPULATION_NR; i++) cohort_no[i] = CohortNo[i];
#endif // (POPULATION_NR > 0)
	}
      
      /*
       * Update the basic data copy, and the local copy 
       */
      org = 0; len = ENVIRON_DIM;
      (void)memcpy((DEF_TYPE *)env, (DEF_TYPE *)(yy1+org), len*sizeof(double));

#if (POPULATION_NR > 0)
      for(i=0; i<POPULATION_NR; i++)
	{
	  org += len;
	  len  = (BpointNo[i]*COHORT_SIZE);
	  (void)memcpy((DEF_TYPE *)ofs[i], (DEF_TYPE *)(yy1+org),
		       len*sizeof(double));
	}

      for(i=0; i<POPULATION_NR; i++)
	{
	  org += len;
	  len  = (CohortNo[i]*COHORT_SIZE);
	  (void)memcpy((DEF_TYPE *)pop[i], (DEF_TYPE *)(yy1+org),
		       len*sizeof(double));
	}
#endif // (POPULATION_NR > 0)

      (void)memcpy((DEF_TYPE *)y, (DEF_TYPE *)yy1, SystemSize*sizeof(double));
    }

  return del_h;
}




/*==============================================================================*/







<|start_filename|>docs/first_vars.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>
    First steps
  </TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <META 
    NAME ="keywords" CONTENT="Octave Matlab" >
  
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>Variables</H1>

Create a variable by assigning a value to it using symbol <code>=</code>. 
Show the value on screen by typing its name, or suppressing the character <code>;</code>. 
Elementary <b>operators</b> are <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>,
<code>^</code>. Try:<br> 

<code>
x = 2; % value is not shown because of ;<br> 
x % show value of x<br> 
y = 3 % assign and show value of y<br> 
x+y % show result of addition<br> 
y = "text string" % fill a variable with text
</code>

<P>
A scalar is an object that has the value of a number.
The power of Octave is the easy of working with a <b>matrix</b> (a 2-dimensional array with numbers) or a higher-dimensional array;
a <b>vector</b> is a special matrix with only one row or column.
Create a matrix with <code>[numbers-separated by ',' and/or ' ']</code>, the character <code>;</code> indicates a new row. 
Get an <b>element</b> of a matrix by bracketing the <b>indices</b> with <code>(,)</code> and a full row with <code>(,:)</code>. 
The command <code>[]</code> creates the empty matrix. Try:<br>

<code>
x = [2 5 3;1 6 4] % create a (2,3)-matrix<br> 
x(2,2) % show element with index 2,2<br> 
x(1,:) % show first row<br> 
[x,[1;3]] % catenate an extra column to x<br> 
[x;[1 3 5]] % catenate an extra row to x<br>
x(:,2) = [] % delete column 2<br>
x(1,1) = 3 % change element (1,1) into 3<br>
y = ['example'; 'trial'] % spaces are added automatically
</code>

<P>
Obtain the <b>size</b> of an existing matrix with <code>size</code> 
in two ways:<br>

<code>
nx = size(x) % the variable nx is now a (1,2)-matrix<br>
[r,c] = size(x) % the variables r and c are both (1,1)-matrices<br>
r = size(x,1) % the variable r is a (1,1)-matrix<br>
c = size(x,2) % the variables c is a (1,1)-matrix<br>
</code>

<p>
The elements of a vector can be assessed by using 1 or 2 indices. 
The number of elements can be obtained with <code>length</code>. 
Create <b>special vectors</b> with<br>

<code>
x = 0:5 % this creates a row-matrix from 0 to 5<br>
x(4) % show element with index 4<br>
x(1,4) % another way to show that element<br>
x([4 2 1]) % show elements with indices 4 2 and 1<br>
x = 0:0.5:3 % row-matrix from 0 to 3 with steps size 0.5<br>
length(x) % show the number of elements<br>
x = linspace(3,4,6) % row-matrix from 3 to 4 with 6 steps<br>
</code>

<p>
<b>Special matrices</b> are those with zeros, ones, and the unit matrix:<br>

<code>
x = zeros(3) % create and show a (3,3)-matrix withs zeros<br>
3+zeros(2,4) % show the result of a scalar addition to a (2,4)-matrix<br>
y = 5*ones(3,2) % create and show a (3,2)-matrix with ones and multiply with 5<br>
[x,y;y,x] % show a (5,5)-matrix composed from modules<br>
eye(4) % show a unit matrix of size (4,4)<br>
</code><br>

Extract the <b>diagonal elements</b> with <code>diag</code>:

<code><br>
diag(eye(3)) % show the diagonal elements of a (3,3)-unit matrix<br>
</code><br>

<b>Reshape</b> or <b>unravel</b> a matrix with:<br>

<code>
x = [1 3 2; 5 8 6]; % create a (2,3)-matrix<br>
reshape(x,3,2) % use its elements in a (3,2)-matrix<br>
x(:) % create a column-matrix using its elements
</code>

<p>
Products, divisions and powers are defined as matrix operators; 
the product of matrices A and B is a new matrix C with elements c<sub>i,j</sub> such that c<sub>i,j</sub> = &Sigma;<sub>k</sub> a<sub>i,k</sub> b<sub>k,j</sub>. 
The number of columns in A must, therefore, equal the number of rows in B. 
<b>Direct products</b> (c<sub>i,j</sub> = a<sub>i,j</sub> b<sub>i,j</sub>) have an extra dot.
The <b>inverse</b> of a matrix is obtained with <code>inv</code>; 
this is matrix such that multiplication with the matrix results in the unit-matrix.<br>

<code>
a = [3 5;3 1]; % create a (2,2)-matrix<br> 
b = inv(a); % calculate its inverse<br>
a*b % matrix product<br>
a.*b % direct product<br>
a^2 % matrix power<br>
a.^2 % direct power<br>
</code>

<p>
<b>Transpose</b> (i.e. interchange rows and colums) with <code>'</code>:<br>

<code>
a = [1;5;6]; b = [2 3 0]'; % create two column-matrices<br>
a'*b % inner product, which is a (1,1)-matrix<br>
a*b' % outer product, which is a (3,3)-matrix<br>
</code>

<p>
Frequently used operators are <code>max, min, sum, prod, sort</code>, linear systems are solved with operator <code>\</code>
(see Octave's manual). 
Constants with a known value are <code>e, pi</code> (which can be overwritten). 
Well-known functions are <code>sin, log, exp</code>. 
Conversions from characters to numbers and <i>vice versa</i> are done with <code>num2str, str2num</code>. 
Some examples:<br>

<code>
a = [1 3 5; 2 4 3]; % assign a (2,3)-matrix to a variable<br>
sum(a) % sum across dimension 1, which is the rows; also: sum(a,1)<br>
sum(a,2) % sum across dimension 2, which is the columns<br>
prod(a) % multiply across dimension 1<br>
max(a,4) % take the maximum of each element of a and 4<br>
[am,ind] = max(a) % assign maximum element of <code>a</code> across rows for each column and the row indices for which the maxima are reached
</code>

<p>
<b>Long lines</b> are cut like<br>

<code>
x = 2.1/ (4^2 + 3 * log(2)) + ... % calculate using 2 lines of text<br>
     exp(-7) * pi<br>
</code><br>

If closing brackets are missing, Octave catenates new lines automatically.
 
<p>
<b>Erase variables</b> variable <code>x</code> with <CODE>clearx</CODE>, erase all variables with <CODE>clear</CODE>.

</BODY>
</HTML>


<|start_filename|>docs/first_plot.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>
    First steps
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="Octave Matlab" >
  
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>Plotting</H1>

<b>Plots</b> are produced as follows:</br>
<code><br>
x = linspace(0,10,40); % create vector of values of independent variable<br>
y = x + 0.1*x.^2; % obtain vector with corresponding dependent variable<br>
plot(x,y,'g'); # plot y against x, connecting points in green<br>
xlabel('independent variable'); % set text along x-axis<br>
ylabel('dependent variable'); % set text along y-axis<br>
</code>

<P>
Set x-range to (0,10) and y-range to (1,2) with <code>axis([0 10], [1 2])</code>. 
Reset range specifications with <code>axis</code>.
<b>Close</b> plots with <code>clf</code> or
<code>close</code>. 

Create <b>multiple plots</b> like:</br>
<code><br>
z = 1./y; % create second dependent variable<br>
clf % clear previous plot<br>
subplot(1,2,1); % first subplot in 1 row, 2 colums<br>
xlabel('independent variable'); % set text along x-axis<br>
ylabel('dependent variable 1'); % set text along y-axis<br>
plot(x,y,'g'); % plot in green<br><br>
subplot(1,2,2); % second  subplot in 1 row, 2 colums<br>
xlabel('independent variable'); % set text along x-axis<br>
ylabel('dependent variable 2'); % set text along y-axis<br>
plot(x,z,'r'); % plot in red<br><br>
</code>

<P> 
<b>Combine</b> both curves in a single plot with<br>
<code><br>
clf % clear previous plot; suppress legends<br>
xlabel('independent variable');<br>
ylabel('dependent variables');<br>
plot(x,y,'g',x,z,'r'); % plot y against x in green and z gainst x in red<br>
</code>

<P>
Alternatively, add more to an existing plot with <code> hold on;</code>.<br>
<code><br>
clf; hold on; plot(x,y,'g'); plot(x,y,'.r'); # curve in green, dots in red
</code>

<P>
<b>Write</b> plot to encapsulated postscript file <code>nm.eps</code> with<br>
<code><br>
  print -deps nm.eps<br>
</code><br>

</BODY>
</HTML>


<|start_filename|>lib/regr/html/mydata_surv2.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_surv2</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-20"><meta name="DC.source" content="mydata_surv2.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">set initial parameter estimates</a></li><li><a href="#3">example of function definition: expony</a></li><li><a href="#4">show a plot of the function:</a></li><li><a href="#5">estimate the parameter values:</a></li><li><a href="#6">show goodness of fit:</a></li><li><a href="#7">get deviance:</a></li><li><a href="#8">obtain parameter statistics:</a></li></ul></div><pre class="codeinput"><span class="comment">% created: 2001/09/13 by <NAME>; modified 2006/05/26</span>
<span class="comment">% sample data for surv2 routines</span>
</pre><h2>set initial parameter estimates<a name="2"></a></h2><pre>(do this first to make this file a script file)</pre><pre class="codeinput">par = [0.3 1]';
</pre><h2>example of function definition: expony<a name="3"></a></h2><h2>show a plot of the function:<a name="4"></a></h2><pre class="language-matlab">shsurv(<span class="string">'expony'</span>, par, [0 3]', [0 5]')
</pre><pre class="codeinput">t = [0 1 2 3 4]';
y = [0.5 1 2]';
surv = [10 10 9 8 8; 10 7 5 4 3; 10 4 1 0 0;]';
</pre><h2>estimate the parameter values:<a name="5"></a></h2><pre class="codeinput">par = scsurv2(<span class="string">'expony'</span>, par, t, y, surv) <span class="comment">%% using scores</span>
<span class="comment">% or alternatively for a genetic algorithm:</span>
<span class="comment">% first adjust parameter values</span>
<span class="comment">% value (not used), iteration (yes), range: (1e-6,1) &amp; (1e-6,5)</span>
par = [.3 1 1e-6 1; 1 1 1e-6 5];
gasurv2(<span class="string">'expony'</span>, par, t, y, surv) <span class="comment">%% using a genetic algorithm</span>
<span class="comment">% or alternatively:</span>
par = nmsurv2(<span class="string">'expony'</span>, par, t, y, surv) <span class="comment">%% using Nelder-Mead</span>
</pre><pre class="codeoutput">step 1 norm 44.5621 dev 9.77
step 2 norm 6.6516 dev 4.4837
step 3 norm 0.00017984 dev 4.304
step 4 norm 1.0911e-05 dev 4.3039
step 5 norm 9.4843e-09 dev 4.3039

par =

    0.2770
    2.0511


1 4.303932
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 
 no convergence within 50 generations 

50 4.303932

ans =

    0.2770    1.0000    0.0000    1.0000
    2.0511    1.0000    0.0000    5.0000

step 1 dev 9.2496-9.77 initial
step 2 dev 8.9203-9.6946 expand
step 3 dev 7.9271-9.2496 expand
step 4 dev 7.1165-8.9203 expand
step 5 dev 5.3954-7.9271 expand
step 6 dev 5.3954-7.1165 reflect
step 7 dev 4.8735-5.457 reflect
step 8 dev 4.4012-5.3954 expand
step 9 dev 4.4012-4.8735 contract outside
step 10 dev 4.3757-4.4801 contract outside
step 11 dev 4.3114-4.4012 contract inside
step 12 dev 4.3114-4.3757 contract inside
step 13 dev 4.3114-4.335 contract outside
step 14 dev 4.3084-4.3147 contract inside
step 15 dev 4.3075-4.3114 reflect
step 16 dev 4.3047-4.3084 contract inside
step 17 dev 4.3045-4.3075 contract inside
step 18 dev 4.3045-4.3047 contract outside
step 19 dev 4.3041-4.3047 contract inside
step 20 dev 4.304-4.3045 contract inside
step 21 dev 4.304-4.3041 contract inside
step 22 dev 4.304-4.304 reflect
step 23 dev 4.3039-4.304 contract inside
step 24 dev 4.3039-4.304 contract inside
step 25 dev 4.3039-4.3039 contract outside
step 26 dev 4.3039-4.3039 contract inside
step 27 dev 4.3039-4.3039 contract inside
step 28 dev 4.3039-4.3039 contract inside
step 29 dev 4.3039-4.3039 reflect
step 30 dev 4.3039-4.3039 contract inside
step 31 dev 4.3039-4.3039 contract inside
step 32 dev 4.3039-4.3039 contract inside
step 33 dev 4.3039-4.3039 contract inside
step 34 dev 4.3039-4.3039 contract outside
step 35 dev 4.3039-4.3039 contract inside
step 36 dev 4.3039-4.3039 contract inside
step 37 dev 4.3039-4.3039 contract outside
Successful convergence 

par =

    0.2770    1.0000    0.0000    1.0000
    2.0511    1.0000    0.0000    5.0000

</pre><h2>show goodness of fit:<a name="6"></a></h2><pre class="language-matlab">shsurv2(<span class="string">'expony'</span>, par, t, y, surv)
</pre><h2>get deviance:<a name="7"></a></h2><pre class="language-matlab">dev2(<span class="string">'expony'</span>, par, t, y, surv)
</pre><h2>obtain parameter statistics:<a name="8"></a></h2><pre class="language-matlab">[cov, cor, sd, d] = psurv2(<span class="string">'expony'</span>, par, t, y, surv)
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
% created: 2001/09/13 by <NAME>; modified 2006/05/26
% sample data for surv2 routines

%% set initial parameter estimates
%  (do this first to make this file a script file)
par = [0.3 1]';

%% example of function definition: expony

%% show a plot of the function:
%   shsurv('expony', par, [0 3]', [0 5]')

t = [0 1 2 3 4]';
y = [0.5 1 2]';
surv = [10 10 9 8 8; 10 7 5 4 3; 10 4 1 0 0;]';

%% estimate the parameter values:
par = scsurv2('expony', par, t, y, surv) %% using scores
% or alternatively for a genetic algorithm:
% first adjust parameter values
% value (not used), iteration (yes), range: (1e-6,1) & (1e-6,5)
par = [.3 1 1e-6 1; 1 1 1e-6 5];
gasurv2('expony', par, t, y, surv) %% using a genetic algorithm
% or alternatively:
par = nmsurv2('expony', par, t, y, surv) %% using Nelder-Mead

%% show goodness of fit:
%   shsurv2('expony', par, t, y, surv)

%% get deviance:
%   dev2('expony', par, t, y, surv)

%% obtain parameter statistics:
%   [cov, cor, sd, d] = psurv2('expony', par, t, y, surv)

##### SOURCE END #####
--></body></html>

<|start_filename|>alga/html/cnplim.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>cnplim</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2016-03-17"><meta name="DC.source" content="cnplim.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>cnplim</h1><!--introduction--><p>simultaneous C, N, P limitation in a batch-culture</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#3">Syntax</a></li><li><a href="#4">Description</a></li><li><a href="#5">Remarks</a></li></ul></div><h2>Syntax<a name="3"></a></h2><p>f = <a href="../cnplim.m"><b>cnplim</b></a> (p, t, NP)</p><h2>Description<a name="4"></a></h2><p>Simultaneous C, N, P limitation in a batch-culture     C is consumed as CO2 only, while CO2 exchanges with HCO3     maintenance costs are assummed to be negligibly small.</p><p>Input:</p><div><ul><li>p: parameter vector:</li></ul></div><pre>   p(1)=K_C; mM, saturation constant for CO2 (C)
   p(2)=K_N; mM, saturation constant for nitrate (N)
   p(3)=K_P; mM, saturation constant for phosphate (P)
   p(4)=j_Cm; mM/(mol*h), max spec CO2 uptake rate
   p(5)=j_Nm; mM/(mol*h), max spec N
   p(6)=j_Pm; mM/(mol*h), max spec P
   p(7)=k_E; 1/h, reserve turnover rate
   p(8)= kap_C; -, recovery fraction for rejected C-reserves
   p(9)= kap_N; -, recovery fraction for rejected N-reserves
   p(10)=kap_P; -, recovery fraction for rejected P-reserves
   p(11)=yC_EV; mol/mol, yield for C-reserve on structure
   p(12)=yN_EV; mol/mol, yield for N-reserve on structure
   p(13)=yP_EV; mol/mol, yield for P-reserve on structure
   p(14)=k_BC; 1/h, transformation from B (bicarbonate) to C
   p(15)=k_CB; 1/h, transformation from C (CO2) to B
   p(16)=B_0; mM, initial bicarbonate concentration
   p(17)=C_0; mM, initial CO2 concentration
   p(18)=m_C0; mol/mol, initial C-reserve density
   p(19)=m_N0; mol/mol, initial N-reserve density
   p(20)=m_P0; mol/mol, initial P-reserve density
   p(21)=Biomm0; mM, initial structure concentration</pre><div><ul><li>t: (nt)-vector with time</li><li>NP: (NP,2)-matrix with initial nitrate, phosphate concentrations</li></ul></div><p>Output:</p><p>% f: biomass</p><h2>Remarks<a name="5"></a></h2><p>Calls for dcnplim; see mydata_cnplim for an application. Apply this function with nmregr2 for parameter estimation,     or pregr2 for parameter statistics, or shregr2 for plotting</p><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% cnplim
% simultaneous C, N, P limitation in a batch-culture

%%
function f = cnplim(p, t, NP)
  %  created 2002/02/11 by <NAME>
  
  %% Syntax
  % f = <../cnplim.m *cnplim*> (p, t, NP)

  %% Description
  % Simultaneous C, N, P limitation in a batch-culture
  %     C is consumed as CO2 only, while CO2 exchanges with HCO3
  %     maintenance costs are assummed to be negligibly small.
  %
  % Input:
  %
  % * p: parameter vector:
  %
  %     p(1)=K_C; mM, saturation constant for CO2 (C)
  %     p(2)=K_N; mM, saturation constant for nitrate (N)
  %     p(3)=K_P; mM, saturation constant for phosphate (P)
  %     p(4)=j_Cm; mM/(mol*h), max spec CO2 uptake rate
  %     p(5)=j_Nm; mM/(mol*h), max spec N 
  %     p(6)=j_Pm; mM/(mol*h), max spec P
  %     p(7)=k_E; 1/h, reserve turnover rate
  %     p(8)= kap_C; -, recovery fraction for rejected C-reserves
  %     p(9)= kap_N; -, recovery fraction for rejected N-reserves
  %     p(10)=kap_P; -, recovery fraction for rejected P-reserves
  %     p(11)=yC_EV; mol/mol, yield for C-reserve on structure
  %     p(12)=yN_EV; mol/mol, yield for N-reserve on structure
  %     p(13)=yP_EV; mol/mol, yield for P-reserve on structure
  %     p(14)=k_BC; 1/h, transformation from B (bicarbonate) to C
  %     p(15)=k_CB; 1/h, transformation from C (CO2) to B
  %     p(16)=B_0; mM, initial bicarbonate concentration
  %     p(17)=C_0; mM, initial CO2 concentration
  %     p(18)=m_C0; mol/mol, initial C-reserve density
  %     p(19)=m_N0; mol/mol, initial N-reserve density
  %     p(20)=m_P0; mol/mol, initial P-reserve density
  %     p(21)=Biomm0; mM, initial structure concentration
  %
  % * t: (nt)-vector with time
  % * NP: (NP,2)-matrix with initial nitrate, phosphate concentrations
  %
  % Output:
  %
  % % f: biomass
  
  %% Remarks
  % Calls for dcnplim; see mydata_cnplim for an application.
  % Apply this function with nmregr2 for parameter estimation,
  %     or pregr2 for parameter statistics, or shregr2 for plotting

  %  State vector:
  %  Xt: C = Xt(1);  N = Xt(2);  P = Xt(3); m_C = Xt(4); m_N = Xt(5);
  %      m_P = Xt(6); X = Xt(7); B = Xt(8);

  global K_C K_N K_P j_Cm j_Nm j_Pm k_E yC_EV yN_EV yP_EV k_BC k_CB
  global kap_C kap_N kap_P
 
  % global B C N P m_C m_N m_P X B r;

  % unpack p
  K_C = p(1); K_N = p(2); K_P = p(3); j_Cm = p(4); j_Nm = p(5); j_Pm = p(6);
  k_E = p(7); kap_C = p(8); kap_N = p(9); kap_P = p(10);
  yC_EV = p(11); yN_EV = p(12); yP_EV = p(13); k_BC = p(14); k_CB = p(15);
  B_0 = p(16); C_0 = p(17); m_C0 = p(18); m_N0 = p(19); m_P0 = p(20); Biomm0 = p(21);
  
  m_C0 = j_Cm/k_E; m_N0 = j_Nm/k_E; m_P0 = j_Pm/k_E;

  [nNP k] = size(NP);
  
  for i = 1:nNP
    Xt0 = [B_0 C_0 NP(i,1) NP(i,2) m_C0 m_N0 m_P0 Biomm0];
    Xt = ode23s ('dcnplim', t, Xt0);
    f(:,i)=Xt(:,8);
  end
##### SOURCE END #####
--></body></html>

<|start_filename|>animal/html/powers.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>powers</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="powers.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Descxription</a></li><li><a href="#4">Input</a></li><li><a href="#5">Output</a></li><li><a href="#6">Example of use</a></li><li><a href="#7">Code</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [p, e_l, p_C] = powers (l, f)
</pre><pre class="codeinput">  <span class="comment">%  created 2000/09/07 by <NAME>, modified 2009/09/29</span>
  <span class="comment">%</span>
</pre><h2>Descxription<a name="3"></a></h2><pre>calculates the basic powers (assimilation, dissipation, growth)
  and scaled res-dens and cat, cat + som maint powers</pre><h2>Input<a name="4"></a></h2><pre>l: (column or row) vector of scaled lengths
f: scaled functional response (scalar)</pre><h2>Output<a name="5"></a></h2><pre>p: matrix of powers for each scaled length (3 columns); page 123</pre><h2>Example of use<a name="6"></a></h2><pre>see shpower</pre><h2>Code<a name="7"></a></h2><pre class="codeinput">  <span class="keyword">global</span> l_b l_p l_h g kap kap_R p_ref;

  nl=size(l(:)); <span class="comment">% nl = number of scaled lengths</span>
  p =zeros(nl,8);     <span class="comment">% initiate matrix of scaled powers</span>
  e_l =f.*ones(nl,1); <span class="comment">% initiate vector of scaled reserve densities</span>

  <span class="keyword">for</span> i= 1:nl

    <span class="keyword">if</span> l(i)&lt;l_b
      [lf, el3] = ode23(<span class="string">'fnel3'</span>,[1e-6,l(i)], el3_init(f,g,l_b));
      e_l(i) = el3(end)/l(i)^3;
      a=l(i)^2*(e_l(i)-l(i))/(1+e_l(i)/g);
      p(i,:)= [0, e_l(i)*l(i)^2*(g+l(i))/(g+e_l(i)), kap*l(i)^3, <span class="keyword">...</span>
	     (1-kap)*l(i)^3, 0, kap*a, (1-kap)*a, 0];
    <span class="keyword">elseif</span> l(i)&lt;l_p <span class="comment">% e_l(i) = f</span>
      p_G = kap*l(i)^2*(f-l(i)-l_h)/(1+f/g);
      p_R = (1-kap)*l(i)^2*(f-l(i)+l_h*f/g)/(1+f/g);
      p(i,:)= [f*l(i)^2, f*l(i)^2*(g+l(i)+l_h)/(g+f), kap*l(i)^3, <span class="keyword">...</span>
	  (1-kap)*l(i)^3, kap*l_h*l(i)^2, p_G, p_R, 0];
    <span class="keyword">else</span> <span class="comment">% e_l(i) = f</span>
      p_G = kap*l(i)^2*(f-l(i)-l_h)/(1+f/g);
      p_R = (1-kap)*(l(i)^2*(f-l(i)+l_h*f/g)/(1+f/g)+l(i)^3-l_p^3);
      p(i,:)= [f*l(i)^2, f*l(i)^2*(g+l(i)+l_h)/(g+f), kap*l(i)^3, <span class="keyword">...</span>
	     (1-kap)*l_p^3, kap*l_h*l(i)^2, p_G, 0, p_R];
    <span class="keyword">end</span>
  <span class="keyword">end</span>

  p=p*p_ref; <span class="comment">% reference power p_ref= mu_E * M_Em * kT_M * g</span>
  <span class="comment">% p has 8 powers (in colums) for each length, see DEB-book p123</span>
  p_C = [p(:,2), p(:,3) + p(:,6)]; <span class="comment">% catabolic, som maint + growth power</span>
  p =[p(:,1), p(:,3)+p(:,4)+p(:,5)+(1-kap_R)*p(:,8), p(:,6)];
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [p, e_l, p_C] = powers (l, f)
  %  created 2000/09/07 by <NAME>, modified 2009/09/29
  %
  %% Descxription
  %  calculates the basic powers (assimilation, dissipation, growth)
  %    and scaled res-dens and cat, cat + som maint powers 
  %
  %% Input
  %  l: (column or row) vector of scaled lengths
  %  f: scaled functional response (scalar)
  %
  %% Output
  %  p: matrix of powers for each scaled length (3 columns); page 123
  %
  %% Example of use
  %  see shpower
  
  %% Code
  global l_b l_p l_h g kap kap_R p_ref;

  nl=size(l(:)); % nl = number of scaled lengths
  p =zeros(nl,8);     % initiate matrix of scaled powers
  e_l =f.*ones(nl,1); % initiate vector of scaled reserve densities

  for i= 1:nl
   
    if l(i)<l_b
      [lf, el3] = ode23('fnel3',[1e-6,l(i)], el3_init(f,g,l_b));
      e_l(i) = el3(end)/l(i)^3;
      a=l(i)^2*(e_l(i)-l(i))/(1+e_l(i)/g);
      p(i,:)= [0, e_l(i)*l(i)^2*(g+l(i))/(g+e_l(i)), kap*l(i)^3, ...
	     (1-kap)*l(i)^3, 0, kap*a, (1-kap)*a, 0];
    elseif l(i)<l_p % e_l(i) = f
      p_G = kap*l(i)^2*(f-l(i)-l_h)/(1+f/g);
      p_R = (1-kap)*l(i)^2*(f-l(i)+l_h*f/g)/(1+f/g);
      p(i,:)= [f*l(i)^2, f*l(i)^2*(g+l(i)+l_h)/(g+f), kap*l(i)^3, ...
	  (1-kap)*l(i)^3, kap*l_h*l(i)^2, p_G, p_R, 0];
    else % e_l(i) = f
      p_G = kap*l(i)^2*(f-l(i)-l_h)/(1+f/g);
      p_R = (1-kap)*(l(i)^2*(f-l(i)+l_h*f/g)/(1+f/g)+l(i)^3-l_p^3);
      p(i,:)= [f*l(i)^2, f*l(i)^2*(g+l(i)+l_h)/(g+f), kap*l(i)^3, ...
	     (1-kap)*l_p^3, kap*l_h*l(i)^2, p_G, 0, p_R];
    end
  end

  p=p*p_ref; % reference power p_ref= mu_E * M_Em * kT_M * g  
  % p has 8 powers (in colums) for each length, see DEB-book p123
  p_C = [p(:,2), p(:,3) + p(:,6)]; % catabolic, som maint + growth power
  p =[p(:,1), p(:,3)+p(:,4)+p(:,5)+(1-kap_R)*p(:,8), p(:,6)];

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/Odesolvers/ebtdopri5.c<|end_filename|>
/***
   NAME
     ebtdopri5
   DESCRIPTION
     This file contains the specification of an explicit Runge-Kutta method of
     order (4)5 due to Dormand & Prince with step size control and dense output
     for the actual time integration of the ODEs in the Escalator Boxcar Train
     program. This method is used here especially for event location.
     The code is adapted from the original C source code, written by

		<NAME> & <NAME>
		Universite de Geneve, dept. de Mathematiques
		CH-1211 GENEVE 4, SWITZERLAND
		E-mail : <EMAIL>, <EMAIL>

     The code is described in : <NAME>, <NAME> and <NAME>, Solving
     ordinary differential equations I, nonstiff problems, 2nd edition,
     Springer Series in Computational Mathematics, Springer-Verlag (1993).
     
   Last modification: AMdR - Aug 02, 2015
***/
#ifndef EBTDOPRI5
#define EBTDOPRI5
#endif



/*==========================================================================*/
/*
 * Defining all constants that are local to this specific file.
 */
/*==========================================================================*/
/***
	DESCRIPTION OF INTEGRATION CONSTANTS

BETA	 The "beta" for stabilized step size control (see section IV.2 of the
	 book). Larger values for beta ( <= 0.1 ) make the step size control 
	 more stable. dopri5 needs a larger beta than Higham & Hall. Negative 
	 initial value provoke beta=0; default beta=0.04.

FAC1     Parameters for step size selection; the new step size is chosen
FAC2     subject to the restriction  fac1 <= hnew/hold <= fac2.
	 Default values are fac1=0.2 and fac2=10.0.

SAFETY   Safety factor in the step size prediction, default 0.9.

***/  

#define BETA		0.1
#define FAC1		0.2
#define FAC2	       10.0
#define FACC1		5.0			/* 1.0 / FAC1               */
#define FACC2		0.1			/* 1.0 / FAC2               */
#define SAFETY		0.9
#define ABS_ERR		1.0E-13
#define FACOLD		1.0E-4
#define NSTIFF		1000



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define MAFO "Memory allocation failure in ODE integration routine!"
#define REC  "Too many recursions in integration to find suitable stepsize!"
#define SSS  "Step size in integration routine too small!"
#define ZBB  "Root is not bracketed in ZBRENT!"
#define ZBM  "Maximum number of iterations exceeded in ZBRENT!"


/*==========================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

static int		step_failed=0, recur_no;
static int		nonsti = 0, iasti = 0;
static double		hlamb = 0.0;
static long		accepted_steps = 0L;
static long		ODEAllocated = 0L, SystemSize;
static double		*y  = NULL, *yy1 = NULL, *yco  = NULL, *ysti = NULL;
static double		*k1 = NULL, *k2  = NULL, *k3   = NULL;
static double		*k4 = NULL, *k5  = NULL, *k6   = NULL;
static double		*rcont1 = NULL, *rcont2  = NULL, *rcont3 = NULL;
static double		*rcont4 = NULL, *rcont5  = NULL;
#if (POPULATION_NR > 0)
static int		table_size[POPULATION_NR];
static population	u_pop[POPULATION_NR], 	   u_ofs[POPULATION_NR];
static population	c_pop[POPULATION_NR],	   c_ofs[POPULATION_NR];
static population	u_popgrad1[POPULATION_NR], u_ofsgrad1[POPULATION_NR];
static population	u_popgrad2[POPULATION_NR], u_ofsgrad2[POPULATION_NR];
static population	u_popgrad3[POPULATION_NR], u_ofsgrad3[POPULATION_NR];
static population	u_popgrad4[POPULATION_NR], u_ofsgrad4[POPULATION_NR];
static population	u_popgrad5[POPULATION_NR], u_ofsgrad5[POPULATION_NR];
static population	u_popgrad6[POPULATION_NR], u_ofsgrad6[POPULATION_NR];
#else
static population	*bpoints = NULL;
static population	*u_pop = NULL, 	    *u_ofs = NULL;
#if (EVENT_NR > 0)
static population	*c_pop = NULL,	    *c_ofs = NULL;
#endif
static population	*u_popgrad1 = NULL, *u_ofsgrad1 = NULL;
static population	*u_popgrad2 = NULL, *u_ofsgrad2 = NULL;
static population	*u_popgrad3 = NULL, *u_ofsgrad3 = NULL;
static population	*u_popgrad4 = NULL, *u_ofsgrad4 = NULL;
static population	*u_popgrad5 = NULL, *u_ofsgrad5 = NULL;
static population	*u_popgrad6 = NULL, *u_ofsgrad6 = NULL;
#endif // (POPULATION_NR > 0)

static double		facold = FACOLD;
#if (EVENT_NR > 0)
static double		oldELvalue[EVENT_NR] = {0.0},
			newELvalue[EVENT_NR] = {0.0};
static int		located[EVENT_NR] = {0};
#endif


/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

void	PrepareCycle()

  /* 
   * PrepareCycle - This routine is called at the beginning of a cohort
   *		    cycle, when the size of the system of ODEs is fixed and
   *		    will not change until the end of the cohort cycle has
   *		    been reached. The different memory copies of the data
   *		    to be integrated and the pointers into the data heap
   *		    can hence safely be set up.
   */

{
  SystemSize = ENVIRON_DIM;
#if (POPULATION_NR > 0)
  register int		i;

  for(i=0; i<POPULATION_NR; i++)
    {
      table_size[i] = CohortNo[i]+BpointNo[i];
      SystemSize   += table_size[i]*COHORT_SIZE;
    }
#endif // (POPULATION_NR > 0)

  if (!(SystemSize < ODEAllocated))
    {
      ODEAllocated = MemBlocks(SystemSize);
      y    = (double *)Myalloc((void *)y, (size_t)ODEAllocated,
			       sizeof(double));
      yy1  = (double *)Myalloc((void *)yy1, (size_t)ODEAllocated,
			       sizeof(double));
      yco  = (double *)Myalloc((void *)yco, (size_t)ODEAllocated,
			       sizeof(double));
      ysti = (double *)Myalloc((void *)ysti, (size_t)ODEAllocated,
			       sizeof(double));
      k1   = (double *)Myalloc((void *)k1, (size_t)ODEAllocated,
			       sizeof(double));
      k2   = (double *)Myalloc((void *)k2, (size_t)ODEAllocated,
			       sizeof(double));
      k3   = (double *)Myalloc((void *)k3, (size_t)ODEAllocated,
			       sizeof(double));
      k4   = (double *)Myalloc((void *)k4, (size_t)ODEAllocated,
			       sizeof(double));
      k5   = (double *)Myalloc((void *)k5, (size_t)ODEAllocated,
			       sizeof(double));
      k6   = (double *)Myalloc((void *)k6, (size_t)ODEAllocated,
			       sizeof(double));
      rcont1  = (double *)Myalloc((void *)rcont1, (size_t)ODEAllocated,
				  sizeof(double));
      rcont2  = (double *)Myalloc((void *)rcont2, (size_t)ODEAllocated,
				  sizeof(double));
      rcont3  = (double *)Myalloc((void *)rcont3, (size_t)ODEAllocated,
				  sizeof(double));
      rcont4  = (double *)Myalloc((void *)rcont4, (size_t)ODEAllocated,
				  sizeof(double));
      rcont5  = (double *)Myalloc((void *)rcont5, (size_t)ODEAllocated,
				  sizeof(double));
      if(!(y && yy1 && yco && ysti && k1 && k2 && k3 && k4 && k5 && k6 &&
	   rcont1 && rcont2 && rcont3 && rcont4 && rcont5))
	ErrorAbort(MAFO);
    }

  (void)memcpy((DEF_TYPE *)y,			/* Copy environment vars.   */
	       (DEF_TYPE *)env,
	       ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)(y+len),		/* Copy all populations     */
		   (DEF_TYPE *)pop[i],
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      u_pop[i] = (population)(yy1+len);
      u_ofs[i] = (population)(yy1+len+CohortNo[i]*COHORT_SIZE);
      c_pop[i] = (population)(yco+len);
      c_ofs[i] = (population)(yco+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad1[i] = (population)(k1+len);
      u_ofsgrad1[i] = (population)(k1+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad2[i] = (population)(k2+len);
      u_ofsgrad2[i] = (population)(k2+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad3[i] = (population)(k3+len);
      u_ofsgrad3[i] = (population)(k3+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad4[i] = (population)(k4+len);
      u_ofsgrad4[i] = (population)(k4+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad5[i] = (population)(k5+len);
      u_ofsgrad5[i] = (population)(k5+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad6[i] = (population)(k6+len);
      u_ofsgrad6[i] = (population)(k6+len+CohortNo[i]*COHORT_SIZE);
      len += (table_size[i]*COHORT_SIZE);
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==============================================================================*/

static void	dopri5(double dt)

  /* 
   * dopri5 - Routine performs an integration step of the system using the
   *	      DOPRI5 integration method. The code is adapted from the original
   *	      C source code by <NAME> & <NAME>.
   */

{
  register int		i;
  static CONST double	
    a21=0.2, 		
    a31=3.0/40.0, 	a32=9.0/40.0,   
    a41=44.0/45.0,    	a42=-56.0/15.0, 	a43=32.0/9.0,
    a51=19372.0/6561.0, a52=-25360.0/2187.0,	a53=64448.0/6561.0, a54=-212.0/729.0,
    a61=9017.0/3168.0, 	a62=-355.0/33.0, 	a63=46732.0/5247.0, a64=49.0/176.0, 	a65=-5103.0/18656.0,
    a71=35.0/384.0, 				a73=500.0/1113.0,   a74=125.0/192.0,	a75=-2187.0/6784.0, 	a76=11.0/84.0,
    d1=-12715105075.0/11282082432.0, 		d3=87487479700.0/32700410799.0,
    d4=-10690763975.0/1880347072.0, 		d5=701980252875.0/199316789632.0,
    d6=-1453857185.0/822651844.0, 		d7=69997945.0/29380423.0,
    e1=71.0/57600.0, 				e3=-71.0/16695.0, 	
    e4=71.0/1920.0,	e5=-17253.0/339200.0, 	e6=22.0/525.0, 
    e7=-1.0/40.0;

  initState = y;
  currentState = yy1;
  currentDers[1] = k1;
  currentDers[2] = k2;
  currentDers[3] = k3;
  currentDers[4] = k4;
  currentDers[5] = k5;
  currentDers[6] = k6;
  currentDers[7] = k2;
						/* Set all time derivatives */
  k1[0] = k2[0] = k3[0] = k4[0] = k5[0] = k6[0] = 1.0;

						/* Don't do first deriva-   */
  if(!recur_no)					/* tive if already present  */
    {
      (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
      rk_level = 1;
      Gradient(yy1, u_pop, u_ofs, k1, u_popgrad1, u_ofsgrad1, bpoints);
#if (EVENT_NR > 0)
      for (i=0; i<EVENT_NR; i++) oldELvalue[i] = NO_EVENT;
      EventLocation(yy1, u_pop, u_ofs, bpoints, oldELvalue);
#endif
    }

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * a21 * k1[i];

  rk_level = 2;
  Gradient(yy1, u_pop, u_ofs, k2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a31*k1[i] + a32*k2[i]);

  rk_level = 3;
  Gradient(yy1, u_pop, u_ofs, k3, u_popgrad3, u_ofsgrad3, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a41*k1[i] + a42*k2[i] + a43*k3[i]);

  rk_level = 4;
  Gradient(yy1, u_pop, u_ofs, k4, u_popgrad4, u_ofsgrad4, bpoints);

  for (i = 0; i <SystemSize; i++)
    yy1[i] = y[i] + dt * (a51*k1[i] + a52*k2[i] + a53*k3[i] + a54*k4[i]);

  rk_level = 5;
  Gradient(yy1, u_pop, u_ofs, k5, u_popgrad5, u_ofsgrad5, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a61*k1[i] + a62*k2[i] + a63*k3[i] +
			  a64*k4[i] + a65*k5[i]);

  (void)memcpy((DEF_TYPE *)ysti, (DEF_TYPE *)yy1, SystemSize*sizeof(double));

  rk_level = 6;
  Gradient(yy1, u_pop, u_ofs, k6, u_popgrad6, u_ofsgrad6, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a71*k1[i] + a73*k3[i] + a74*k4[i] +
			  a75*k5[i] + a76*k6[i]);
  rk_level = 7;
  Gradient(yy1, u_pop, u_ofs, k2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i = 0; i < SystemSize; i++)
    rcont5[i] = dt * (d1*k1[i] + d3*k3[i] + d4*k4[i] +
		      d5*k5[i] + d6*k6[i] + d7*k2[i]);

  for (i = 0; i < SystemSize; i++)
    k4[i] = dt * (e1*k1[i] + e3*k3[i] + e4*k4[i] + e5*k5[i] + e6*k6[i] + e7*k2[i]);

  return;
} /* dopri5 */




/*==============================================================================*/
#if (EVENT_NR > 0)

static double 	delvalue(double theta, int eventindex)

{
  register int		i;
  double   		theta1, result[EVENT_NR];

  theta1 = 1.0 - theta;

  for (i = 0; i < SystemSize; i++)
    yco[i] = rcont1[i] + theta*(rcont2[i] +
				theta1*(rcont3[i] +
					theta*(rcont4[i] +
					       theta1*rcont5[i])));

  for (i=0; i<EVENT_NR; i++) result[i] = NO_EVENT;
  EventLocation(yco, c_pop, c_ofs, bpoints, result);
  
  return result[eventindex];
}




/*==============================================================================*/
#define ITMAX		500
#define EPS		1.0e-16

static double	zbrent(double olddel, double newdel, int eventindex)

{
  int			iter;
  double		a, b, c = 0.0, d = 0.0, e = 0.0, min1, min2;
  double		fa, fb, fc, p, q, r, s, tol1, xm;

  a = 0.0; fa=olddel;
  b = 1.0; fb=newdel;

  if (fb*fa > 0.0)
    {
      Warning(ZBB);
      return -1.0;
    }

  fc = fb;
  for (iter=0; iter<ITMAX; iter++)
    {
      if (fb*fc > 0.0)
	{
	  c = a; fc=fa;
	  e = d = b-a;
	}
      if (fabs(fc) < fabs(fb))
	{
	  a = b; fa = fb;
	  b = c; fb = fc;
	  c = a; fc = fa;
	}
      tol1 = 2.0*EPS*fabs(b)+0.5*identical_zero;
      xm = 0.5*(c-b);

      if ((fabs(xm) <= tol1 && fb*fc <=0.0) || fb == 0.0) return b;

      if (fabs(e) >= tol1 && fabs(fa) > fabs(fb))
	{
	  s = fb/fa;
	  if (a == c)
	    {
	      p=2.0*xm*s;
	      q=1.0-s;
	    }
	  else
	    {
	      q = fa/fc;
	      r = fb/fc;
	      p = s*(2.0*xm*q*(q-r)-(b-a)*(r-1.0));
	      q = (q-1.0)*(r-1.0)*(s-1.0);
	    }
	  if (p > 0.0) q = -q;
	  p = fabs(p);
	  min1 = 3.0*xm*q-fabs(tol1*q);
	  min2 = fabs(e*q);
	  if (2.0*p < (min1 < min2 ? min1 : min2))
	    {
	      e = d;
	      d = p/q;
	    }
	  else
	    {
	      d = xm;
	      e = d;
	    }
	}
      else
	{
	  d = xm;
	  e = d;
	}
      a = b; fa = fb;
      if (fabs(d) > tol1) b += d;
      else b += (xm > 0.0 ? fabs(tol1) : -fabs(tol1));
      fb = delvalue(b, eventindex);
    }
  Warning(ZBM);

  return -1.0;
}



#undef ITMAX
#undef EPS

/*===========================================================================*/

static void	LocateEvent(double prev_dt, int *doloc, int *located)

  /* 
   * LocateEvent - This routine is called to locate the events that are
   *		   triggered by the user-defined routine EventLocation()
   *	           It is assumed that on entrance to this routine, the array
   *		   doloc[] flags which events to locate, i.e. for which
   *		   event indicator oldELvalue[] and newELvalue[] have sound
		   values, i.e. both non-zero and their product negative.
   */

{
  register int		i;
  int			index = -1;
  double		new_dt, level;
  double		stepfrac[EVENT_NR], smallest = 2.0;

  for (i=0; i<EVENT_NR; i++)
    {
      located[i] = 0;
      if (doloc[i])
	{
	  stepfrac[i] = zbrent(oldELvalue[i], newELvalue[i], i);
	  if ((stepfrac[i] < 0.0) || (stepfrac[i] > 1.0))
	    {
	      if (EBTDEBUG(1))
		{
		  (void)fprintf(dbgfil, "Problem locating event %d at T = %15.8f",
				i, yy1[0]);
		  (void)fprintf(dbgfil,	"  Start = %12.7E", oldELvalue[i]);
		  (void)fprintf(dbgfil,	"  Stop = %12.7E", newELvalue[i]);
		  (void)fprintf(dbgfil,	"  dt old = %12.7E", prev_dt);
		  (void)fprintf(dbgfil,	"  dt new = %12.7E\n", stepfrac[i]*prev_dt);
		  fflush(dbgfil);
		}
	    }
	  else if (stepfrac[i] < smallest)
	    {
	      smallest = stepfrac[i];
	      index = i;
	    }
	}
    }

  if (index < 0)
    {
      (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
      return;
    }
  
  new_dt = prev_dt*stepfrac[index];
  if (new_dt == 0.0)
    (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
  else
    {
#if (1)						/* Use the continuous output*/
      double		theta, theta1;		/* state to continue        */
      
      theta = stepfrac[index];
      theta1 = 1.0 - theta;
      
      for (i = 0; i < SystemSize; i++)
	yy1[i] = rcont1[i] + theta*(rcont2[i] +
				    theta1*(rcont3[i] +
					    theta*(rcont4[i] +
						   theta1*rcont5[i])));
#else
      double		yd0, ydiff, bspl;
      
      dopri5(new_dt);
      /*
       * Update variables for continuous output
       */
      for (i = 0; i < SystemSize; i++)
	{
	  yd0 = y[i];
	  ydiff = yy1[i] - yd0;
	  bspl = new_dt * k1[i] - ydiff;
	  rcont1[i] = y[i];
	  rcont2[i] = ydiff;
	  rcont3[i] = bspl;
	  rcont4[i] = -new_dt * k2[i] + ydiff - bspl;
	}
#endif
    }
  
  located[index] = 1;
  LocatedEvent = index;
  
  for (i=0; i<EVENT_NR; i++) newELvalue[i] = NO_EVENT;
  EventLocation(yy1, u_pop, u_ofs, bpoints, newELvalue);

  equal2zero = max(identical_zero,
		   pow(10, ceil(log10(fabs(newELvalue[index]) + ABS_ERR))));

  cohort_end = ForceCohortEnd(yy1, u_pop, u_ofs, bpoints);

  if (EBTDEBUG(1))				/* Report performance if    */
    {						/* required by user         */
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "%-14s%3d: T = %15.8f     dt = %12.7E\n",
		  "Step to event", index, env[0], new_dt);
	  fflush(dbgfil);
	}
  
      if (EBTDEBUG(2) ||
	  (EBTDEBUG(1) && (fabs(newELvalue[index]) >= identical_zero)))
	{
	  if (cohort_end)
	    (void)fprintf(dbgfil, "%-18s T = %15.8f",
			  "Cohort closed:", yy1[0]);
	  else
	    (void)fprintf(dbgfil, "%-18s T = %15.8f",
			  "Event located:", yy1[0]);
	  (void)fprintf(dbgfil, "  Value = %12.7E", newELvalue[index]);
	  if (fabs(newELvalue[index]) >= identical_zero)
	    {
	      (void)fprintf(dbgfil, " ");
	      level = (ceil(log10(fabs(newELvalue[index])/identical_zero))-
		       identical_zero);
	      for (i=0; i<level; i++) (void)fprintf(dbgfil, "*");
	    }
	  (void)fprintf(dbgfil, "\n");
	  (void)fflush(dbgfil);
	}
    }

  return;
} /* LocateEvent */
#endif /* EVENT_NR > 0 */



/*==============================================================================*/

static void	  IntermediateState(double theta)

  /* 
   * IntermediateState - Routine computes the state of the system at an
   *			 intermediate time point by interpolation. 
   *			 Values are stored in basic data copy for further use
   *			 in output routines.
   */
  
{
  register int		i;
  double   		theta1;

  theta1 = 1.0 - theta;

  for (i = 0; i < SystemSize; i++)
    yco[i] = rcont1[i] + theta*(rcont2[i] +
				theta1*(rcont3[i] +
					theta*(rcont4[i] +
					       theta1*rcont5[i])));

  (void)memcpy((DEF_TYPE *)env, (DEF_TYPE *)yco, ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
  register int		j, k;
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)pop[i], (DEF_TYPE *)(yco+len),
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      len += (table_size[i]*COHORT_SIZE);
    }

  for(i=0; i<POPULATION_NR; i++)
    {
      for(j=0; j<BpointNo[i]; j++)
	{
	  if(ofs[i][j][number] > 0)
	    {
	      for(k=1; k<COHORT_SIZE; k++)
		ofs[i][j][k] /= ofs[i][j][number];
	    }
	  for(k=1; k<COHORT_SIZE; k++)
	    ofs[i][j][k] += bpoints[i][j][k];
	}
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==============================================================================*/

double	  IntegrationStep(double del_tim, double del_max, int recurs)

  /* 
   * IntegrationStep - Performs an integration with adaptable step size but 
   *                   maximum "del_max". Step size control and event
   *                   location as implemented by <NAME> & <NAME>.
   */
  
{
  register int		i;
  double		del_h;
  double		err, err0, sk, sqr, maxsqr;
  double		fac, fac11, hnew;
  double		yd0, ydiff, bspl;
  double		stnum, stden;
  int			adjust = 1, events = 0, intermediate = 0, maxerri;
#if (EVENT_NR > 0)
  int			dolocation[EVENT_NR];
#endif

  del_h = del_tim;				/* Adjust stepsize to hit   */
  if(del_max < (2*del_tim))			/* cohort end, look ahead   */
    {						/* two steps to avoid too   */
      del_h = 0.5*del_max;			/* drastic step changes	    */
      if(del_max < del_tim) del_h = del_max;
      adjust = 0;
    }
  if(del_h < SMALLEST_STEP)
    {
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      ErrorExit(0, SSS);
    }
  recur_no = recurs;
  LocatedEvent = -1;

  if (EBTDEBUG(4))
    {
      fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
	      "Starting step:", env[0], del_h, recurs);
      fflush(dbgfil);
    }

  dopri5(del_h);				/* Do an integration step   */

  err = 0.0; maxsqr = 0.0; maxerri = 0;		/* error estimation         */
  for (i = 0; i < SystemSize; i++)
    {
      sk   = ABS_ERR + accuracy * max (fabs(y[i]), fabs(yy1[i]));
      sqr  = k4[i] / sk;
      if (sqr > maxsqr)
	{
	  maxsqr  = sqr;
	  maxerri = i;
	}
      err += sqr*sqr;
    }
  err0 = err;
  err = sqrt (err / (double)SystemSize);

  if (err > 1.0)				/* Step rejected            */
    {
      if (EBTDEBUG(3))
	{
	  fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d Largest error contribution in ODE #%d (%.3f%%)\n",
		  "Step failed:", env[0], del_h, recur_no, maxerri, 100*maxsqr*maxsqr/err0);
	  fflush(dbgfil);
	}

      /*
       * If bigger than accuracy take smaller step and restart
       */
      recur_no++; step_failed=1;
      if (recur_no > 25)
	{
#if (POPULATION_NR > 0)
	  TransBcohorts();
#endif // (POPULATION_NR > 0)
	  ErrorExit(0, REC);
	}

      fac11  = pow (err, 0.2 - BETA * 0.75);
      del_h /= min (FACC1, fac11/SAFETY);

      step_size = del_h;
      del_h  = IntegrationStep(del_h, del_max, recur_no);
    }
  else						/* Step accepted            */
    {
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
		  "Step OK:", env[0], del_h, recur_no);
	  fflush(dbgfil);
	}

      /*
       * Step size adjustment using Lund-stabilization: we require
       * 		fac1 <=  hnew/h <= fac2
       * No increase if failed just before
       */
      if (adjust && !step_failed)
	{
	  fac11  = pow (err, 0.2 - BETA * 0.75);
	  fac    = fac11/pow(facold, BETA);
	  fac    = max(FACC2, min(FACC1, fac/SAFETY));
	  hnew   = del_h / fac;
	  facold = max (err, FACOLD);

	  step_size = min(hnew, cohort_limit);
	  step_size = min(step_size, LARGEST_STEP);
	}
      step_failed=0;
      accepted_steps++;
      
      if (EBTDEBUG(1))
	{
	  /*
	   * Do some stiffness detection at regular intervals
	   */
	  if (!(accepted_steps % NSTIFF) || (iasti > 0))
	    {
	      stnum = 0.0;
	      stden = 0.0;
	      for (i = 0; i < SystemSize; i++)
		{
		  sqr    = k2[i] - k6[i];
		  stnum += sqr*sqr;
		  sqr    = yy1[i] - ysti[i];
		  stden += sqr*sqr;
		}
	      if (stden > 0.0)
		hlamb = del_h * sqrt (stnum / stden);
	      if (hlamb > 3.25)
		{
		  nonsti = 0;
		  iasti++;
		  if (iasti == 15)
		    (void)fprintf(dbgfil,
				  "The problem is becoming stiff at T = %.4f\n",
				  env[0]);
		}
	      else
		{
		  nonsti++;
		  if (nonsti == 6) iasti = 0;
		}
	    }
	}

      /* 
       * Location of events: If located in previous and no change in ELvalue do
       * not locate.
       * WARNING: The order of these statements seems odd but is OK! What is
       * 	  checked is whether the newELvalue from before cohort closure
       *	  equals the value computed at the beginning of this time
       *	  integration step!
       */
#if (EVENT_NR > 0)
      for(i=0; i<EVENT_NR; i++)
	{
	  dolocation[i] = 1;
	  if (located[i] && isequal(oldELvalue[i], newELvalue[i]))
	    dolocation[i] = 0;
	}
      
      for (i=0; i<EVENT_NR; i++) newELvalue[i] = NO_EVENT;
      EventLocation(yy1, u_pop, u_ofs, bpoints, newELvalue);

      for(i=0, events=0; i<EVENT_NR; i++)
	{
	  if (((oldELvalue[i] < 0.0) && (newELvalue[i] < 0.0)) ||
	      ((oldELvalue[i] > 0.0) && (newELvalue[i] > 0.0)))
	    dolocation[i] = 0;
	  if (dolocation[i]) events++;
	}
#endif

      intermediate = ((next_output < (yy1[0]-identical_zero)) ||
		      ((state_out > 0.0) &&
		       (next_state_output < (yy1[0]-identical_zero))));

      if (events || intermediate)
	{
	  /*
	   * Update variables for event location and continuous output
	   */
	  for (i = 0; i < SystemSize; i++)
	    {
	      yd0 = y[i];
	      ydiff = yy1[i] - yd0;
	      bspl = del_h * k1[i] - ydiff;
	      rcont1[i] = y[i];
	      rcont2[i] = ydiff;
	      rcont3[i] = bspl;
	      rcont4[i] = -del_h * k2[i] + ydiff - bspl;
	    }
	}
      
#if (EVENT_NR > 0)
      if (events) LocateEvent(del_h, dolocation, located);
      else for(i=0; i<EVENT_NR; i++) located[i] = 0;
#endif

      /*
       * Produce intermediate output and state output if requested
       */
      if (intermediate)
	{
#if (POPULATION_NR > 0)
	  for(i=0; i<POPULATION_NR; i++) CohortNo[i] += BpointNo[i];
#endif // (POPULATION_NR > 0)
	  while (next_output < (yy1[0]-identical_zero))
	    {
	      IntermediateState((next_output-y[0])/del_h);
	      FileOut();
	      next_output += delt_out;
	    }
#if (POPULATION_NR > 0)
	  while ((state_out > 0.0) && (next_state_output < (yy1[0]-identical_zero)))
	    {
	      IntermediateState((next_state_output-y[0])/del_h);
	      FileState();
	      next_state_output += state_out;
	    }
	  for(i=0; i<POPULATION_NR; i++) CohortNo[i] -= BpointNo[i];
	  for(i=0; i<POPULATION_NR; i++) cohort_no[i] = CohortNo[i];
#endif // (POPULATION_NR > 0)
	}

      /*
       * Update the basic data copy, and the local copy 
       */
      (void)memcpy((DEF_TYPE *)env, (DEF_TYPE *)yy1, ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
      int		len;

      len = ENVIRON_DIM;
      for(i=0; i<POPULATION_NR; i++)
	{
	  (void)memcpy((DEF_TYPE *)pop[i], (DEF_TYPE *)(yy1+len),
		       (table_size[i]*COHORT_SIZE)*sizeof(double));
	  len += (table_size[i]*COHORT_SIZE);
	}
#endif // (POPULATION_NR > 0)

      (void)memcpy((DEF_TYPE *)y, (DEF_TYPE *)yy1, SystemSize*sizeof(double));
    }

  return del_h;
}



/*==========================================================================*/


<|start_filename|>docs/DEBtool_alga.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_alga</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: alga</H3>

Nutrient-limited growth of algae in reactors: more reserves, 1 structure, V1-morph

<HR>
<H4><A NAME="alga">alga</A></H4>

  Demo that runs:
  <ul>
    <li> <A HREF="#pars_alga"><code>pars_alga</code></A>: parameter setting </li>
    <li> <A HREF="#shbatch"><code>shbatch</code></A>: batch culture </li>
    <li> <A HREF="#shbatch1"><code>shbatch1</code></A>: batch culture </li>
    <li> <A HREF="#shchem"><code>shchem</code></A></li>: chemostat in equilibrium </li>
    <li> <A HREF="#shchem1"><code>shchem1</code></A>: chemostat in equilibrium </li>
    <li> <A HREF="#shcycle"><code>shcycle</code></A>: cycling nutrient concentrations </li>
  </ul>

  <p>
  This implementation accounts for: <BR>
  effects of ammonia and phosphate concentrations in the feed (X_Nr, X_Pr), throughput rates (h) and temperature (T). <BR>
  These environmental parameters are taken to be constant in the present implementation, but it is not difficult to let them vary in time. 
  Limitations by light, carbon and other can be implemented as well. 
  Two other nutrients can be substituted for ammonia and phosphate.

  <p>
  Organic compounds (that make up the alga):<BR>
  V = structure, EN = N-reserve, EP = P-reserve,<BR>
  Mineral compounds:<BR>
  C = carbon dioxide, H = water, O = dioxygen, <BR>
  N = ammonia, P = phosphate,
  DN = excreted N-reserve, DP = excreted P-reserve
   
  <p>
  Uptake is proportional to surface area, which is taken to be proportional to the structural volume: V1-morph. 
  This removes the distinction between the individual and the population level.

  <p>
  The simplification k_J = k_M*(1 - kap)/kap is implemented, which makes this energy-structured model also size-structured <BR>
  The alga divides when the structural mass exceeds a threshold value

  <p>
  Example of use after (optionally) editing file <code>pars_alga.m</code>: 
  <code>alga</code>

<HR>
<H4><A NAME="pars_alga">pars_alga</A></H4>

  Set the parameters by editing file <code>pars_alga.m</code> in toolbox alga.

<HR>
<H4><A NAME="shbatch">shbatch</A></H4>

  Batch reactor (h_X = h_V = h = 0); 
  Excreted reserves can NOT be assimilated (see shbatch1). Set initial conditions by editing file <code>shbatch.m</code>. 
  See pages 168 ff of the DEB-book.<BR>
  Four figures are shown of variables against time

  <p>
  fig <B>1</B><BR>
  Ammonia (blue, drawn) and excreted N-reserve (blue, stippled) in Molar

  <p>
  fig <B>2</B><BR>
  Phosphate (red, drawn) and excreted P-reserve (red, stippled) in Molar

  <p>
  fig <B>3</B><BR>
  Structure (green, drawn) in Molar

  <p>
  fig <B>4</B><BR>
  N-reserve density (blue, drawn) and P-reserve density (red, drawn) in mol/mol

  <p>
  Example of use after editing <code>pars_alga.m</code>: 
  <code>clear; pars_alga; shbatch</code>.<BR> 
  The command <code>clear; pars_alga; shbatch (4)</code> will only plot fig <B>4</B>.

<HR>
<H4><A NAME="shbatch1">shbatch1</A></H4>

  Batch reactor (h_X = h_V = h = 0); 
  Excreted reserves can be assimilated (see shbatch). 
  Set initial conditions by editing file <code>shbatch1.m</code>. 
  See pages 168 ff of the DEB-book.<BR>
  Four figures are shown of variables against time

  <p>
  fig <B>1</B><BR>
  Ammonia (blue, drawn) and excreted N-reserve (blue, stippled) in Molar.
  Most parameter settings result in a practical absence of excreted reserves. 

  <p>
  fig <B>2</B><BR>
  Phosphate (red, drawn) and excreted P-reserve (red, stippled) in Molar
  Most parameter settings result in a practical absence of excreted reserves. 

  <p>
  fig <B>3</B><BR>
  Structure (green, drawn) in Molar. Note the difference with <B>shbatch1</B>;
  the structure does not decline after reaching a ceiling.

  <p>
  fig <B>4</B><BR>
  N-reserve density (blue, drawn) and P-reserve density (red, drawn) in mol/mol

  <p>
  Example of use after editing <code>pars_alga.m</code>: 
  <code>clear all; pars_alga; shbatch1</code>.<BR> 
  The command <code>clear; pars_alga; shbatch1 (4)</code> will only plot fig <B>4</B>.

<HR>
<H4><A NAME="shchem">shchem</A></H4>

  Chemostat reactor (h_X = h_V = h) in equilibrium; 
  Excreted reserves can NOT be assimilated (see shchem1). 
  See pages 171 ff of the DEB-book.<BR>
  Six figures are shown of variables against throughput rate

  <p>
  fig <B>1</B><BR>
  Ammonia (blue, drawn) and excreted N-reserve (blue, stippled) in Molar

  <p>
  fig <B>2</B><BR>
  Phosphate (red, drawn) and excreted P-reserve (red, stippled) in Molar

  <p>
  fig <B>3</B><BR> 
  Total ammonia (blue, drawn) and phosphate (red, drawn) in Molar

  <p>
  fig <B>4</B><BR>
  Structure (green, drawn) in Molar

  <p>
  fig <B>5</B><BR>
  N-reserve density (blue, drawn) and P-reserve density (red, drawn) in mol/mol

  <p>
  fig <B>6</B><BR>
  N/C ratio (blue, drawn) and P/C ratio (red, drawn) in biomass (mol/mol).
  Usually looks similar to fig 5, because N and P in structure contribute little.

  <p>
  Example of use after editing <code>pars_alga.m</code>: 
  <code>clear all; pars_alga; shchem</code> or 
  <code>clear all; pars_alga; shbatch1</code>.<BR> 
  The command <code>clear; pars_alga; shchem (5)</code> will only plot fig <B>5</B>.

<HR>
<H4><A NAME="shchem1">shchem1</A></H4>

  Chemostat reactor (h_X = h_V = h); 
  Excreted reserves can be assimilated (see shchem). 
  See pages 171 ff of the DEB-book.<BR>
  Six figures are shown of variables against throughput rate

  <p>
  fig <B>1</B><BR>
  Ammonia (blue, drawn) and excreted N-reserve (blue, stippled) in Molar;
  Note that there is hardly any excreted N-reserve at low throughput rates (compare with shchem)

  <p>
  fig <B>2</B><BR>
  Phosphate (red, drawn) and excreted P-reserve (red, stippled) in Molar
  Note that there is hardly any excreted P-reserve at low throughput rates (compare with shchem)

  <p>
  fig <B>3</B><BR> 
  Total ammonia (blue, drawn) and phosphate (red, drawn) in Molar

  <p>
  fig <B>4</B><BR>
  Structure (green, drawn) in Molar; Note the difference with <B>shchem</B>;
  the biomass is still high at small throughput rates.

  <p>
  fig <B>5</B><BR>
  N-reserve density (blue, drawn) and P-reserve density (red, drawn) in mol/mol

  <p>
  fig <B>6</B><BR>
  N/C ratio (blue, drawn) and P/C ratio (red, drawn) in biomass (mol/mol).<BR>
  Usually looks similar to fig 5, because N and P in structure contribute little.

  <p>
  Example of use after editing <code>pars_alga.m</code>: 
  <code>clear all; pars_alga; shchem</code>.<BR> 
  The command <code>clear; pars_alga; shchem (5)</code> will only plot fig <B>5</B>.

<HR>
<H4><A NAME="shcycle">shcycle</A></H4>

  Reserve dynamics and algal growth at cycling nutrient concentrations;
  concentrations of nutrients N and P follow a parameterized cycling function of time (which is described in script-file <code>pars_cycle</code>). 
  Amplitude, period and phase-shift between the nutrients can be specified. 
  A vector of reserve turnover rates can be specified; 
  large turnover rates imply small reserve capacities. 
  Notice that the growth rate can be largest for the highest reserve capacity, if situations where both required nutrients are present are rare.  
  Parameters are set in script-file <code>pars_cycle</code>.

  <p>
  fig <B>1</B><BR>
  Nutrient N (blue) and P (red) as functions of time.

  <p>
  fig <B>2</B><BR> 
  Reserve densities for nutrient N (blue) and P (red) as functions of time for each specified reserve turnover rate.

  <p>
  fig <B>3</B><BR> 
  The logarithm of structure as a function of time for each specified reserve turnover rate.  
  The structure for the first reserve turnover rate is plotted in blue, for the last value in red, the rest in green.

  <p>
  Example of use after editing <code>pars_cycle.m</code>: 
  <code>clear all; shcycle</code>.<BR> 
  The command <code>clear; shcycle (3)</code> will only plot fig <B>3</B>.

<HR>
<H4><A NAME="shmcn">shmcn, shmcn_lm</A></H4>

  Reserve dynamics, excretion of C- and N-reserve and algal growth for given light, DIC and DIN trajectories in the environment as multiples of their half-saturation values. 
  Natural splines are used as forcing functions; parameters are set in function <code>shmcn</code>. 
  The function <code>shmcn_lm</code> also shows the leak and the Morel model, which has two maximum assimilation parameters for each nutrient.

  <p>
  fig <B>1</B><BR>
  DIC (red), DIN (blue) and light (green) as functions of time.

  <p>
  fig <B>2</B><BR> Reserve densities for carbohydrate (red) and nitrogen (blue) as functions of time.

  <p>
  fig <B>3</B><BR> Excretion rate of carbohydrates (red), and nitrogen (blue) as functions of time.

  <p>
  fig <B>4</B><BR> Specific growth rate as function of time.

  <p>
  Example of use after editing <code>shmcn.m</code>: 
  <code>clear all; shmcn</code>.<BR> 
  The command <code>clear; shmcn(3)</code> will only plot fig <B>3</B>.

<HR>
<H4><A NAME="clim">clim</A></H4>

  The function specifies a model for algal biomass development in a batch culture, where algae are limited by carbon dioxide. 
  Carbon dioxide exchanges with bicarbonate, which is not directly available to the algae. 
  See <A HREF="#cnplim"><code>cnplim</code></A> for simultaneous limitation by carbon dioixide, nitrate and phosphate.

  <p>
  Input:
  <ul> 
    <li> parameter vector:
      <ol>
        <li> mM, initial bicarbonate concentration </li>
        <li> mM, initial CO2 concentration </li>
        <li> mM, initial structure concentration </li>
        <li> mM, saturation constant for CO2 </li>
        <li> mol/mol, yield for reserve on structure </li>
        <li> mM/(mol.h), max spec CO2 uptake rate </li>
        <li> 1/h, reserve turnover rate </li>
        <li> 1/h, transformation from bicarbonate to CO2 </li>
        <li> 1/h, transformation from CO2 to bicarbonate </li>
      </ol>
    </li>
    <li> (nt,2)-matrix with times and measured optical densities</li>
  </ul>

  <p>
  Output: vector with optical densities of the batch culture.

  <p>
  The scriptfile <code>mydata_clim</code> sets data and the parameters and shows how the biomass develops in the batch culture.

<HR>
<H4><A NAME="cnplim">cnplim</A></H4>

  The function specifies a model for algal biomass development in a batch culture, where algae are limited by carbon dioxide, nitrate as well as phosphate. 
  Carbon dioxide exchanges with bicarbonate, which is not directly available to the algae.

  <p>
  Input:
  <ul> 
    <li> parameter vector:
      <ol>
        <li> K_C; mM, saturation constant for CO2 (C) </li>
        <li> K_N; mM, saturation constant for nitrate (N) </li>
        <li> K_P; mM, saturation constant for phosphate (P) </li>
        <li> j_Cm; mM/(mol*h), max spec CO2 uptake rate </li>
        <li> j_Nm; mM/(mol*h), max spec N </li>
        <li> j_Pm; mM/(mol*h), max spec P </li>
        <li> k_E; 1/h, reserve turnover rate</li>
        <li> kap_C; -, recovery fraction for rejected C-reserves </li>
        <li> kap_N; -, recovery fraction for rejected N-reserves </li>
        <li> kap_P; -, recovery fraction for rejected P-reserves </li>
        <li> yC_EV; mol/mol, yield for C-reserve on structure </li>
        <li> yN_EV; mol/mol, yield for N-reserve on structure </li>
        <li> yP_EV; mol/mol, yield for P-reserve on structure </li>
        <li> k_BC; 1/h, transformation from B (bicarbonate) to C </li>
        <li> k_CB; 1/h, transformation from C (CO2) to B </li>
        <li> B_0; mM, initial bicarbonate concentration </li>
        <li> C_0; mM, initial CO2 concentration </li>
        <li> m_C0; mol/mol, initial C-reserve density </li>
        <li> m_N0; mol/mol, initial N-reserve density </li>
        <li> m_P0; mol/mol, initial P-reserve density </li>
        <li> Biomm0; mM, initial structure concentration </li>
      </ol>
    </li>
    <li> (nt)-vector with time </li>
    <li> (nNP,2)-matrix with initial nitrate, phosphate concentrations </li>
  </ul>

  <p>
  Routine shcnplim shows how the biomass develops; 
  the data and the parameters are set in <code>mydata_cnplim</code>.


<HR>
<H4><A NAME="sgr">sgr1, sgr2, sgr3, sgr4</A></H4>

  Obtains the specific growth rate of V1-morphs with 1, 2, 3 or 4 reserves, using a Newton Raphson method with continuation.

  <p>
  Inputs:
  <ul>
    <li>m<sub>E</sub>: mol/mol, 1,2,3 or 4-vector with reserve densities</li>
    <li>k<sub>E</sub>: 1/d, reserve turnover rate</li> 
    <li>j<sub>EM</sub>: mol/d.mol, 1,2,3 or 4-vector with the specific somatic maintenance costs, if paid from reserves </li>
    <li>y<sub>EV</sub>: mol/mol, 1,2,3 or 4-vector with the yield of reserve on structure</li> 
    <li>j<sub>VM</sub>: mol/d.mol, optional 1,2,3 or 4-vector with the specific somatic maintenance costs, if paid from structure<br>
        Default j<sub>EM</sub>/ y<sub>EV</sub></li>
    <li>a: -, optional scalar or 1,2,3 or 4-vector with preference for the use of structure for maintenance (default 0)</li>
    <li>r<sub>0</sub>: 1/d, optional scalar with initial estimate for r</li>
  </ul>
  
  <p> 
  Outputs:
  <ul>
    <li>r: 1/d, scalar with the specific growth rate</li> 
    <li>j<sub>E</sub><sup>M</sup>: mol/d.mol, 1,2,3 or 4-vector with specific somatic maintenance paid from reserve</li>
    <li>j<sub>V</sub><sup>M</sup>: mol/d.mol, 1,2,3 or 4-vector with specific somatic maintenance paid from structure</li> 
    <li>j<sub>ER</sub>: mol/d.mol, 1,2,3 or 4-vector with specific fluxes of mobilised reserves that are rejected by the growth-SU</li> 
    <li>info: scalar with indicator for success (1) or failure (0) of numerical procedure</li>
  </ul>

  <p>
  Example of use: <code>mydata_sgr</code>

<HR>
<H4><A NAME="sar_psri">sar_psri</A></H4>

  The function obtains the specific assimilation rate of carbohydrates for oxygenic photosynthesis and the flux of captured, but not processed photons, whcich fuel fluorescense.
  It accounts for photo-synthesis, photo-respiration and photo-inhibition.
  Photons and carbon dioxide, as well as photons and dioxygen, are treated as parallelly processed complemantary compounds, while carbon dioxide and dioxygen are substitutable compounds.
  Photo-inhbition occurs when photons bind to a photon-SU complex; recovery from this situation occurs when one of the photons is released.
  The intracellular concentration of carbon dioxide and dioxygen is affected by growth and maintenance.
  Maintenance is fuelled by corbohydrates only, in terms of O2 and CO2.
  The stoichiometry of the growth process assumes NO3 as complementary compound.

  <p>
  Input:
  <ol> 
    <li> scalar with specific captured photon flux (mol/d.mol V) </li>
    <li> scalar with environmental carbon dioxide concentration (mol/dm^3) </li> 
    <li> scalar with environmental dioxygen concentration (mol/dm^3) </li> 
    <li> scalar with specific growth rate (1/d) </li> 
    <li> 10-vector with parameters
         <ol>
           <li>affinity for carbon dioxide (dm^3/d.mol V)</li>
           <li>affinity for dioxygen (dm^3/d.mol V)</li>
           <li>maximum net specific carbon fixation (1/d)</li>
           <li>maximum net specific photo respiration (1/d)</li>
           <li>rate of carbon dioxide exchnage with environment (1/d)</li>
           <li>rate of dioxygen exchnage with environment (1/d)</li>
           <li>inhibition repair rate (1/d)</li>
           <li>specific maintenance for carbohydrate (mol/d.mol)</li>
           <li>yield of structure on hydrocarbon (mol/mol)</li>
           <li>volume-specific mass of structure, mol/cm^3</li>
         </ol></li> 
    <li> 4-vector with chemical indices for structure (C, H, O, N)</li>
    <li> optional scalar for initial guess for carbohydrate flux</li>
  </ol>

  <p> 
  Output:
  <ol>
    <li> scalar with specific assimilation rate of carbohydrates (mol/d.mol)</li>
    <li> scalar with specific non-processed flux of photons (mol/d.mol)</li>
    <li> scalar with info on failure (0) or success (1) of numerical procedure </li>
  </ol>

  <p>
  An example of use is given in <code>mydata_sar_psri</code>


<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>docs/DEBtool_degrad.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_degrad</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: degrad</H3>

  Biodegradation of chemical compounds in batch cultures.

  <p>
  The theory for the models can be found in the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book</A>.

<HR>
<H4><A NAME="pirt">pirt</A></H4>

  The Marr-Pirt model is a special case of the DEB model, and has the Monod model as special case. 
  It concerns V1-morphs in a batch culture. 
  Two data sets are required to estimate all parameters using routines 
  <A HREF="DEBtool_lib_regr.html#nmregr"><code>nmregr</code></A>, or 
  <A HREF="DEBtool_lib_regr.html#nrregr"><code>nrregr</code></A>: time-substrate-weight and time-biomass-weight matrices. 
  The weight coefficients can be suppressed, in which case value one is inserted for all weight coefficients. 
  The single data set time-substrate-weight is sufficient if the initial biomass concentration, the yield and maintenance rate coefficients are kept fixed.

  <p>
  Input:
  <ul>
    <li> 6-vector with parameters:
      <ol>
        <li> initial concentration of substrate </li>
        <li> initial concentration of biomass </li>
        <li> saturation constant </li>
        <li> max spec uptake rate </li>
        <li> yield of substrate on biomass </li>
        <li> maintenance rate coefficient </li>
      </ol>
    </li> 
    <li> (n,k)-matrix with times for concentrations of substrate in column 1 </li>
    <li> (m,k)-matrix with times for biomass in column 1 </li>
  </ul>

  <p>
  Output:
  <ul>
    <li> n-vector with concentrations of substrate </li>
    <li> m-vector with biomass </li>
  </ul>

  <p>
  An example of application of <code>pirt</code> in regression and plotting routines is given in the script-file <code>mydata_pirt</code>.

<HR>
<H4><A NAME="DEB">DEB</A></H4>

  The DEB model concerns 1-structure, 1-reserve V1-morphs in a batch culture. 
  The reserve density is treated as a hidden variable, and the measured biomass is taken to quantify structure. 
  Two data sets are required to estimate all parameters using routines 
  <A HREF="DEBtool_lib_regr.html#nmregr"> <code>nmregr</code></A>, or 
  <A HREF="DEBtool_lib_regr.html#nrregr"> <code>nrregr</code></A>:
  time-substrate-weight and time-biomass-weight matrices. 
  The weight coefficients can be suppressed, in which case value one is inserted for all weight coefficients.

  <p>
  Input:
  <ul>
    <li> 6-vector with parameters:
      <ol>
        <li> initial concentration of substrate </li>
        <li> initial concentration of structure </li>
        <li> saturation constant </li>
        <li> max spec uptake rate </li>
        <li> yield of substrate on structure </li>
        <li> reserve turnover rate </li>
        <li> maintenance rate coefficient </li>
      </ol>
    </li> 
    <li> (n,k)-matrix with times for concentrations of substrate in column 1 </li>
    <li> (m,k)-matrix with times for biomass in column 1 </li>
  </ul>

  <p>
  Output:
  <ul>
    <li> n-vector with concentrations of substrate </li>
    <li> m-vector with biomass </li>
  </ul>

  <p>
  An example of application of <code>DEB</code> in regression and plotting routines is given in the script-file <code>mydata_deb</code>.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>



<|start_filename|>docs/first_oct_matl.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>
    DEBtool
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="DEBtool, debtool, Dynamic Energy Budget
    theory, Dynamic Energy Budgets, DEB theory, DEB theorie, DEB, deb,
    deb theorie" >
  <META 
    NAME="description" CONTENT="Software package DEBtool, debtool">
  <META NAME="distribution" CONTENT="global">
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>Octave versus Matlab</H1>

Some small differences exist between Octave and Matlab.

The following list is not meant to be exhaustive, but aims the solve practical problems in conversions

<UL>
<LI>
  Octave uses a single ODE-solver for <code>x(t)</code>: <CODE>x = lsode("nm",x0,t)</CODE>; 
  its various algorithms can be set with options.
  Matlab has several ODE-solvers, e.g. <CODE>[t,x] = ode45("nm",t,x0)</CODE></TD>.
  Notice that the sequence of indepent and dependent variables in the input is different;
  this difference should match that of the user-defined function that specifies the ODE.
  Matlab has the independent variable also as output; 
  this is because if it is a 2-vector in the input, the output has all evaluated in-between-points.
  If the input vector has 3 or more elements, the first output is identical to the used input.
</LI>
   
   
<LI>
  The output of Octave's root finder <code>fsolve("name",x0)</code> has an indicator success or failure as second argument, while that of Matlab (with the same name) has this as third output, the second one being the value of the function at the root.
  Matlab's root finder (of the optimisation toolbox) has an extremely narrow domain of attraction, compared to that of Octave.
</LI>
   
 <LI>
   Unused variables in Octave functions, that are declared global, can have numerical values. 
   In Matlab they exist, but are empty (0 x 0); 
   <code>clear</code> does not affect the values of global variables inside functions
</LI>
</UL>

</BODY>
</HTML>


<|start_filename|>docs/char.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>
    First steps in Emacs
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="Emacs" >

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1> Characters in Octal indices </H1>

<TABLE>
<tr>
<td> 37 </td><td> &#31; </td><td>  40 </td><td> &#32;  </td><td> 41 </td><td> &#33;  </td><td> 42 </td><td> &#34;  </td><td> 43 </td><td> &#35; </td><td>  44  &#36;  </td><td> 45 </td><td> &#37; </td><td> 46 </td><td> &#38;</td>
</tr><tr>
<td> 47 </td><td> &#39; </td><td>  50 </td><td> &#40;  </td><td> 51 </td><td> &#41;  </td><td> 52 </td><td> &#42;  </td><td> 53 </td><td> &#43; </td><td>  54  &#44;  </td><td> 55 </td><td> &#45; </td><td> 56 </td><td> &#46;</td>  
</tr><tr>
<td> 57 </td><td> &#47; </td><td>  60 </td><td> &#48;  </td><td> 61 </td><td> &#49;  </td><td> 62 </td><td> &#50;  </td><td> 63 </td><td> &#51; </td><td>  64  &#52;  </td><td> 65 </td><td> &#53; </td><td> 66 </td><td> &#54;</td>  
</tr><tr>
<td> 67 </td><td> &#55; </td><td>  70 </td><td> &#56;  </td><td> 71 </td><td> &#57;  </td><td> 72 </td><td> &#58;  </td><td> 73 </td><td> &#59; </td><td>  74  &#60;  </td><td> 75 </td><td> &#61; </td><td> 76 </td><td> &#62;</td>  
</tr><tr>
<td> 77 </td><td> &#63; </td><td> 100 </td><td> &#64;  </td><td>101 </td><td> &#65;  </td><td>102 </td><td> &#66;  </td><td>103 </td><td> &#67; </td><td> 104  &#68;  </td><td>105 </td><td> &#69; </td><td>106 </td><td> &#70;</td>  
</tr><tr>
<td>107 </td><td> &#71; </td><td> 110 </td><td> &#72;  </td><td>111 </td><td> &#73;  </td><td>112 </td><td> &#74;  </td><td>113 </td><td> &#75; </td><td> 114  &#76;  </td><td>115 </td><td> &#77; </td><td>116 </td><td> &#78;</td>  
</tr><tr>
<td>117 </td><td> &#79; </td><td> 120 </td><td> &#80;  </td><td>121 </td><td> &#81;  </td><td>122 </td><td> &#82;  </td><td>123 </td><td> &#83; </td><td> 124  &#84;  </td><td>125 </td><td> &#85; </td><td>126 </td><td> &#86;</td>  
</tr><tr>
<td>127 </td><td> &#87; </td><td> 130 </td><td> &#88;  </td><td>131 </td><td> &#89;  </td><td>132 </td><td> &#90;  </td><td>133 </td><td> &#91; </td><td> 134  &#92;  </td><td>135 </td><td> &#93; </td><td>136 </td><td> &#94;</td>  
</tr><tr>
<td>137 </td><td> &#95; </td><td> 140 </td><td> &#96;  </td><td>141 </td><td> &#97;  </td><td>142 </td><td> &#98;  </td><td>143 </td><td> &#99; </td><td> 144 &#100;  </td><td>145 </td><td>&#101; </td><td>146 </td><td>&#102;</td>  
</tr><tr>
<td>147 </td><td>&#103; </td><td> 150 </td><td>&#104;  </td><td>151 </td><td>&#105;  </td><td>152 </td><td>&#106;  </td><td>153 </td><td>&#107; </td><td> 154 &#108;  </td><td>155 </td><td>&#109; </td><td>156 </td><td>&#110;</td>  
</tr><tr>
<td>157 </td><td>&#111; </td><td> 160 </td><td>&#112;  </td><td>161 </td><td>&#113;  </td><td>162 </td><td>&#114;  </td><td>163 </td><td>&#115; </td><td> 164 &#116;  </td><td>165 </td><td>&#117; </td><td>166 </td><td>&#118;</td>  
</tr><tr>
<td>167 </td><td>&#119; </td><td> 170 </td><td>&#120;  </td><td>171 </td><td>&#121;  </td><td>172 </td><td>&#122;  </td><td>173 </td><td>&#123; </td><td> 174 &#124;  </td><td>175 </td><td>&#125; </td><td>176 </td><td>&#126;</td>  
</tr><tr>
<td>177 </td><td>&#127; </td><td> 200 </td><td>&#128;  </td><td>201 </td><td>&#129;  </td><td>202 </td><td>&#130;  </td><td>203 </td><td>&#131; </td><td> 204 &#132;  </td><td>205 </td><td>&#133; </td><td>206 </td><td>&#134;</td> 
</tr><tr>
<td>207 </td><td>&#135; </td><td> 210 </td><td>&#136;  </td><td>211 </td><td>&#137;  </td><td>212 </td><td>&#138;  </td><td>213 </td><td>&#139; </td><td> 214 &#140;  </td><td>215 </td><td>&#141; </td><td>216 </td><td>&#14;2</td>
</tr><tr>
<td>217 </td><td>&#143; </td><td> 220 </td><td>&#144;  </td><td>221 </td><td>&#145;  </td><td>222 </td><td>&#146;  </td><td>223 </td><td>&#147; </td><td> 224 &#148;  </td><td>225 </td><td>&#149; </td><td>226 </td><td>&#15;0</td>
</tr><tr>
<td>227 </td><td>&#151; </td><td> 230 </td><td>&#152;  </td><td>231 </td><td>&#153;  </td><td>232 </td><td>&#154;  </td><td>233 </td><td>&#155; </td><td> 234 &#156;  </td><td>235 </td><td>&#157; </td><td>236 </td><td>&#15;8</td> 
</tr><tr>
<td>237 </td><td>&#159; </td><td> 240 </td><td>&#160;  </td><td>241 </td><td>&#161;  </td><td>242 </td><td>&#162;  </td><td>243 </td><td>&#163; </td><td> 244 &#164;  </td><td>245 </td><td>&#165; </td><td>246 </td><td>&#16;6</td>  
</tr><tr>
<td>247 </td><td>&#167; </td><td> 250 </td><td>&#168;  </td><td>251 </td><td>&#169;  </td><td>252 </td><td>&#170;  </td><td>253 </td><td>&#171; </td><td> 254 &#172;  </td><td>255 </td><td>&#173; </td><td>256 </td><td>&#17;4</td>  
</tr><tr>
<td>257 </td><td>&#175; </td><td> 260 </td><td>&#176;  </td><td>261 </td><td>&#177;  </td><td>262 </td><td>&#178;  </td><td>263 </td><td>&#179; </td><td> 264 &#180;  </td><td>265 </td><td>&#181; </td><td>266 </td><td>&#18;2</td>  
</tr><tr>
<td>267 </td><td>&#183; </td><td> 270 </td><td>&#184;  </td><td>271 </td><td>&#185;  </td><td>272 </td><td>&#186;  </td><td>273 </td><td>&#187; </td><td> 274 &#188;  </td><td>275 </td><td>&#189; </td><td>276 </td><td>&#19;0</td>  
</tr><tr>
<td>277 </td><td>&#191; </td><td> 300 </td><td>&#192;  </td><td>301 </td><td>&#193;  </td><td>302 </td><td>&#194;  </td><td>303 </td><td>&#195; </td><td> 304 &#196;  </td><td>305 </td><td>&#197; </td><td>306 </td><td>&#19;8</td>  
</tr><tr>
<td>307 </td><td>&#199; </td><td> 310 </td><td>&#200;  </td><td>311 </td><td>&#201;  </td><td>312 </td><td>&#202;  </td><td>313 </td><td>&#203; </td><td> 314 &#204;  </td><td>315 </td><td>&#205; </td><td>316 </td><td>&#20;6</td>  
</tr><tr>
<td>317 </td><td>&#207; </td><td> 320 </td><td>&#208;  </td><td>321 </td><td>&#209;  </td><td>322 </td><td>&#210;  </td><td>323 </td><td>&#211; </td><td> 324 &#212;  </td><td>325 </td><td>&#213; </td><td>326 </td><td>&#21;4</td>  
</tr><tr>
<td>327 </td><td>&#215; </td><td> 330 </td><td>&#216;  </td><td>331 </td><td>&#217;  </td><td>332 </td><td>&#218;  </td><td>333 </td><td>&#219; </td><td> 334 &#220;  </td><td>335 </td><td>&#221; </td><td>336 </td><td>&#22;2</td>  
</tr><tr>
<td>337 </td><td>&#223; </td><td> 340 </td><td>&#224;  </td><td>341 </td><td>&#225;  </td><td>342 </td><td>&#226;  </td><td>343 </td><td>&#227; </td><td> 344 &#228;  </td><td>345 </td><td>&#229; </td><td>346 </td><td>&#23;0</td>  
</tr><tr>
<td>347 </td><td>&#231; </td><td> 350 </td><td>&#232;  </td><td>351 </td><td>&#233;  </td><td>352 </td><td>&#234;  </td><td>353 </td><td>&#235; </td><td> 354 &#236;  </td><td>355 </td><td>&#237; </td><td>356 </td><td>&#23;8</td>  
</tr><tr>
<td>357 </td><td>&#239; </td><td> 360 </td><td>&#240;  </td><td>361 </td><td>&#241;  </td><td>362 </td><td>&#242;  </td><td>363 </td><td>&#243; </td><td> 364 &#244;  </td><td>365 </td><td>&#245; </td><td>366 </td><td>&#24;6</td>  
</tr><tr>
<td>367 </td><td>&#247; </td><td> 370 </td><td>&#248;  </td><td>371 </td><td>&#249;  </td><td>372 </td><td>&#250;  </td><td>373 </td><td>&#251; </td><td> 374 &#252;  </td><td>375 </td><td>&#253; </td><td>376 </td><td>&#25;4</td>  
</tr><tr>
<td>377 </td><td>&#255;</td>
</tr>
</TABLE>
</BODY>
</HTML>

<|start_filename|>animal/html/shyield_CC.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>shyield_CC</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-06"><meta name="DC.source" content="shyield_CC.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Example of use</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> shyield_CC(p)
</pre><pre class="codeinput">  <span class="comment">%  created 2009/01/15 by <NAME></span>
  <span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>plots yield on carbon-carbon basis as functions of length and scaled func response</pre><h2>Input<a name="4"></a></h2><pre>p: 10-vector with parameters (see below)</pre><h2>Example of use<a name="5"></a></h2><pre>shyield_CC([0.8; 0.95; 0.0207; 0.002; 0.0064; 0; 0.02; 0.275; 50; 0.8])</pre><pre class="codeinput">  <span class="comment">% unpack parameters</span>
  kap  = p(1);  <span class="comment">% -, fraction allocated to growth + som maint</span>
  kapR = p(2);  <span class="comment">% -, fraction of reprod flux that is fixed in embryo reserve</span>
  g    = p(3);  <span class="comment">% -, energy investment ratio</span>
  kJ   = p(4);  <span class="comment">% 1/d, maturity maint rate coeff</span>
  kM   = p(5);  <span class="comment">% 1/d, somatic maint rate coeff</span>
  LT   = p(6);  <span class="comment">% cm, heating length</span>
  v    = p(7);  <span class="comment">% cm/d, energy conductance</span>
  Hb   = p(8);  <span class="comment">% d cm^2, scaled maturity at birth</span>
  Hp   = p(9);  <span class="comment">% d cm^2, scaled maturity at puberty</span>
  yVE =  p(10); <span class="comment">% mol/mol, yield of structure on reserve</span>

  vHb = Hb * g^2 * kM^3/ ((1 - kap) * v^2);
  vHp = Hp * g^2 * kM^3/ ((1 - kap) * v^2);
  k = kJ/ kM; Lm = v/ g/ kM; lT = LT/ Lm;
  f_min_b = get_eb_min([g; k; vHb]); f_min_b = f_min_b(2);
  f_min_p = get_ep_min([g; k; lT; vHb; vHp]);
  nf = 10; f = linspace(.001 + max(f_min_p), 1, nf)'; f_min_p = f_min_p(2);

  clf
  hold <span class="string">on</span>

  <span class="keyword">for</span> i = 1:nf
    nl = round(2 + 100 * f(i));
    l = linspace(1e-3, f(i) - lT - 1e-8, nl)';
    <span class="keyword">if</span> f(i) &gt; f_min_p
     [lp lb] = get_lp([g;k;lT;vHb;vHp], f(i));
    <span class="keyword">elseif</span> f(i) &gt; f_min_b
      lp = NaN;
      lb = get_lb([g;k;vHb], f(i));
    <span class="keyword">else</span>
      lp = NaN;
      lb = NaN;
    <span class="keyword">end</span>

    pACSJGRD = scaled_power(l, f(i), p, lb, lp);
    F = f(i) * ones(nl,1);
    sel = (sum(pACSJGRD(:,[5 6]) &gt; 0, 2) == 2);
    pC = pACSJGRD(:,2); pD = pACSJGRD(:,7); pG = pACSJGRD(:,5);
    y = (pD + (1 - yVE) * pG) ./ pC;
    plot3(l(sel), F(sel), y(sel), <span class="string">'r'</span>)
  <span class="keyword">end</span>
  title(<span class="string">'yield of CO2 dissipation on mobilisation'</span>)
  xlabel(<span class="string">'length'</span>)
  ylabel(<span class="string">'func resp'</span>)
  zlabel(<span class="string">'yield_{CC}'</span>)
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function shyield_CC(p)
  %  created 2009/01/15 by <NAME>
  %
  %% Description
  %  plots yield on carbon-carbon basis as functions of length and scaled func response
  %
  %% Input
  %  p: 10-vector with parameters (see below)
  %
  %% Example of use
  %  shyield_CC([0.8; 0.95; 0.0207; 0.002; 0.0064; 0; 0.02; 0.275; 50; 0.8])

  % unpack parameters
  kap  = p(1);  % -, fraction allocated to growth + som maint
  kapR = p(2);  % -, fraction of reprod flux that is fixed in embryo reserve 
  g    = p(3);  % -, energy investment ratio
  kJ   = p(4);  % 1/d, maturity maint rate coeff
  kM   = p(5);  % 1/d, somatic maint rate coeff
  LT   = p(6);  % cm, heating length
  v    = p(7);  % cm/d, energy conductance
  Hb   = p(8);  % d cm^2, scaled maturity at birth
  Hp   = p(9);  % d cm^2, scaled maturity at puberty
  yVE =  p(10); % mol/mol, yield of structure on reserve
  
  vHb = Hb * g^2 * kM^3/ ((1 - kap) * v^2);
  vHp = Hp * g^2 * kM^3/ ((1 - kap) * v^2);
  k = kJ/ kM; Lm = v/ g/ kM; lT = LT/ Lm;
  f_min_b = get_eb_min([g; k; vHb]); f_min_b = f_min_b(2);
  f_min_p = get_ep_min([g; k; lT; vHb; vHp]); 
  nf = 10; f = linspace(.001 + max(f_min_p), 1, nf)'; f_min_p = f_min_p(2);
  
  clf
  hold on
  
  for i = 1:nf
    nl = round(2 + 100 * f(i)); 
    l = linspace(1e-3, f(i) - lT - 1e-8, nl)';
    if f(i) > f_min_p
     [lp lb] = get_lp([g;k;lT;vHb;vHp], f(i));
    elseif f(i) > f_min_b
      lp = NaN;
      lb = get_lb([g;k;vHb], f(i));
    else
      lp = NaN;
      lb = NaN;
    end

    pACSJGRD = scaled_power(l, f(i), p, lb, lp);
    F = f(i) * ones(nl,1);
    sel = (sum(pACSJGRD(:,[5 6]) > 0, 2) == 2);
    pC = pACSJGRD(:,2); pD = pACSJGRD(:,7); pG = pACSJGRD(:,5); 
    y = (pD + (1 - yVE) * pG) ./ pC;
    plot3(l(sel), F(sel), y(sel), 'r')
  end
  title('yield of CO2 dissipation on mobilisation')
  xlabel('length')
  ylabel('func resp')
  zlabel('yield_{CC}')
  
##### SOURCE END #####
--></body></html>

<|start_filename|>lib/regr/html/psurv2.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>psurv2</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="psurv2.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Output</a></li><li><a href="#6">Remarks</a></li><li><a href="#7">Example of use</a></li><li><a href="#8">set independent variables to column vectors,</a></li><li><a href="#9">t = reshape(t, max(size(t)), 1);</a></li><li><a href="#10">y = reshape(y, max(size(y)), 1);</a></li><li><a href="#11">eval([ 'f = ', func, '(p(:,1), t, y);']);</a></li><li><a href="#12">prob = reshape(f - [f(2:nt,:);zeros(1,ny)], nty, 1);</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span>  [cov, cor, sd, dev] = psurv2(func, p, t, y, N)
</pre><pre class="codeinput">  <span class="comment">%  created: 2002/02/08 by <NAME>; corrected 2005/01/27</span>
  <span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>Calculates covariance matrix and standard deviations of parameters in survivor models, like psurv, but for 2 independent variables.</pre><h2>Input<a name="4"></a></h2><pre>func: string with name of user-defined function
   f = func (p, t, y) with p: np-vector; t: nt-vector; y: ny-vector
   f: (nt,ny)-matrix with model-predictions for surviving numbers
p: (np,2) matrix with
   p(:,1) initial guesses for parameter values
   p(:,2) binaries with yes or no iteration (optional)
t: (nt,1)-vector with first independent variable (time)
y: (ny,1)-vector with second independent variable
N: (nt,ny)-matrix with surviving numbers</pre><h2>Output<a name="5"></a></h2><pre>cov: (np,np) matrix with covariances
cor: (np,np) matrix with correlation coefficients
sd: (np,1) matrix with standard deviations
dev: scalar with deviance</pre><h2>Remarks<a name="6"></a></h2><pre>calls scdsurv2, and user-defined function 'func'</pre><h2>Example of use<a name="7"></a></h2><pre>assuming that function_name, pars, tvalues, yvalues, numbers are defined properly:
[cov, cor, sd, ss] = pregr2('function_name', pars, tvalues, yvalues, numbers).</pre><h2>set independent variables to column vectors,<a name="8"></a></h2><h2>t = reshape(t, max(size(t)), 1);<a name="9"></a></h2><h2>y = reshape(y, max(size(y)), 1);<a name="10"></a></h2><pre class="codeinput">  <span class="keyword">global</span> nt ny l index;

  [np, k] = size(p); <span class="comment">% np: number of parameters</span>
  cov = zeros(np,np);
  cor = zeros(np,np);

  index = 1:np;
  <span class="keyword">if</span> k&gt;1
    index = index(1 == p(:,2)); <span class="comment">% indices of estimated parameters</span>
  <span class="keyword">end</span>
  l = max(size(index));  <span class="comment">% l: number of estimated parameters</span>
  <span class="keyword">if</span> (l == 0)
    <span class="keyword">return</span>; <span class="comment">% no parameters to present statistics</span>
  <span class="keyword">end</span>

  [nt ny] = size(N); <span class="comment">% nt,ny is number of values of surviving individuals</span>
  nty = nt*ny;
  D = N - [N(2:nt,:); zeros(1,ny)]; D = reshape(D, nty, 1);
  n0 = ones(nt,1) * N(1,:); n0 = reshape(n0, nty, 1);
  likmax = D' * log(max(1e-10, D./ n0)); <span class="comment">% max of log lik function</span>
</pre><h2>eval([ 'f = ', func, '(p(:,1), t, y);']);<a name="11"></a></h2><pre class="codeinput">				<span class="comment">% obtain survival probabilities</span>
</pre><h2>prob = reshape(f - [f(2:nt,:);zeros(1,ny)], nty, 1);<a name="12"></a></h2><pre class="codeinput">  [prob, Dprob] = scdsurv2(func, p(:,1), t, y);
				<span class="comment">% obtain death prob and derivatives</span>
  dprob = zeros(nty,np);
  dprob(:,index) = Dprob;


  dev = 2 * (likmax - D' * log(max(1e-10,prob)));
				<span class="comment">% deviance: 2* log lik minus its supremum</span>
  cov(index, index) = inv((n0./prob * ones(1,l).*Dprob)'*Dprob);
				<span class="comment">% inv of information matrix</span>
  sd = sqrt(diag(cov)); <span class="comment">% standard deviations</span>
  cor = cov./(1e-10 + sd*sd'); <span class="comment">% correlation matrix</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function  [cov, cor, sd, dev] = psurv2(func, p, t, y, N)
  %  created: 2002/02/08 by <NAME>; corrected 2005/01/27
  %
  %% Description
  %  Calculates covariance matrix and standard deviations of parameters in survivor models, like psurv, but for 2 independent variables. 
  %
  %% Input
  %  func: string with name of user-defined function
  %     f = func (p, t, y) with p: np-vector; t: nt-vector; y: ny-vector
  %     f: (nt,ny)-matrix with model-predictions for surviving numbers
  %  p: (np,2) matrix with
  %     p(:,1) initial guesses for parameter values
  %     p(:,2) binaries with yes or no iteration (optional)
  %  t: (nt,1)-vector with first independent variable (time)
  %  y: (ny,1)-vector with second independent variable
  %  N: (nt,ny)-matrix with surviving numbers
  %
  %% Output
  %  cov: (np,np) matrix with covariances
  %  cor: (np,np) matrix with correlation coefficients
  %  sd: (np,1) matrix with standard deviations
  %  dev: scalar with deviance
  %
  %% Remarks
  %  calls scdsurv2, and user-defined function 'func'
  %
  %% Example of use
  %  assuming that function_name, pars, tvalues, yvalues, numbers are defined properly: 
  %  [cov, cor, sd, ss] = pregr2('function_name', pars, tvalues, yvalues, numbers). 


  %% set independent variables to column vectors, 
  %% t = reshape(t, max(size(t)), 1);
  %% y = reshape(y, max(size(y)), 1);

  global nt ny l index;
  
  [np, k] = size(p); % np: number of parameters
  cov = zeros(np,np);
  cor = zeros(np,np);

  index = 1:np;
  if k>1
    index = index(1 == p(:,2)); % indices of estimated parameters
  end
  l = max(size(index));  % l: number of estimated parameters
  if (l == 0)
    return; % no parameters to present statistics
  end

  [nt ny] = size(N); % nt,ny is number of values of surviving individuals
  nty = nt*ny;
  D = N - [N(2:nt,:); zeros(1,ny)]; D = reshape(D, nty, 1);
  n0 = ones(nt,1) * N(1,:); n0 = reshape(n0, nty, 1);
  likmax = D' * log(max(1e-10, D./ n0)); % max of log lik function

  %% eval([ 'f = ', func, '(p(:,1), t, y);']);
				% obtain survival probabilities
  %% prob = reshape(f - [f(2:nt,:);zeros(1,ny)], nty, 1);
 
  [prob, Dprob] = scdsurv2(func, p(:,1), t, y);
				% obtain death prob and derivatives
  dprob = zeros(nty,np);
  dprob(:,index) = Dprob;
 

  dev = 2 * (likmax - D' * log(max(1e-10,prob)));
				% deviance: 2* log lik minus its supremum
  cov(index, index) = inv((n0./prob * ones(1,l).*Dprob)'*Dprob);
				% inv of information matrix
  sd = sqrt(diag(cov)); % standard deviations
  cor = cov./(1e-10 + sd*sd'); % correlation matrix
##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/Odesolvers/ebtdopri8.c<|end_filename|>
/***
   NAME
     ebtdopri8
   DESCRIPTION
     This file contains the specification of an explicit Runge-Kutta method of
     order 8(5,3) due to Dormand & Prince with step size control and dense
     output for the actual time integration of the ODEs in the Escalator Boxcar
     Train program. This method is used here especially for event location.
     The code is adapted from the original C source code, written by

		<NAME> & <NAME>
		Universite de Geneve, dept. de Mathematiques
		CH-1211 GENEVE 4, SWITZERLAND
		E-mail : <EMAIL>, <EMAIL>

     The code is described in : <NAME>, <NAME> and <NAME>, Solving
     ordinary differential equations I, nonstiff problems, 2nd edition,
     Springer Series in Computational Mathematics, Springer-Verlag (1993).
     
   Last modification: AMdR - Jan 07, 2012
***/
#ifndef EBTDOPRI8
#define EBTDOPRI8
#endif



/*==========================================================================*/
/*
 * Defining all constants that are local to this specific file.
 */
/*==========================================================================*/
/***
	DESCRIPTION OF INTEGRATION CONSTANTS

BETA	 The "beta" for stabilized step size control (see section IV.2 of the
	 book). Larger values for beta ( <= 0.2 ) make the step size control 
	 more stable. Negative initial value provoke beta=0; default beta=0.0.

FAC1     Parameters for step size selection; the new step size is chosen
FAC2     subject to the restriction  fac1 <= hnew/hold <= fac2.
	 Default values are fac1=0.333 and fac2=6.0.

SAFETY   Safety factor in the step size prediction, default 0.9.

***/  

#define BETA		0.02
#define FAC1		0.333
#define FAC2	        6.0
#define FACC1		3.0			/* 1.0 / FAC1               */
#define FACC2	        0.166666666666666666	/* 1.0 / FAC2               */
#define SAFETY		0.9
#define ABS_ERR		1.0E-13
#define FACOLD		1.0E-4
#define NSTIFF		1000



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define MAFO "Memory allocation failure in ODE integration routine!"
#define REC  "Too many recursions in integration to find suitable stepsize!"
#define SSS  "Step size in integration routine too small!"
#define ZBB  "Root is not bracketed in ZBRENT!"
#define ZBM  "Maximum number of iterations exceeded in ZBRENT!"


/*==========================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

static int		step_failed=0, recur_no;
static int		nonsti = 0, iasti = 0;
static double		hlamb = 0.0;
static long		accepted_steps = 0L;
static long		ODEAllocated = 0L, SystemSize;
static double		*y  = NULL, *yy1 = NULL, *yco  = NULL;
static double		*k1 = NULL, *k2  = NULL, *k3   = NULL;
static double		*k4 = NULL, *k5  = NULL, *k6   = NULL;
static double		*k7 = NULL, *k8  = NULL, *k9   = NULL, *k10 = NULL;
static double		*rcont1 = NULL, *rcont2  = NULL, *rcont3 = NULL;
static double		*rcont4 = NULL, *rcont5  = NULL, *rcont6 = NULL;
static double		*rcont7 = NULL, *rcont8  = NULL;
#if (POPULATION_NR > 0)
static int		table_size[POPULATION_NR];
static population	u_pop[POPULATION_NR], 	    u_ofs[POPULATION_NR];
static population	c_pop[POPULATION_NR],	    c_ofs[POPULATION_NR];
static population	u_popgrad1[POPULATION_NR],  u_ofsgrad1[POPULATION_NR];
static population	u_popgrad2[POPULATION_NR],  u_ofsgrad2[POPULATION_NR];
static population	u_popgrad3[POPULATION_NR],  u_ofsgrad3[POPULATION_NR];
static population	u_popgrad4[POPULATION_NR],  u_ofsgrad4[POPULATION_NR];
static population	u_popgrad5[POPULATION_NR],  u_ofsgrad5[POPULATION_NR];
static population	u_popgrad6[POPULATION_NR],  u_ofsgrad6[POPULATION_NR];
static population	u_popgrad7[POPULATION_NR],  u_ofsgrad7[POPULATION_NR];
static population	u_popgrad8[POPULATION_NR],  u_ofsgrad8[POPULATION_NR];
static population	u_popgrad9[POPULATION_NR],  u_ofsgrad9[POPULATION_NR];
static population	u_popgrad10[POPULATION_NR], u_ofsgrad10[POPULATION_NR];
#else
static population	*bpoints = NULL;
static population	*u_pop = NULL, 	     *u_ofs = NULL;
#if (EVENT_NR > 0)
static population	*c_pop = NULL,	     *c_ofs = NULL;
#endif // (EVENT_NR > 0)
static population	*u_popgrad1 = NULL,  *u_ofsgrad1 = NULL;
static population	*u_popgrad2 = NULL,  *u_ofsgrad2 = NULL;
static population	*u_popgrad3 = NULL,  *u_ofsgrad3 = NULL;
static population	*u_popgrad4 = NULL,  *u_ofsgrad4 = NULL;
static population	*u_popgrad5 = NULL,  *u_ofsgrad5 = NULL;
static population	*u_popgrad6 = NULL,  *u_ofsgrad6 = NULL;
static population	*u_popgrad7 = NULL,  *u_ofsgrad7 = NULL;
static population	*u_popgrad8 = NULL,  *u_ofsgrad8 = NULL;
static population	*u_popgrad9 = NULL,  *u_ofsgrad9 = NULL;
static population	*u_popgrad10 = NULL, *u_ofsgrad10 = NULL;
#endif // (POPULATION_NR > 0)

static double		facold = FACOLD;
#if (EVENT_NR > 0)
static double		oldELvalue[EVENT_NR] = {0.0},
			newELvalue[EVENT_NR] = {0.0};
static int		located[EVENT_NR] = {0};
#endif

static CONST double	c2    =  0.526001519587677318785587544488E-01,
			c3    =  0.789002279381515978178381316732E-01,
			c4    =  0.118350341907227396726757197510E+00,
			c5    =  0.281649658092772603273242802490E+00,
			c6    =  0.333333333333333333333333333333E+00,
			c7    =  0.25E+00,
			c8    =  0.307692307692307692307692307692E+00,
			c9    =  0.651282051282051282051282051282E+00,
			c10   =  0.6E+00,
			c11   =  0.857142857142857142857142857142E+00,
			c14   =  0.1E+00,
			c15   =  0.2E+00,
			c16   =  0.777777777777777777777777777778E+00,

			b1    =  5.42937341165687622380535766363E-2,
			b6    =  4.45031289275240888144113950566E0,
			b7    =  1.89151789931450038304281599044E0,
			b8    = -5.8012039600105847814672114227E0,
			b9    =  3.1116436695781989440891606237E-1,
			b10   = -1.52160949662516078556178806805E-1,
			b11   =  2.01365400804030348374776537501E-1,
			b12   =  4.47106157277725905176885569043E-2,

			bhh1  =  0.244094488188976377952755905512E+00,
			bhh2  =  0.733846688281611857341361741547E+00,
			bhh3  =  0.220588235294117647058823529412E-01,

			er1   =  0.1312004499419488073250102996E-01,
			er6   = -0.1225156446376204440720569753E+01,
			er7   = -0.4957589496572501915214079952E+00,
			er8   =  0.1664377182454986536961530415E+01,
			er9   = -0.3503288487499736816886487290E+00,
			er10  =  0.3341791187130174790297318841E+00,
			er11  =  0.8192320648511571246570742613E-01,
			er12  = -0.2235530786388629525884427845E-01,

                        a21   =  5.26001519587677318785587544488E-2,
                        a31   =  1.97250569845378994544595329183E-2,
                        a32   =  5.91751709536136983633785987549E-2,
                        a41   =  2.95875854768068491816892993775E-2,
                        a43   =  8.87627564304205475450678981324E-2,
                        a51   =  2.41365134159266685502369798665E-1,
                        a53   = -8.84549479328286085344864962717E-1,
                        a54   =  9.24834003261792003115737966543E-1,
                        a61   =  3.7037037037037037037037037037E-2,
                        a64   =  1.70828608729473871279604482173E-1,
                        a65   =  1.25467687566822425016691814123E-1,
                        a71   =  3.7109375E-2,
                        a74   =  1.70252211019544039314978060272E-1,
                        a75   =  6.02165389804559606850219397283E-2,
                        a76   = -1.7578125E-2,
                        a81   =  3.70920001185047927108779319836E-2,
                        a84   =  1.70383925712239993810214054705E-1,
                        a85   =  1.07262030446373284651809199168E-1,
                        a86   = -1.53194377486244017527936158236E-2,
                        a87   =  8.27378916381402288758473766002E-3,
                        a91   =  6.24110958716075717114429577812E-1,
                        a94   = -3.36089262944694129406857109825E0,
                        a95   = -8.68219346841726006818189891453E-1,
                        a96   =  2.75920996994467083049415600797E1,
                        a97   =  2.01540675504778934086186788979E1,
                        a98   = -4.34898841810699588477366255144E1,

                        a101  =  4.77662536438264365890433908527E-1,
                        a104  = -2.48811461997166764192642586468E0,
                        a105  = -5.90290826836842996371446475743E-1,
                        a106  =  2.12300514481811942347288949897E1,
                        a107  =  1.52792336328824235832596922938E1,
                        a108  = -3.32882109689848629194453265587E1,
                        a109  = -2.03312017085086261358222928593E-2,
                        a111  = -9.3714243008598732571704021658E-1,
                        a114  =  5.18637242884406370830023853209E0,
                        a115  =  1.09143734899672957818500254654E0,
                        a116  = -8.14978701074692612513997267357E0,
                        a117  = -1.85200656599969598641566180701E1,
                        a118  =  2.27394870993505042818970056734E1,
                        a119  =  2.49360555267965238987089396762E0,
                        a1110 = -3.0467644718982195003823669022E0,
                        a121  =  2.27331014751653820792359768449E0,
                        a124  = -1.05344954667372501984066689879E1,
                        a125  = -2.00087205822486249909675718444E0,
                        a126  = -1.79589318631187989172765950534E1,
                        a127  =  2.79488845294199600508499808837E1,
                        a128  = -2.85899827713502369474065508674E0,
                        a129  = -8.87285693353062954433549289258E0,
                        a1210 =  1.23605671757943030647266201528E1,
                        a1211 =  6.43392746015763530355970484046E-1,
                        a141  =  5.61675022830479523392909219681E-2,
                        a147  =  2.53500210216624811088794765333E-1,
                        a148  = -2.46239037470802489917441475441E-1,
                        a149  = -1.24191423263816360469010140626E-1,
                        a1410 =  1.5329179827876569731206322685E-1,
                        a1411 =  8.20105229563468988491666602057E-3,
                        a1412 =  7.56789766054569976138603589584E-3,
                        a1413 = -8.298E-3,
                        a151  =  3.18346481635021405060768473261E-2,
                        a156  =  2.83009096723667755288322961402E-2,
                        a157  =  5.35419883074385676223797384372E-2,
                        a158  = -5.49237485713909884646569340306E-2,
                        a1511 = -1.08347328697249322858509316994E-4,
                        a1512 =  3.82571090835658412954920192323E-4,
                        a1513 = -3.40465008687404560802977114492E-4,
                        a1514 =  1.41312443674632500278074618366E-1,
                        a161  = -4.28896301583791923408573538692E-1,
                        a166  = -4.69762141536116384314449447206E0,
                        a167  =  7.68342119606259904184240953878E0,
                        a168  =  4.06898981839711007970213554331E0,
                        a169  =  3.56727187455281109270669543021E-1,
                        a1613 = -1.39902416515901462129418009734E-3,
                        a1614 =  2.9475147891527723389556272149E0,
                        a1615 = -9.15095847217987001081870187138E0,

                        d41   = -0.84289382761090128651353491142E+01,
                        d46   =  0.56671495351937776962531783590E+00,
                        d47   = -0.30689499459498916912797304727E+01,
                        d48   =  0.23846676565120698287728149680E+01,
                        d49   =  0.21170345824450282767155149946E+01,
                        d410  = -0.87139158377797299206789907490E+00,
                        d411  =  0.22404374302607882758541771650E+01,
                        d412  =  0.63157877876946881815570249290E+00,
                        d413  = -0.88990336451333310820698117400E-01,
                        d414  =  0.18148505520854727256656404962E+02,
                        d415  = -0.91946323924783554000451984436E+01,
                        d416  = -0.44360363875948939664310572000E+01,
                        d51   =  0.10427508642579134603413151009E+02,
                        d56   =  0.24228349177525818288430175319E+03,
                        d57   =  0.16520045171727028198505394887E+03,
                        d58   = -0.37454675472269020279518312152E+03,
                        d59   = -0.22113666853125306036270938578E+02,
                        d510  =  0.77334326684722638389603898808E+01,
                        d511  = -0.30674084731089398182061213626E+02,
                        d512  = -0.93321305264302278729567221706E+01,
                        d513  =  0.15697238121770843886131091075E+02,
                        d514  = -0.31139403219565177677282850411E+02,
                        d515  = -0.93529243588444783865713862664E+01,
                        d516  =  0.35816841486394083752465898540E+02,
                        d61   =  0.19985053242002433820987653617E+02,
                        d66   = -0.38703730874935176555105901742E+03,
                        d67   = -0.18917813819516756882830838328E+03,
                        d68   =  0.52780815920542364900561016686E+03,
                        d69   = -0.11573902539959630126141871134E+02,
                        d610  =  0.68812326946963000169666922661E+01,
                        d611  = -0.10006050966910838403183860980E+01,
                        d612  =  0.77771377980534432092869265740E+00,
                        d613  = -0.27782057523535084065932004339E+01,
                        d614  = -0.60196695231264120758267380846E+02,
                        d615  =  0.84320405506677161018159903784E+02,
                        d616  =  0.11992291136182789328035130030E+02,
                        d71   = -0.25693933462703749003312586129E+02,
                        d76   = -0.15418974869023643374053993627E+03,
                        d77   = -0.23152937917604549567536039109E+03,
                        d78   =  0.35763911791061412378285349910E+03,
                        d79   =  0.93405324183624310003907691704E+02,
                        d710  = -0.37458323136451633156875139351E+02,
                        d711  =  0.10409964950896230045147246184E+03,
                        d712  =  0.29840293426660503123344363579E+02,
                        d713  = -0.43533456590011143754432175058E+02,
                        d714  =  0.96324553959188282948394950600E+02,
                        d715  = -0.39177261675615439165231486172E+02,
                        d716  = -0.14972683625798562581422125276E+03;


/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

void	PrepareCycle()

  /* 
   * PrepareCycle - This routine is called at the beginning of a cohort
   *		    cycle, when the size of the system of ODEs is fixed and
   *		    will not change until the end of the cohort cycle has
   *		    been reached. The different memory copies of the data
   *		    to be integrated and the pointers into the data heap
   *		    can hence safely be set up.
   */

{
  SystemSize = ENVIRON_DIM;
#if (POPULATION_NR > 0)
  register int		i;

  for(i=0; i<POPULATION_NR; i++)
    {
      table_size[i] = CohortNo[i]+BpointNo[i];
      SystemSize   += table_size[i]*COHORT_SIZE;
    }
#endif // (POPULATION_NR > 0)

  if (!(SystemSize < ODEAllocated))
    {
      ODEAllocated = MemBlocks(SystemSize);
      y    = (double *)Myalloc((void *)y, (size_t)ODEAllocated,
			       sizeof(double));
      yy1  = (double *)Myalloc((void *)yy1, (size_t)ODEAllocated,
			       sizeof(double));
      yco  = (double *)Myalloc((void *)yco, (size_t)ODEAllocated,
			       sizeof(double));
      k1   = (double *)Myalloc((void *)k1, (size_t)ODEAllocated,
			       sizeof(double));
      k2   = (double *)Myalloc((void *)k2, (size_t)ODEAllocated,
			       sizeof(double));
      k3   = (double *)Myalloc((void *)k3, (size_t)ODEAllocated,
			       sizeof(double));
      k4   = (double *)Myalloc((void *)k4, (size_t)ODEAllocated,
			       sizeof(double));
      k5   = (double *)Myalloc((void *)k5, (size_t)ODEAllocated,
			       sizeof(double));
      k6   = (double *)Myalloc((void *)k6, (size_t)ODEAllocated,
			       sizeof(double));
      k7   = (double *)Myalloc((void *)k7, (size_t)ODEAllocated,
			       sizeof(double));
      k8   = (double *)Myalloc((void *)k8, (size_t)ODEAllocated,
			       sizeof(double));
      k9   = (double *)Myalloc((void *)k9, (size_t)ODEAllocated,
			       sizeof(double));
      k10  = (double *)Myalloc((void *)k10, (size_t)ODEAllocated,
			       sizeof(double));

      rcont1  = (double *)Myalloc((void *)rcont1, (size_t)ODEAllocated,
				  sizeof(double));
      rcont2  = (double *)Myalloc((void *)rcont2, (size_t)ODEAllocated,
				  sizeof(double));
      rcont3  = (double *)Myalloc((void *)rcont3, (size_t)ODEAllocated,
				  sizeof(double));
      rcont4  = (double *)Myalloc((void *)rcont4, (size_t)ODEAllocated,
				  sizeof(double));
      rcont5  = (double *)Myalloc((void *)rcont5, (size_t)ODEAllocated,
				  sizeof(double));
      rcont6  = (double *)Myalloc((void *)rcont6, (size_t)ODEAllocated,
				  sizeof(double));
      rcont7  = (double *)Myalloc((void *)rcont7, (size_t)ODEAllocated,
				  sizeof(double));
      rcont8  = (double *)Myalloc((void *)rcont8, (size_t)ODEAllocated,
				  sizeof(double));
      if(!(y && yy1 && yco && k1 && k2 && k3 && k4 && k5 && k6 &&
	   k7 && k8 && k9 && k10 && rcont1 && rcont2 && rcont3 &&
	   rcont4 && rcont5 && rcont6 && rcont7 && rcont8))
	ErrorAbort(MAFO);
    }

  (void)memcpy((DEF_TYPE *)y,			/* Copy environment vars.   */
	       (DEF_TYPE *)env,
	       ENVIRON_DIM*sizeof(double));
#if (POPULATION_NR > 0)
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)(y+len),		/* Copy all populations     */
		   (DEF_TYPE *)pop[i],
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      u_pop[i] = (population)(yy1+len);
      u_ofs[i] = (population)(yy1+len+CohortNo[i]*COHORT_SIZE);
      c_pop[i] = (population)(yco+len);
      c_ofs[i] = (population)(yco+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad1[i]  = (population)(k1+len);
      u_ofsgrad1[i]  = (population)(k1+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad2[i]  = (population)(k2+len);
      u_ofsgrad2[i]  = (population)(k2+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad3[i]  = (population)(k3+len);
      u_ofsgrad3[i]  = (population)(k3+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad4[i]  = (population)(k4+len);
      u_ofsgrad4[i]  = (population)(k4+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad5[i]  = (population)(k5+len);
      u_ofsgrad5[i]  = (population)(k5+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad6[i]  = (population)(k6+len);
      u_ofsgrad6[i]  = (population)(k6+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad7[i]  = (population)(k7+len);
      u_ofsgrad7[i]  = (population)(k7+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad8[i]  = (population)(k8+len);
      u_ofsgrad8[i]  = (population)(k8+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad9[i]  = (population)(k9+len);
      u_ofsgrad9[i]  = (population)(k9+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad10[i] = (population)(k10+len);
      u_ofsgrad10[i] = (population)(k10+len+CohortNo[i]*COHORT_SIZE);
      len += (table_size[i]*COHORT_SIZE);
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==============================================================================*/

static void	dopri8(double dt)

  /* 
   * dopri8 - Routine performs an integration step of the system using the
   *	      DOPRI8 integration method. The code is adapted from the original
   *	      C source code by <NAME> & <NAME>.
   */

{
  register int		i;

  initState = y;
  currentState = yy1;
  currentDers[ 1] = k1;
  currentDers[ 2] = k2;
  currentDers[ 3] = k3;
  currentDers[ 4] = k4;
  currentDers[ 5] = k5;
  currentDers[ 6] = k6;
  currentDers[ 7] = k7;
  currentDers[ 8] = k8;
  currentDers[ 9] = k9;
  currentDers[10] = k10;
  currentDers[11] = k2;
  currentDers[12] = k3;
						/* Set all time derivatives */
  k1[0] = k2[0] = k3[0] = k4[0] = k5[0]  = 1.0;
  k6[0] = k7[0] = k8[0] = k9[0] = k10[0] = 1.0;

						/* Don't do first deriva-   */
  if(!recur_no)					/* tive if already present  */
    {
      (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
      rk_level = 1;
      Gradient(yy1, u_pop, u_ofs, k1, u_popgrad1, u_ofsgrad1, bpoints);
#if (EVENT_NR > 0)
      for (i=0; i<EVENT_NR; i++) oldELvalue[i] = NO_EVENT;
      EventLocation(yy1, u_pop, u_ofs, bpoints, oldELvalue);
#endif
    }

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * a21 * k1[i];

  rk_level = 2;
  Gradient(yy1, u_pop, u_ofs, k2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a31*k1[i] + a32*k2[i]);

  rk_level = 3;
  Gradient(yy1, u_pop, u_ofs, k3, u_popgrad3, u_ofsgrad3, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a41*k1[i] + a43*k3[i]);

  rk_level = 4;
  Gradient(yy1, u_pop, u_ofs, k4, u_popgrad4, u_ofsgrad4, bpoints);

  for (i = 0; i <SystemSize; i++)
    yy1[i] = y[i] + dt * (a51*k1[i] + a53*k3[i] + a54*k4[i]);

  rk_level = 5;
  Gradient(yy1, u_pop, u_ofs, k5, u_popgrad5, u_ofsgrad5, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a61*k1[i] + a64*k4[i] + a65*k5[i]);

  rk_level = 6;
  Gradient(yy1, u_pop, u_ofs, k6, u_popgrad6, u_ofsgrad6, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a71*k1[i] + a74*k4[i] + a75*k5[i] + a76*k6[i]);

  rk_level = 7;
  Gradient(yy1, u_pop, u_ofs, k7, u_popgrad7, u_ofsgrad7, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a81*k1[i] + a84*k4[i] + a85*k5[i] + a86*k6[i] +
			  a87*k7[i]);

  rk_level = 8;
  Gradient(yy1, u_pop, u_ofs, k8, u_popgrad8, u_ofsgrad8, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a91*k1[i] + a94*k4[i] + a95*k5[i] + a96*k6[i] +
			  a97*k7[i] + a98*k8[i]);

  rk_level = 9;
  Gradient(yy1, u_pop, u_ofs, k9, u_popgrad9, u_ofsgrad9, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a101*k1[i] + a104*k4[i] + a105*k5[i] + a106*k6[i] +
			  a107*k7[i] + a108*k8[i] + a109*k9[i]);

  rk_level = 10;
  Gradient(yy1, u_pop, u_ofs, k10, u_popgrad10, u_ofsgrad10, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a111*k1[i] + a114*k4[i] + a115*k5[i] + a116*k6[i] +
			  a117*k7[i] + a118*k8[i] + a119*k9[i] + a1110*k10[i]);

  rk_level = 11;
  Gradient(yy1, u_pop, u_ofs, k2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i = 0; i < SystemSize; i++)
    yy1[i] = y[i] + dt * (a121*k1[i] + a124*k4[i] + a125*k5[i] + a126*k6[i] +
			  a127*k7[i] + a128*k8[i] + a129*k9[i] +
			  a1210*k10[i] + a1211*k2[i]);

  rk_level = 12;
  Gradient(yy1, u_pop, u_ofs, k3, u_popgrad3, u_ofsgrad3, bpoints);

  for (i = 0; i < SystemSize; i++)
    {
      k4[i] = (b1*k1[i] + b6*k6[i] + b7*k7[i] + b8*k8[i] + b9*k9[i] +
	       b10*k10[i] + b11*k2[i] + b12*k3[i]);
      k5[i] = y[i] + dt * k4[i];
    }

  return;
} /* dopri8 */




/*==============================================================================*/
#if (EVENT_NR > 0)

static double 	delvalue(double theta, int eventindex)

{
  register int		i;
  double   		theta1, result[EVENT_NR];

  theta1 = 1.0 - theta;

  for (i = 0; i < SystemSize; i++)
    yco[i] = rcont1[i] +
      theta*(rcont2[i] +
	     theta1*(rcont3[i] +
		     theta*(rcont4[i] +
			    theta1*(rcont5[i] +
				    theta*(rcont6[i] +
					   theta1*(rcont7[i] +
						   theta*rcont8[i]))))));

  for (i=0; i<EVENT_NR; i++) result[i] = NO_EVENT;
  EventLocation(yco, c_pop, c_ofs, bpoints, result);
  
  return result[eventindex];
}




/*==============================================================================*/
#define ITMAX		500
#define EPS		1.0e-16

static double	zbrent(double olddel, double newdel, int eventindex)

{
  int			iter;
  double		a, b, c = 0.0, d = 0.0, e = 0.0, min1, min2;
  double		fa, fb, fc, p, q, r, s, tol1, xm;

  a = 0.0; fa=olddel;
  b = 1.0; fb=newdel;

  if (fb*fa > 0.0)
    {
      Warning(ZBB);
      return -1.0;
    }

  fc = fb;
  for (iter=0; iter<ITMAX; iter++)
    {
      if (fb*fc > 0.0)
	{
	  c = a; fc=fa;
	  e = d = b-a;
	}
      if (fabs(fc) < fabs(fb))
	{
	  a = b; fa = fb;
	  b = c; fb = fc;
	  c = a; fc = fa;
	}
      tol1 = 2.0*EPS*fabs(b)+0.5*identical_zero;
      xm = 0.5*(c-b);

      if ((fabs(xm) <= tol1 && fb*fc <=0.0) || fb == 0.0) return b;

      if (fabs(e) >= tol1 && fabs(fa) > fabs(fb))
	{
	  s = fb/fa;
	  if (a == c)
	    {
	      p=2.0*xm*s;
	      q=1.0-s;
	    }
	  else
	    {
	      q = fa/fc;
	      r = fb/fc;
	      p = s*(2.0*xm*q*(q-r)-(b-a)*(r-1.0));
	      q = (q-1.0)*(r-1.0)*(s-1.0);
	    }
	  if (p > 0.0) q = -q;
	  p = fabs(p);
	  min1 = 3.0*xm*q-fabs(tol1*q);
	  min2 = fabs(e*q);
	  if (2.0*p < (min1 < min2 ? min1 : min2))
	    {
	      e = d;
	      d = p/q;
	    }
	  else
	    {
	      d = xm;
	      e = d;
	    }
	}
      else
	{
	  d = xm;
	  e = d;
	}
      a = b; fa = fb;
      if (fabs(d) > tol1) b += d;
      else b += (xm > 0.0 ? fabs(tol1) : -fabs(tol1));
      fb = delvalue(b, eventindex);
    }
  Warning(ZBM);

  return -1.0;
}



#undef ITMAX
#undef EPS

/*===========================================================================*/

static void	LocateEvent(double prev_dt, int *doloc, int *located)

  /* 
   * LocateEvent - This routine is called to locate the events that are
   *		   triggered by the user-defined routine EventLocation()
   *	           It is assumed that on entrance to this routine, the array
   *		   doloc[] flags which events to locate, i.e. for which
   *		   event indicator oldELvalue[] and newELvalue[] have sound
   *		   values, i.e. both non-zero and their product negative.
   */

{
  register int		i;
  int			index = -1;
  double		new_dt, level;
  double		stepfrac[EVENT_NR], smallest = 2.0;

  for (i=0; i<EVENT_NR; i++)
    {
      located[i] = 0;
      if (doloc[i])
	{
	  stepfrac[i] = zbrent(oldELvalue[i], newELvalue[i], i);
	  if ((stepfrac[i] < 0.0) || (stepfrac[i] > 1.0))
	    {
	      if (EBTDEBUG(1))
		{
		  (void)fprintf(dbgfil, "Problem locating event %d at T = %15.8f",
				i, yy1[0]);
		  (void)fprintf(dbgfil,	"  Start = %12.7E", oldELvalue[i]);
		  (void)fprintf(dbgfil,	"  Stop = %12.7E", newELvalue[i]);
		  (void)fprintf(dbgfil,	"  dt old = %12.7E", prev_dt);
		  (void)fprintf(dbgfil,	"  dt new = %12.7E\n", stepfrac[i]*prev_dt);
		  fflush(dbgfil);
		}
	    }
	  else if (stepfrac[i] < smallest)
	    {
	      smallest = stepfrac[i];
	      index = i;
	    }
	}
    }

  if (index < 0)
    {
      (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
      return;
    }
  
  new_dt = prev_dt*stepfrac[index];
  if (new_dt == 0.0)
    (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)y, SystemSize*sizeof(double));
  else
    {						/* Use the continuous output*/
      double		theta, theta1;		/* state to continue        */
      
      theta = stepfrac[index];
      theta1 = 1.0 - theta;
      
      for (i = 0; i < SystemSize; i++)
	yy1[i] = rcont1[i] +
	  theta*(rcont2[i] +
		 theta1*(rcont3[i] +
			 theta*(rcont4[i] +
				theta1*(rcont5[i] +
					theta*(rcont6[i] +
					       theta1*(rcont7[i] +
						       theta*rcont8[i]))))));
    }
  
  located[index] = 1;
  LocatedEvent = index;
  
  for (i=0; i<EVENT_NR; i++) newELvalue[i] = NO_EVENT;
  EventLocation(yy1, u_pop, u_ofs, bpoints, newELvalue);

  equal2zero = max(identical_zero,
		   pow(10, ceil(log10(fabs(newELvalue[index]) + ABS_ERR))));

  cohort_end = ForceCohortEnd(yy1, u_pop, u_ofs, bpoints);

  if (EBTDEBUG(1))				/* Report performance if    */
    {						/* required by user         */
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "%-14s%3d: T = %15.8f     dt = %12.7E\n",
		  "Step to event", index, env[0], new_dt);
	  fflush(dbgfil);
	}
  
      if (EBTDEBUG(2) ||
	  (EBTDEBUG(1) && (fabs(newELvalue[index]) >= identical_zero)))
	{
	  if (cohort_end)
	    (void)fprintf(dbgfil, "%-18s T = %15.8f",
			  "Cohort closed:", yy1[0]);
	  else
	    (void)fprintf(dbgfil, "%-18s T = %15.8f",
			  "Event located:", yy1[0]);
	  (void)fprintf(dbgfil, "  Value = %12.7E", newELvalue[index]);
	  if (fabs(newELvalue[index]) >= identical_zero)
	    {
	      (void)fprintf(dbgfil, " ");
	      level = (ceil(log10(fabs(newELvalue[index])/identical_zero))-
		       identical_zero);
	      for (i=0; i<level; i++) (void)fprintf(dbgfil, "*");
	    }
	  (void)fprintf(dbgfil, "\n");
	  (void)fflush(dbgfil);
	}
    }

  return;
} /* LocateEvent */
#endif /* EVENT_NR > 0 */



/*==============================================================================*/

static void	  IntermediateState(double theta)

  /* 
   * IntermediateState - Routine computes the state of the system at an
   *			 intermediate time point by interpolation. 
   *			 Values are stored in basic data copy for further use
   *			 in output routines.
   */
  
{
  register int		i;
  double   		theta1;

  theta1 = 1.0 - theta;

  for (i = 0; i < SystemSize; i++)
    yco[i] = rcont1[i] +
      theta*(rcont2[i] +
	     theta1*(rcont3[i] +
		     theta*(rcont4[i] +
			    theta1*(rcont5[i] +
				    theta*(rcont6[i] +
					   theta1*(rcont7[i] +
						   theta*rcont8[i]))))));

  (void)memcpy((DEF_TYPE *)env, (DEF_TYPE *)yco, ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
  register int		j, k;
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)pop[i], (DEF_TYPE *)(yco+len),
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      len += (table_size[i]*COHORT_SIZE);
    }

  for(i=0; i<POPULATION_NR; i++)
    {
      for(j=0; j<BpointNo[i]; j++)
	{
	  if(ofs[i][j][number] > 0)
	    {
	      for(k=1; k<COHORT_SIZE; k++)
		ofs[i][j][k] /= ofs[i][j][number];
	    }
	  for(k=1; k<COHORT_SIZE; k++)
	    ofs[i][j][k] += bpoints[i][j][k];
	}
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==============================================================================*/

double	  IntegrationStep(double del_tim, double del_max, int recurs)

  /* 
   * IntegrationStep - Performs an integration with adaptable step size but 
   *                   maximum "del_max". Step size control and event
   *                   location as implemented by <NAME> & <NAME>.
   */
  
{
  register int		i;
  double		del_h;
  double		err, err2, erri, sk, sqr, deno;
  double		fac, fac11, hnew;
  double		ydiff, bspl;
  double		stnum, stden;
  int			adjust = 1, events = 0, intermediate = 0;
#if (EVENT_NR > 0)
  int			dolocation[EVENT_NR];
#endif

  del_h = del_tim;				/* Adjust stepsize to hit   */
  if(del_max < (2*del_tim))			/* cohort end, look ahead   */
    {						/* two steps to avoid too   */
      del_h = 0.5*del_max;			/* drastic step changes	    */
      if(del_max < del_tim) del_h = del_max;
      adjust = 0;
    }
  if(del_h < SMALLEST_STEP)
    {
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      ErrorExit(0, SSS);
    }
  recur_no = recurs;
  LocatedEvent = -1;

  if (EBTDEBUG(4))
    {
      fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
	      "Starting step:", env[0], del_h, recurs);
      fflush(dbgfil);
    }

  dopri8(del_h);				/* Do an integration step   */

  err  = 0.0;					/* error estimation         */
  err2 = 0.0;
  for (i = 0; i < SystemSize; i++)
    {
      sk    = ABS_ERR + accuracy * max (fabs(y[i]), fabs(k5[i]));
      erri  = k4[i] - bhh1*k1[i] - bhh2*k9[i] - bhh3*k3[i];
      sqr   = erri / sk;
      err2 += sqr*sqr;
      erri  = (er1*k1[i] + er6*k6[i] + er7*k7[i] + er8*k8[i] + er9*k9[i] +
	       er10 * k10[i] + er11*k2[i] + er12*k3[i]);
      sqr   = erri / sk;
      err  += sqr*sqr;
    }
  deno = err + 0.01 * err2;
  if (deno <= 0.0) deno = 1.0;
  err  = fabs(del_h) * err * sqrt (1.0 / (deno*(double)SystemSize));

  if (err > 1.0)				/* Step rejected            */
    {
      if (EBTDEBUG(3))
	{
	  fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
		  "Step failed:", env[0], del_h, recur_no);
	  fflush(dbgfil);
	}

      /*
       * If bigger than accuracy take smaller step and restart
       */
      recur_no++; step_failed=1;
      if (recur_no > 25)
	{
#if (POPULATION_NR > 0)
	  TransBcohorts();
#endif // (POPULATION_NR > 0)
	  ErrorExit(0, REC);
	}

      fac11  = pow (err, 0.125 - BETA * 0.2);
      del_h /= min (FACC1, fac11/SAFETY);

      step_size = del_h;
      del_h  = IntegrationStep(del_h, del_max, recur_no);
    }
  else						/* Step accepted            */
    {
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "%-18s T = %15.8f     dt = %12.7E recurs = %2d\n",
		  "Step OK:", env[0], del_h, recur_no);
	  fflush(dbgfil);
	}

      /*
       * Step size adjustment using Lund-stabilization: we require
       * 		fac1 <=  hnew/h <= fac2
       * No increase if failed just before
       */
      if (adjust && !step_failed)
	{
	  fac11  = pow (err, 0.125 - BETA * 0.2);
	  fac    = fac11/pow(facold, BETA);
	  fac    = max(FACC2, min(FACC1, fac/SAFETY));
	  hnew   = del_h / fac;
	  facold = max (err, FACOLD);

	  step_size = min(hnew, cohort_limit);
	  step_size = min(step_size, LARGEST_STEP);
	}
      step_failed=0;
      accepted_steps++;

      rk_level = 13;
      Gradient(k5, u_popgrad5, u_ofsgrad5, k4, u_popgrad4, u_ofsgrad4, bpoints);
      
      if (EBTDEBUG(1))
	{
	  /*
	   * Do some stiffness detection at regular intervals
	   */
	  if (!(accepted_steps % NSTIFF) || (iasti > 0))
	    {
	      stnum = 0.0;
	      stden = 0.0;
	      for (i = 0; i < SystemSize; i++)
		{
		  sqr    = k4[i] - k3[i];
		  stnum += sqr*sqr;
		  sqr    = k5[i] - yy1[i];
		  stden += sqr*sqr;
		}
	      if (stden > 0.0)
		hlamb = del_h * sqrt (stnum / stden);
	      if (hlamb > 6.1)
		{
		  nonsti = 0;
		  iasti++;
		  if (iasti == 15)
		    (void)fprintf(dbgfil,
				  "The problem is becoming stiff at T = %.4f\n",
				  env[0]);
		}
	      else
		{
		  nonsti++;
		  if (nonsti == 6) iasti = 0;
		}
	    }
	}

      /* 
       * Location of events: If located in previous and no change in ELvalue do
       * not locate.
       * WARNING: The order of these statements seems odd but is OK! What is
       * 	  checked is whether the newELvalue from before cohort closure
       *	  equals the value computed at the beginning of this time
       *	  integration step!
       */
#if (EVENT_NR > 0)
      for(i=0; i<EVENT_NR; i++)
	{
	  dolocation[i] = 1;
	  if (located[i] && isequal(oldELvalue[i], newELvalue[i]))
	    dolocation[i] = 0;
	}
      
      for (i=0; i<EVENT_NR; i++) newELvalue[i] = NO_EVENT;
      EventLocation(yy1, u_pop, u_ofs, bpoints, newELvalue);

      for(i=0, events=0; i<EVENT_NR; i++)
	{
	  if (((oldELvalue[i] < 0.0) && (newELvalue[i] < 0.0)) ||
	      ((oldELvalue[i] > 0.0) && (newELvalue[i] > 0.0)))
	    dolocation[i] = 0;
	  if (dolocation[i]) events++;
	}
#endif

      intermediate = ((next_output < (yy1[0]-identical_zero)) ||
		      ((state_out > 0.0) &&
		       (next_state_output < (yy1[0]-identical_zero))));

      if (events || intermediate)
	{
	  /*
	   * Update variables for event location and continuous output
	   * only in really necessary (4 more function evalutions)!
	   */
	  for (i = 0; i < SystemSize; i++)
	    {
	      rcont1[i] = y[i];
	      ydiff     = k5[i] - y[i];
	      rcont2[i] = ydiff;
	      bspl      = del_h * k1[i] - ydiff;
	      rcont3[i] = bspl;
	      rcont4[i] = ydiff - del_h*k4[i] - bspl;
	      rcont5[i] = (d41*k1[i] + d46*k6[i] + d47*k7[i] + d48*k8[i] +
			   d49*k9[i] + d410*k10[i] + d411*k2[i] + d412*k3[i]);
	      rcont6[i] = (d51*k1[i] + d56*k6[i] + d57*k7[i] + d58*k8[i] +
			   d59*k9[i] + d510*k10[i] + d511*k2[i] + d512*k3[i]);
	      rcont7[i] = (d61*k1[i] + d66*k6[i] + d67*k7[i] + d68*k8[i] +
			   d69*k9[i] + d610*k10[i] + d611*k2[i] + d612*k3[i]);
	      rcont8[i] = (d71*k1[i] + d76*k6[i] + d77*k7[i] + d78*k8[i] +
			   d79*k9[i] + d710*k10[i] + d711*k2[i] + d712*k3[i]);
	    }
	  for (i = 0; i < SystemSize; i++)
	    yy1[i] = y[i] + del_h * (a141*k1[i] + a147*k7[i] + a148*k8[i] +
				     a149*k9[i] + a1410*k10[i] + a1411*k2[i] +
				     a1412*k3[i] + a1413*k4[i]);

	  rk_level = 14;
	  Gradient(yy1, u_pop, u_ofs, k10, u_popgrad10, u_ofsgrad10, bpoints);

	  for (i = 0; i < SystemSize; i++)
	    yy1[i] = y[i] + del_h * (a151*k1[i]  + a156*k6[i]  + a157*k7[i]  + 
				     a158*k8[i]  + a1511*k2[i] + a1512*k3[i] +
				     a1513*k4[i] + a1514*k10[i]);
	  rk_level = 15;
	  Gradient(yy1, u_pop, u_ofs, k2, u_popgrad2, u_ofsgrad2, bpoints);

	  for (i = 0; i < SystemSize; i++)
	    yy1[i] = y[i] + del_h * (a161*k1[i] + a166*k6[i] + a167*k7[i] +
				     a168*k8[i] + a169*k9[i] + a1613*k4[i] +
				     a1614*k10[i] + a1615*k2[i]);
	  rk_level = 16;
	  Gradient(yy1, u_pop, u_ofs, k3, u_popgrad3, u_ofsgrad3, bpoints);

	  /* final preparation */
	  for (i = 0; i < SystemSize; i++)
	    {
	      rcont5[i] = del_h * (rcont5[i] + d413*k4[i] + d414*k10[i] +
				   d415*k2[i] + d416*k3[i]);
	      rcont6[i] = del_h * (rcont6[i] + d513*k4[i] + d514*k10[i] +
				   d515*k2[i] + d516*k3[i]);
	      rcont7[i] = del_h * (rcont7[i] + d613*k4[i] + d614*k10[i] +
				   d615*k2[i] + d616*k3[i]);
	      rcont8[i] = del_h * (rcont8[i] + d713*k4[i] + d714*k10[i] +
				   d715*k2[i] + d716*k3[i]);
	    }
	}

      (void)memcpy((DEF_TYPE *)yy1,(DEF_TYPE *)k5, SystemSize*sizeof(double));

#if (EVENT_NR > 0)
      if (events) LocateEvent(del_h, dolocation, located);
      else for(i=0; i<EVENT_NR; i++) located[i] = 0;
#endif

      /*
       * Produce intermediate output and state output if requested
       */
      if (intermediate)
	{
#if (POPULATION_NR > 0)
	  for(i=0; i<POPULATION_NR; i++) CohortNo[i] += BpointNo[i];
#endif // (POPULATION_NR > 0)
	  while (next_output < (yy1[0]-identical_zero))
	    {
	      IntermediateState((next_output-y[0])/del_h);
	      FileOut();
	      next_output += delt_out;
	    }
#if (POPULATION_NR > 0)
	  while ((state_out > 0.0) && (next_state_output < (yy1[0]-identical_zero)))
	    {
	      IntermediateState((next_state_output-y[0])/del_h);
	      FileState();
	      next_state_output += state_out;
	    }
	  for(i=0; i<POPULATION_NR; i++) CohortNo[i] -= BpointNo[i];
	  for(i=0; i<POPULATION_NR; i++) cohort_no[i] = CohortNo[i];
#endif // (POPULATION_NR > 0)
	}
      
      /*
       * Update the basic data copy, and the local copy 
       */
      (void)memcpy((DEF_TYPE *)env, (DEF_TYPE *)yy1, ENVIRON_DIM*sizeof(double));
#if (POPULATION_NR > 0)
      int			len;

      len = ENVIRON_DIM;
      for(i=0; i<POPULATION_NR; i++)
	{
	  (void)memcpy((DEF_TYPE *)pop[i], (DEF_TYPE *)(yy1+len),
		       (table_size[i]*COHORT_SIZE)*sizeof(double));
	  len += (table_size[i]*COHORT_SIZE);
	}
#endif // (POPULATION_NR > 0)

      (void)memcpy((DEF_TYPE *)y, (DEF_TYPE *)yy1, SystemSize*sizeof(double));
    }

  return del_h;
}



/*==========================================================================*/


<|start_filename|>lib/regr/html/plsurv.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>plsurv</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="plsurv.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">Description</a></li><li><a href="#3">Input</a></li><li><a href="#4">Output</a></li><li><a href="#5">Remarks</a></li><li><a href="#6">Example of use</a></li><li><a href="#7">Code</a></li><li><a href="#8">set numer of parameter evaluations</a></li><li><a href="#9">number of par evaluations in branch 1</a></li><li><a href="#10">fill prof-lik matrix at target value</a></li><li><a href="#11">fill prof-lik matrix from par-value to lower boundary: branch 1</a></li><li><a href="#12">fill prof-lik matrix from par-value to upper boundary: branch 2</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [proflik, info] = plsurv(func, p, <span class="keyword">...</span><span class="comment">)</span>
  <span class="comment">%  created: 2002/02/08 by <NAME></span>
  <span class="comment">%</span>
</pre><h2>Description<a name="2"></a></h2><pre>Calculates the profile likelihood function for a parameter that is indicated with code 2 in the second column of the parameter matrix.
The other parameters with positive codes are ml-estimated using the simplex method for each evaluation of the target parameter.</pre><h2>Input<a name="3"></a></h2><pre>func: string with name of user-defined function
   f = func (p, t, y) with p: np-vector; t: nt-vector; y: ny-vector
   f: (nt,ny)-matrix with model-predictions for surviving numbers
p: (np,2) matrix with
   p(:,1) parameter values
   p(:,2) codes for what to do with the parameters
     &lt;=0: keep it fixed
    &gt;0: iterate (so estimate the corresponding parameter)
     2: construct likelihood profile for this parameter
tni (read as tn1, tn2, .. ): (ni,2) matrix with
   tni(:,1) time: must be increasing with rows
   tni(:,2) number of survivors: must be non-increasing with rows
   tni(:,3, 4, ... ) data-pont specific information data (optional)
   The number of data matrices tn1, tn2, ... is optional but &gt;0
range: 2 or 3 -vector with lower and upper boundaries of
   the parameter that is indicated with code 2 in p(:,2)
   the value of the selected parameter must be within the range
 optional element 3 of the range vector is the number of parameter
   evaluations, like in linspace; default: 100.
 the last argument is interpreted as the range</pre><h2>Output<a name="4"></a></h2><pre>proflik: (99,2) matrix with par-values, and deviances
info: 1 if convergence has been successful; 0 otherwise</pre><h2>Remarks<a name="5"></a></h2><pre>set options with 'nmsurv_options'
uses user-defined function 'func' and nmsurv2
See plsurv2 for response surfaces.</pre><h2>Example of use<a name="6"></a></h2><pre>assuming that function_name, pars, tn1 (and possibly more data matrices) and Range are defined properly:
plsurv('function_name', pars, tn1, tn2, ..., Range).</pre><h2>Code<a name="7"></a></h2><pre class="codeinput">  i = 1; <span class="comment">% initiate data set counter</span>
  ci = num2str(i); <span class="comment">% character string with value of i</span>
  nntn = nargin -1; <span class="comment">% initial 'while' condition (will count down)</span>
  ntn = nntn -1; <span class="comment">% number of data sets</span>
  va_start (); <span class="comment">% set pointer to first unnamed argument</span>
  <span class="keyword">while</span> (--nntn) <span class="comment">% loop across data sets</span>
    eval([<span class="string">'tn'</span>, ci, <span class="string">' = va_arg();'</span>]); <span class="comment">% assing unnamed arguments to tni</span>
    <span class="keyword">if</span> i == 1
      listtn = [<span class="string">'tn'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list tn</span>
    <span class="keyword">elseif</span> i == nntn
      range = va_arg();
    <span class="keyword">else</span>
      listtn = [listtn, <span class="string">' tn'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list tn</span>
    <span class="keyword">end</span>
    i++;
    ci = num2str(i); <span class="comment">% character string with value of i</span>
  <span class="keyword">end</span>

  [i nl] = size(listtn); listtn = listtn(1:(nl-1)); <span class="comment">% remove last ','</span>


  [np k] = size(p); <span class="comment">% np is number of parameters</span>
  index = 1:np; <span class="comment">% indices of parameters</span>
  <span class="keyword">if</span> k &lt;= 1
    printf(<span class="string">'codes for parameters are missing\n'</span>);
    <span class="keyword">return</span>
  <span class="keyword">else</span>
    par_nr = index(2 == p(:,2)); <span class="comment">% index of parameter for prof likelihood</span>
  <span class="keyword">end</span>
  <span class="keyword">if</span> 1 ~= prod(size(par_nr))
    printf(<span class="string">'codes for parameters are invalid\n'</span>);
    <span class="keyword">return</span>
  <span class="keyword">end</span>

  p(par_nr,2) = 0; <span class="comment">% fix target parameter</span>
  par = p; <span class="comment">% make copy of par matrix</span>
</pre><h2>set numer of parameter evaluations<a name="8"></a></h2><pre class="codeinput">  <span class="keyword">if</span> max(size(range)) &gt; 2
    npar = range(3);
  <span class="keyword">else</span>
    npar = 100;
  <span class="keyword">end</span>
</pre><h2>number of par evaluations in branch 1<a name="9"></a></h2><pre class="codeinput">  nbr1 = floor(npar * (p(par_nr,1) - range(1))/(range(2)- range(1)));

  <span class="keyword">if</span> (nbr1&lt;1) | (nbr1&gt;npar) <span class="comment">% check range relative to par value</span>
    printf(<span class="string">'selected parameter not within range\n'</span>)
    <span class="keyword">return</span>
  <span class="keyword">end</span>

  br1 = linspace(p(par_nr,1), range(1), nbr1); <span class="comment">% branch 1 par values</span>
  br2 = linspace(p(par_nr,1), range(2), npar-nbr1); <span class="comment">% branch 2 par values</span>

  nmregr_options(<span class="string">'report'</span>,0); <span class="comment">% nmsurv2 must be silent</span>
  info = 1; <span class="comment">% succesful convergence</span>

  proflik = zeros(npar-1,2); <span class="comment">% initiate prof-lik matrix</span>
</pre><h2>fill prof-lik matrix at target value<a name="10"></a></h2><pre class="codeinput">  eval([<span class="string">'proflik(nbr1,:) = [p(par_nr,1), dev('''</span>, func, <span class="string">''', p, '</span>, <span class="keyword">...</span>
	listtn, <span class="string">')];'</span>]);
</pre><h2>fill prof-lik matrix from par-value to lower boundary: branch 1<a name="11"></a></h2><pre class="codeinput">  dp = br1(1) - br1(2); <span class="comment">% increment for par-value (positive)</span>
  <span class="keyword">for</span> i = 2:nbr1
    p(par_nr,1) = p(par_nr,1) - dp; <span class="comment">% set new par value</span>
    eval([<span class="string">'[p, infp]= nmsurv('''</span>, func, <span class="string">''', p, '</span>, listtn, <span class="keyword">...</span>
	  <span class="string">');'</span>]); <span class="comment">% get estimates</span>
    info = info*infp;
    eval([<span class="string">'d = dev('''</span>, func, <span class="string">''', p, '</span>, listtn, <span class="keyword">...</span>
	  <span class="string">');'</span>]); <span class="comment">% get deviance</span>
    proflik(nbr1-i+1,:) = [p(par_nr,1), d]; <span class="comment">% fill prof-lik matrix</span>
  <span class="keyword">end</span>
</pre><h2>fill prof-lik matrix from par-value to upper boundary: branch 2<a name="12"></a></h2><pre class="codeinput">  dp = br2(2) - br2(1); <span class="comment">% increment for par-value (positive)</span>
  p = par; <span class="comment">% restore original parameter value for second branch</span>
  <span class="keyword">for</span> i = 2:(npar-nbr1)
    p(par_nr,1) = p(par_nr,1) + dp;  <span class="comment">% set new par value</span>
    eval([<span class="string">'[p, infp]= nmsurv('''</span>, func, <span class="string">''', p, '</span>, listtn, <span class="keyword">...</span>
	  <span class="string">');'</span>]); <span class="comment">% get estimates</span>
    info = info*infp;
    eval([<span class="string">'d = dev('''</span>, func, <span class="string">''', p, '</span>, listtn, <span class="keyword">...</span>
	  <span class="string">');'</span>]); <span class="comment">% get deviance</span>
    proflik(nbr1+i-1,:) = [p(par_nr,1), d]; <span class="comment">% fill prof-lik matrix</span>
  <span class="keyword">end</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [proflik, info] = plsurv(func, p, ...)
  %  created: 2002/02/08 by <NAME>
  %
  %% Description
  %  Calculates the profile likelihood function for a parameter that is indicated with code 2 in the second column of the parameter matrix. 
  %  The other parameters with positive codes are ml-estimated using the simplex method for each evaluation of the target parameter. 
  %
  %% Input
  %  func: string with name of user-defined function
  %     f = func (p, t, y) with p: np-vector; t: nt-vector; y: ny-vector
  %     f: (nt,ny)-matrix with model-predictions for surviving numbers
  %  p: (np,2) matrix with
  %     p(:,1) parameter values
  %     p(:,2) codes for what to do with the parameters
  %       <=0: keep it fixed
  %      >0: iterate (so estimate the corresponding parameter)
  %       2: construct likelihood profile for this parameter 
  %  tni (read as tn1, tn2, .. ): (ni,2) matrix with
  %     tni(:,1) time: must be increasing with rows
  %     tni(:,2) number of survivors: must be non-increasing with rows
  %     tni(:,3, 4, ... ) data-pont specific information data (optional)
  %     The number of data matrices tn1, tn2, ... is optional but >0
  %  range: 2 or 3 -vector with lower and upper boundaries of
  %     the parameter that is indicated with code 2 in p(:,2)
  %     the value of the selected parameter must be within the range
  %   optional element 3 of the range vector is the number of parameter
  %     evaluations, like in linspace; default: 100.
  %   the last argument is interpreted as the range
  %
  %% Output
  %  proflik: (99,2) matrix with par-values, and deviances
  %  info: 1 if convergence has been successful; 0 otherwise
  %
  %% Remarks
  %  set options with 'nmsurv_options'
  %  uses user-defined function 'func' and nmsurv2
  %  See plsurv2 for response surfaces. 
  %
  %% Example of use
  %  assuming that function_name, pars, tn1 (and possibly more data matrices) and Range are defined properly: 
  %  plsurv('function_name', pars, tn1, tn2, ..., Range). 
  
  %% Code
  i = 1; % initiate data set counter
  ci = num2str(i); % character string with value of i
  nntn = nargin -1; % initial 'while' condition (will count down)
  ntn = nntn -1; % number of data sets
  va_start (); % set pointer to first unnamed argument
  while (REPLACE_WITH_DASH_DASHnntn) % loop across data sets
    eval(['tn', ci, ' = va_arg();']); % assing unnamed arguments to tni
    if i == 1
      listtn = ['tn', ci,',']; % initiate list tn
    elseif i == nntn
      range = va_arg();
    else     
      listtn = [listtn, ' tn', ci,',']; % append list tn
    end
    i++;
    ci = num2str(i); % character string with value of i
  end

  [i nl] = size(listtn); listtn = listtn(1:(nl-1)); % remove last ','


  [np k] = size(p); % np is number of parameters
  index = 1:np; % indices of parameters
  if k <= 1
    printf('codes for parameters are missing\n');
    return
  else
    par_nr = index(2 == p(:,2)); % index of parameter for prof likelihood
  end
  if 1 ~= prod(size(par_nr))
    printf('codes for parameters are invalid\n');
    return
  end

  p(par_nr,2) = 0; % fix target parameter
  par = p; % make copy of par matrix
  %% set numer of parameter evaluations
  if max(size(range)) > 2
    npar = range(3);
  else
    npar = 100;
  end
  
  %% number of par evaluations in branch 1
  nbr1 = floor(npar * (p(par_nr,1) - range(1))/(range(2)- range(1)));

  if (nbr1<1) | (nbr1>npar) % check range relative to par value
    printf('selected parameter not within range\n')
    return
  end
  
  br1 = linspace(p(par_nr,1), range(1), nbr1); % branch 1 par values
  br2 = linspace(p(par_nr,1), range(2), npar-nbr1); % branch 2 par values

  nmregr_options('report',0); % nmsurv2 must be silent
  info = 1; % succesful convergence
  
  proflik = zeros(npar-1,2); % initiate prof-lik matrix

  %% fill prof-lik matrix at target value
  eval(['proflik(nbr1,:) = [p(par_nr,1), dev(''', func, ''', p, ', ...
	listtn, ')];']);

  %% fill prof-lik matrix from par-value to lower boundary: branch 1
  dp = br1(1) - br1(2); % increment for par-value (positive)
  for i = 2:nbr1
    p(par_nr,1) = p(par_nr,1) - dp; % set new par value
    eval(['[p, infp]= nmsurv(''', func, ''', p, ', listtn, ...
	  ');']); % get estimates
    info = info*infp;
    eval(['d = dev(''', func, ''', p, ', listtn, ...
	  ');']); % get deviance
    proflik(nbr1-i+1,:) = [p(par_nr,1), d]; % fill prof-lik matrix
  end

  %% fill prof-lik matrix from par-value to upper boundary: branch 2
  dp = br2(2) - br2(1); % increment for par-value (positive)
  p = par; % restore original parameter value for second branch
  for i = 2:(npar-nbr1)
    p(par_nr,1) = p(par_nr,1) + dp;  % set new par value
    eval(['[p, infp]= nmsurv(''', func, ''', p, ', listtn, ...
	  ');']); % get estimates
    info = info*infp;
    eval(['d = dev(''', func, ''', p, ', listtn, ...
	  ');']); % get deviance
    proflik(nbr1+i-1,:) = [p(par_nr,1), d]; % fill prof-lik matrix    
  end
##### SOURCE END #####
--></body></html>

<|start_filename|>docs/first_e.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>
    First steps in Emacs
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="Emacs" >

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>First steps in Emacs</H1>

<P ALIGN="center"> by <A HREF="mailto:<EMAIL>"><NAME></A>,
5 April 2002


<h2>Purpose</h2> 
 
This note is meant to give a quick introduction to <a
HREF="http://www.gnu.org/manual/emacs/" TARGET="_top"> Emacs</a>
(Editor MACroS), which is an extensible, customizable editor and
computing environment. It offers true Lisp--smoothly integrated into
the editor--for writing extensions and provides an interface to the X
Window System. At its core is an interpreter for Emacs Lisp
(``elisp'', for short), a dialect of the Lisp programming language
with extensions to support text editing.

<p>
Emacs runs under a.o. Windows and Unix; it recognizes and preserves
both ways of breaking lines (carriage return + line feed in Windows,
line feed only in Unix).

<p>
The sources <a
href="http://www.columbia.edu/acis/tutor/tutor/editors/emacs/basic-use.html">
basic use</a> and <a href=
"http://fd-doc.sourceforge.net/mini/en/emacs/quickie.txt">
quickie</a> are used for this note. 

<h2>Notation</h2>

<table>
<tr>
  <td><code>enter</code></td>       
  <td>carriage return, including the spaces around the word; so <code>4 
      enter</code> means press "4" then "enter" (skip space)</td>
</tr><tr>
  <td><code>C-</code></td>       
  <td>A control character.  <code>C-f</code> means "control then f" 
      (pressed simultaneously).  
      <code>C-_</code> means "control then underscore" (which is undo!)</td>
</tr><tr>
  <td><code>M-</code></td>
  <td>A two-character command sequence where the first character is
      Altmode (which is entered by ESCAPE).  
      <code>M-f</code> means "ESCAPE then f" (pressed simultaneously)</td>
</tr><tr>
  <td><code>F1</code></td>
  <td>Press function-key "F1"</td>
</tr><tr>
  <td>kill</td>
  <td>means delete and paste to clipboard (cut)</td>
</tr><tr>
  <td>yank</td>
  <td>means copy from clipboard (paste)</td>
</tr>

</table>

<h2>Basic use of Emacs</h2>
 
To start editing a new buffer (i.e. temporary file) with Emacs type:<br>
  >> $ <code>emacs</code><br>
at the UNIX prompt, or click on the Emacs-icon in Windows.

<p>
Once you are inside the Emacs window just begin to type your
text. Don't press <code>enter</code> at the end of each line, but
<code>M-q</code> at the end of a paragraph for wrapping text (undo
wrapping with <code>C-_</code>). Anytime you enter an editing command
it will appear on the bottom left of your screen under the Emacs mode
bar.

<p>
Many functions can be assessed via the menu-bar, where key short cuts
are given.

<p>
To edit an existing file simply enter Emacs by typing
<br> 
  >> $<code> emacs</code>
<br>
and then type <code>C-x C-f</code> (find file). Emacs will then prompt
you for the name of the file to find and load it into the current
buffer (use the space bar for automatic completion of the file name).
 
<p>
You may also type
<br>
  >> $ <code>emacs foo.m</code>
<br>
and the Octave-file <code>foo.m</code> will automatically be copied
into Emacs' buffer when it starts up. Emacs can hold many buffers, to
wich you can switch and copy text from. Emacs can show its buffers
simultaneously in several windows (see Emacs' menu bar).

<p>
Emacs recognizes extentions and loads editing-support functions
automatically. The menu-bar depends on the extension. Here are some
examples:<br>

<table>
<tr>
  <td><code>test.m</code></td>          
  <td>a Octave source code file</td>
  <td><code>example.c</code></td>
  <td>a C source code file</td>
</tr>
<tr>
  <td><code>try.p</code></td>
  <td>a Pascal source code file</td>
  <td><code>hello.f</code></td>
  <td>a Fortran source code file</td>
</tr>
<tr>
  <td><code>letter.txt</code></td>
  <td>a simple text file</td>
  <td><code>paper.tex</code></td>
  <td>a Latex text file</td>
</tr>
<tr>
  <td><code>list.bib</code></td>
  <td>a Bibtex source file</td>
</tr>
</table>

<p>
File name extensions (<code>.txt</code>) are not required. Emacs
behaviour is coded in the <code>.emacs</code> or <code>_emacs</code>
file (Unix or Windows repectively), such as the cursor behaviour when
pressing "END". Octave and Latex support in Emacs require some special
lines in the <code>.emacs</code> file.

<p> 
<b>Warning:</b> Emacs looses all buffers upon exiting. You must
save buffers into files before exiting. Type <code>C-x C-s</code> to
save the file with the current file name or <code>C-x C-w</code> to
write the file with a new name.

<p>
If the file you just saved already existed, Emacs will not only save your
current file but also make a backup of the old file by giving it the same
name followed by a tilde (~) e.g. foo.m~

<p>
After you are done with Emacs you may type <code>C-x C-c</code> to
Exit Emacs.

<p> For more help go into Emacs and type <code>C-h t</code> for the
online tutorial. This opens a new buffer; come back to your old buffer
with <code>C-x b enter</code>.

  
<h2>Some Emacs commands</h2>

<h4>Getting out</h4>

<table>
<tr>
 <td><code>C-x C-s</code></td>
 <td>Write the current buffer into a new version of the current file name</td>
</tr><tr>
  <td><code>C-x C-w</code></td>
  <td>Write the current buffer into a file with a different name</td>
<tr></tr>
  <td><code>C-x C-c</code></td>
  <td>Finish by exiting to the exec</td>
</tr>
</table>

<h4>Buffer operations</h4>

<table>
<tr>
  <td><code>C-x C-f</code></td>
  <td>Get a file into a buffer for editing</td>
</tr><tr>
  <td><code>C-x i</code></td>
  <td>Insert a file at cursor</td>
</tr><tr>
  <td><code>C-x b</code></td>
  <td>Select a different buffer (prompts; default is the last one)</td>
</tr><tr>
  <td><code>C-x C-b</code></td>
  <td>Display the list of available buffers</td>
</tr><tr>
  <td><code>C-x k</code></td>
  <td>Kill a buffer (prompts for which one; default is current one)</td>
</tr><tr>
  <td><code>M-<</code></td>
  <td>Move to the top of the current buffer</td>
</tr><tr>
  <td><code>M-></code></td>
  <td>Move to the end of the current buffer</td>
</tr>
</table>

<h4>Help and helper functions</h4>

<table>
<tr>
  <td><code>C-g</code></td>
  <td>Abort anything at any time (it beeps, sometimes you need 2)</td>
</tr><tr>
  <td><code>C-_</code></td>
  <td>undo last change</td>
</tr><tr>
   <td><code>F1 A string</code></td> 
   <td>Show every command containing string (try <code>F1 A Paragr
       </code>)</td>
</tr><tr>
   <td><code>F1 c key</code></td>   
   <td>What does this key do? (try <code>F1 c C-k</code> as an example)</td>
</tr><tr>
   <td><code>F1 d string</code></td>
   <td>Describe a command (try <code>F1 d Query Rep</code>)</td>
</tr><tr>
   <td><code>C-x d</code></td>    
   <td>Directory editing subsystem; use "?" or "SPACE" to show possible 
       completions</td>
</tr><tr>
  <td><code>M-x string</code></td>
  <td>A command designated "by hand". <code>M-x undo</code> means
      "undo previous change". Use space bar for automized word completion 
      (alternatives are shown).</td>
</tr><tr>
   <td><code>C-d</code></td>      
   <td>Yank back the last thing killed </td>
</tr><tr>
   <td><code>M-n</code></td>
   <td>Provide a numeric argument of <code>n</code> for the command that 
       follows (<code>M-4 5</code> gives "5555"; <code>M-6 C-x e</code>
       executes pre-defined keyboard macro 6 times)</td>
</tr>
</table><table>
<tr>
  <td><code>C-x ( key-sequence C-x )</code></td>
  <td> Define key bindings (key-board macro) given in 
     <code>key-sequence</code>, 
     execute macro at cursor with <code>C-x e</code></td>
</table>

<h4>Character operations</h4>

<table>
<tr>
  <td><code>C-b</code></td>      
  <td>Move left (Back)</td>
</tr><tr>
  <td><code>C-f</code></td>      
  <td>Move right (Forward)</td>
</tr><tr>
  <td><code>C-p</code></td>      
  <td>Move up (Previous)</td>
</tr><tr>
  <td><code>C-n</code></td>
  <td>Move down (Next)</td>
</tr><tr>
  <td><code>BACKSPACE</code></td> 
  <td>Delete left</td>
</tr><tr>
  <td><code>C-d</code></td>      
  <td>Delete right</td>
</tr><tr>
  <td><code>C-t</code></td>      
  <td>Transpose previous 2 characters (ht -> th)</td>
</tr><tr>
   <td><code>C-q</code></td>      
   <td>Inserts a control character in the buffer,
       e.g. <code>C-q C-l</code> inserts character ^L, 
       <code>C-q n enter</code> inserts acsii character number 
       <code>n</code> (<A HREF="char.html">octal</A>); see 
       <A HREF="/thb/links/html40/">HTML-4.0</A></td>
</tr>
</table>

<h4>Word operations</h4>

<table>
<tr>
  <td><code>M-b</code></td>      
  <td>Move left (Back)</td>
</tr><tr>
  <td><code>M-f</code></td>      
  <td>Move right (Forward)</td>
</tr><tr>
  <td><code>M-BACKSPACE</code></td>
  <td>Kill left (<code>C-y</code> yanks it back at cursor)</td>
</tr><tr>
  <td><code>M-d</code></td>      
  <td>Kill right (<code>C-y</code> yanks it back at cursor)</td>
</tr><tr>
  <td><code>M-t</code></td>
  <td>Transpose 2 words around cursor (if only -> only if)</td>
</tr><tr>
  <td><code>M-c</code></td>      
  <td>Capitalize word</td>
</tr><tr>
  <td><code>M-u<code></td>      
  <td>Uppercase word</td>
</tr><tr>
  <td><code>M-l<code></td>      
  <td>Lowercase word</td>
</tr>
</table>

<h4>Line operations</h4>

<table>
</tr>
   <td><code>C-a</code></td>      
   <td>Move to the beginning</td>
</tr><tr>
   <td><code>C-e</code></td>      
   <td>Move to the end</td>
</tr><tr>
   <td><code>C-o</code></td>      
   <td>Open up a line for typing</td>
</tr><tr>
   <td><code>C-x C-o</code></td>  
   <td>Close up any blank lines around cursor</td>
</tr><tr>
   <td><code>M-0 C-k</code></td>  
   <td>Kill from beginning to cursor 
       (<code>C-y</code> yanks it back at cursor)</td>
</tr><tr>
   <td><code>C-k</code></td>      
   <td>Kill from cursor to end (<code>C-y</code> yanks it back at cursor)</td>
</tr><tr>
   <td><code>M-g</code></td>
   <td>Goto line number <code>n</code>, where the number is asked for</td>
</tr>
</table>

<h4>Paragraph operations</h4>

<table>
<tr>
   <td><code>C-x BACKSPACE</code></td> 
   <td>Kill from beginning to cursor (<code>C-y</code> yanks it back at cursor)</td>
</tr><tr>
   <td><code>M-k</code></td>      
   <td>Kill from cursor to end (<code>C-y</code> yanks it back at cursor)</td>
</tr><tr>
  <td><code>M-{</code></td>      
  <td>Move back to previous paragraph beginning</td>
</tr><tr>
  <td><code>M-}</code></td>      
  <td>Move to next paragraph end</td>
</tr><tr>
   <td><code>M-q</code></td>
   <td>Fill the current paragraph (undo with <code>C-_</code>)</td>
</tr><tr>
   <td><code>M-n C-x f</code></td>     
   <td>Set the fill column to n (e.g. <code>M-60 C-x f</code>; 
       default is 70)</td>
</tr>
</table>

<h4>Screen operations</h4>

<table>
<tr>
  <td><code>C-v</code></td>      
  <td>Show next screen</td>
</tr><tr>
  <td><code>M-v</code></td>      
  <td>Show previous screen</td>
</tr><tr>
  <td><code>C-l</code></td>      
  <td>Redisplay screen</td>
</tr><tr>
  <td><code>M-0 C-l</code></td>  
  <td>Move the line where cursor is to line 0 (top) of the screen</td>
</tr>
</table>

<h4>Search and replace</h4>

<table>
<tr>
  <td><code>C-s</code></td>      
  <td>"Incremental" search searches while you enter string 
       (<code>C-s str enter</code>); case insensitive</td>
</tr><tr>
  <td><code>C-r</code></td>      
  <td>"Incremental" backward search (<code>C-r str enter</code>)</td>
</tr>
</table><table>
<tr>
  <td><code>M-x replace-string</code></td> 
  <td>Replace one string with another (<code>M-x repl enter one
      string enter another</code>)</td>
</tr><tr>
  <td><code>M-x query-replace</code></td> 
  <td>Replace one string with another, wants "y" meaning "do it" or "n" 
      to skip (<code>M-x Qu enter one string enter another</code>)</td>
</tr>
</table>

<h4>Region operations</h4>

Region is area of buffer between cursor and mark (or mark and
cursor). Some commands set the mark, so check it before using.  You can
also select a region with the mouse and then type <code>C-w</code> kill
or <code>C-$</code> (copy).

<table>
<tr>
  <td><code>C-@</code></td>      
  <td>Set the mark (for use with REGION commands)</td>
</tr><tr>
  <td><code>C-x r k</code></td>      
  <td>Kill rectangle between mark and cursor</td>
</tr><tr>
  <td><code>C-x r y</code></td>      
  <td>Yank the last killed rectangle with upper left corner at cursor</td>
</tr><tr>
  <td><code>C-x C-x</code></td>  
  <td>Interchange cursor and mark (i.e. go to the other end of the
      current region)</td>
</tr><tr>
  <td><code>C-w</code></td>      
  <td>Kill region; <code>C-y</code> yank it back at cursor</td>
</tr><tr>
  <td><code>C-$</code></td>      
  <td>Copy region; <code>C-y</code> yank it at cursor</td>
</tr> 
</table>

<h4>Window operations</h4>

<table>
<tr>
  <td><code>C-x 3</code></td>    
  <td>Split vertically screen in two windows 
      (same buffer shown in each)</td>
</tr><tr>
  <td><code>C-x 2</code></td>    
  <td>Split horizontally screen in two windows 
      (same buffer shown in each)</td>
</tr><tr>
  <td><code>C-x 1</code></td>    
  <td>Resume single window (using buffer from top window)</td>
</tr><tr>
  <td><code>C-x o</code></td>    
  <td>Move cursor to other window (all the usual commands apply)</td>
</tr><tr>
  <td><code>M-x-v</code></td>    
  <td>Display the next screen in the other window</td>
</tr>
</table>


<|start_filename|>popDyn/EBTtool/fns/ebtmain.c<|end_filename|>
/***
   NAME
     ebtmain.c
   PURPOSE
     This file contains the main routine of the EBT program.
   NOTES

   HISTORY
     AMdR - Jul 19, 1995 : Created.
     AMdR - Nov 18, 2014 : Revised last.
***/

#define EBTMAIN_C				/* Identification of file   */
#define EBTLIB                                  /* and file grouping        */

#include "escbox.h"                             /* Include general header   */
#include "ebtinit.h"
#include "ebtcohrt.h"
#include "ebtmain.h"
#include "ebtutils.h"
#include "ebtstop.h"

/* <NAME> 2020/04/02 */
#include "ebttint.h"


/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define SGE  "Error in installing the signal handlers!"

/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/
#ifdef MODULE
EXTERN_C char* exp_error_msg(void){ return error_msg; }
EXTERN_C int exp_environ_dim(void){ return environ_dim; }
EXTERN_C int exp_population_nr(void){ return population_nr; }
EXTERN_C int exp_i_state_dim(void){ return i_state_dim; }
EXTERN_C int exp_i_const_dim(void){ return i_const_dim; }
EXTERN_C int exp_parameter_nr(void){ return parameter_nr; }
EXTERN_C double* exp_env(void){ return env; }
EXTERN_C double* exp_output(void){ return output; }
#if (POPULATION_NR > 0)
EXTERN_C population* exp_pop(void){ return pop; }
EXTERN_C int* exp_CohortNo(void){ return CohortNo; }
EXTERN_C char* exp_statelabel(int popnr){ return statelabels[popnr]; }
#if (I_CONST_DIM > 0)
EXTERN_C popID* exp_popIDcard(void){ return popIDcard; }
#else
EXTERN_C double* exp_popIDcard(void){ return popIDcard; }
#endif	// i_const_dim > 0
#else
EXTERN_C population* exp_pop(void){ return NULL; }
EXTERN_C int* exp_CohortNo(void){ return NULL; }
EXTERN_C char* exp_statelabel(int popnr){ return NULL; }
EXTERN_C double* exp_popIDcard(void){ return NULL; }
#endif // (POPULATION_NR > 0)
#endif  // MODULE

// This function is called in both the tool and ebtutils.c. It is implemented
// to protect the value of output_var_nr from changes by the user
EXTERN_C int exp_output_var_nr(void){ return output_var_nr; }


#ifndef MODULE

static void	PrintStats(void)

  /*
   * PrintStats - Routine writes statistics about current program status to
   *              stderr after receiving a SIGUSR1 signal
   *		  (use kill -USR1 to generate it)
   */

{
  fprintf(stderr, "\n\nCurrent program status:\n\n");
  fprintf(stderr, "%-50s : %.6f\n", "Time", env[0]);

#if (POPULATION_NR > 0)
  register int 			i;

  for (i=0; i<POPULATION_NR; i++)
    {
      fprintf(stderr, "%-48s%2d : %d\n",
	      "Number of cohorts in population", i, CohortNo[i]);
    }
#endif // (POPULATION_NR > 0)

  fprintf(stderr, "%-50s : %.4E\n",
	  "Current cohort limit", cohort_limit);
  fprintf(stderr, "%-50s : %.4E\n",
	  "Step size in integration", step_size);
  fprintf(stderr, "\n\n");

  WriteStateToFile(stderr, NULL);

  fflush(stderr);

  return;
}



/*==============================================================================*/

#if HAS_SIGNALS
						/* ARGSUSED                 */
static void	CatchSig(int signl)

  /*
   * CatchSig - Routine catches and handles the signals received from the
   *            ebttool application running this program as a child.
   */

{
  switch (signl)
    {
#ifndef LIMITED_SIGNALS
    case SIGHUP:				/* End integration         */
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      ErrorExit(1, "Hangup enforced by user signal");
      break;
    case SIGUSR1:				/* Print program statistics*/
      PrintStats();
      break;
#endif
    case SIGFPE:				/* Floating point exception*/
#if defined(_GNU_SOURCE)
      if (initState && currentState)
	{
	  // In the middle of integration, save most recent data
	  if (!dbgfil)				// Open file if necessary
	    {
	      char			filename[MAXFILENAMELEN];

	      (void)strcpy(filename, runname); (void)strcat(filename, "dbg");
	      dbgfil=fopen(filename, "a");
	      if(!dbgfil) Warning("Unable to open DBG file!");
	    }
	  if(dbgfil) (void)fprintf(dbgfil, "==============================================================\n");
	  if(dbgfil) (void)fprintf(dbgfil, "\nFPE EXCEPTION AT T = %.10f, STEP SIZE = %.6E\n", env[0], step_size);
	  if (dbgfil && initState)
	    {
	      (void)fprintf(dbgfil, "\nInitial state of current integration step\n\n");
	      WriteStateToFile(dbgfil, initState);
	    }
	  if (dbgfil && currentState)
	    {
	      (void)fprintf(dbgfil, "\nCurrent state in integration step (rk_level = %d)\n\n", rk_level);
	      WriteStateToFile(dbgfil, currentState);
	    }
	  if (dbgfil && currentDers[rk_level-1])
	    {
	      (void)fprintf(dbgfil, "\nLast derivative in integration step (rk_level = %d)\n\n", rk_level-1);
	      WriteStateToFile(dbgfil, currentDers[rk_level-1]);
	    }
	  if (dbgfil && currentDers[rk_level])
	    {
	      (void)fprintf(dbgfil, "\nCurrent derivative in integration step (rk_level = %d)\n\n", rk_level);
	      WriteStateToFile(dbgfil, currentDers[rk_level]);
	    }
	  if(dbgfil) (void)fprintf(dbgfil, "==============================================================\n");
	}
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      {
	char		fpe_mes[80];

	/*
	  The code below represents an attempt to further detect the type of FPU
	  error that occurred. As of now, however, I do not know how to do
	  it. The use of fetestexcept() always yields a 0 return value, which is
	  meaningless.

	int		fpe;

	fpe = fetestexcept(FE_ALL_EXCEPT);
	if (fetestexcept(FE_DIVBYZERO))
	  sprintf(fpe_mes, "Floating point error at time %.4f: Division by 0", env[0]);
	else if (fetestexcept(FE_UNDERFLOW))
	  sprintf(fpe_mes, "Floating point error at time %.4f: Underflow", env[0]);
	else if (fetestexcept(FE_OVERFLOW))
	  sprintf(fpe_mes, "Floating point error at time %.4f: Overflow", env[0]);
	else if (fetestexcept(FE_INEXACT))
	  sprintf(fpe_mes, "Floating point error at time %.4f: Inexact result", env[0]);
	else if (fetestexcept(FE_INVALID))
	  sprintf(fpe_mes, "Floating point error at time %.4f: Invalid operation", env[0]);
	else
	  sprintf(fpe_mes, "Floating point error at time %.4f: Unknown error code %d",
		  env[0], fpe);
	*/
	sprintf(fpe_mes, "Floating point error at time %.4f", env[0]);
	ErrorExit(1, fpe_mes);
      }
#endif
      break;
    }

#ifndef LIMITED_SIGNALS
  if (signal(SIGHUP,  CatchSig) == SIG_ERR) Warning(SGE);
  if (signal(SIGUSR1, CatchSig) == SIG_ERR) Warning(SGE);
#endif
  if (signal(SIGFPE,  CatchSig) == SIG_ERR) Warning(SGE);

  return;
}

#endif //HAS_SIGNALS
#endif //!MODULE



/*==========================================================================*/

#ifdef MODULE
#if HAS_SIGNALS
EXTERN_C int HandleSignal(int signl)
{
  switch (signl)
    {
#ifndef LIMITED_SIGNALS
    case SIGHUP:
      ErrorExit(1, "Received SIGHUP signal.");
      break;
#endif
    case SIGINT:
      ErrorExit(1, "Received SIGINT signal.");
      break;
    case SIGFPE:
      ErrorExit(1, "Received SIGFPE signal.");
      break;
    }
  return error_code;
}

#endif //HAS_SIGNALS
#endif //MODULE

/*==========================================================================*/

static void usage(char *progname)

{
  fprintf(stderr, "\nUsage of %s command line options: \n\n", progname);
  fprintf(stderr, "    -r | --resume\n");
  fprintf(stderr, "        Resume previously interrupted integration\n\n");
  fprintf(stderr, "    -d <0|1|2|3|4> | --debug <0|1|2|3|4> \n");
  fprintf(stderr, "        Select debug information level 0, 1, 2, 3 or 4 ");
  fprintf(stderr, "(written to DBG file)\n\n");
  fprintf(stderr, "    -? | --help \n");
  fprintf(stderr, "        Show this message\n");
  fprintf(stderr, "\n");
  exit(0);
  return;
}





/*==========================================================================*/
#ifndef MODULE

int       		main(int argc, char **argv)

#else

EXTERN_C int		StartUp(int argc, char **argv)

#endif

{
  char			**argpnt1 = NULL, **argpnt2 = NULL, **my_argv = NULL;
  int			my_argc;
#ifdef MODULE
  int			ret_val = 0;
#endif
  Resume 	= 0;
  debug_level 	= 0;
  environ_dim	= ENVIRON_DIM;
  population_nr	= POPULATION_NR;
  i_state_dim	= I_STATE_DIM;
  i_const_dim	= I_CONST_DIM;
  output_var_nr = OUTPUT_VAR_NR;
  parameter_nr	= PARAMETER_NR;
#ifdef MODULE
  strcpy(error_msg, "");
#endif
  error_code    = 0;

#if defined(_GNU_SOURCE)
  /*
   * Possible exception types to set are
   *		(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT);
   * The last two are, however, frequently occurring in mathematical functions
   * without any consequences. Only enable testing the first 3.
   */
#ifndef MODULE
  feclearexcept(FE_ALL_EXCEPT);
#if defined(__APPLE__)
  static 	fenv_t fenv;
  unsigned int 	new_excepts;  // previous masks

  new_excepts = (FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW) & FE_ALL_EXCEPT,

  fegetenv(&fenv);

  // unmask
  fenv.__control &= ~new_excepts;
  fenv.__mxcsr   &= ~(new_excepts << 7);
  fesetenv (&fenv);

#else
  // <NAME> 2020/03/31: feenableexcept replaced by feraiseexcept
  feraiseexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
#endif // defined(__APPLE__)
#endif
#endif

  my_argv = (char **)Myalloc((void *)my_argv, (size_t)argc, sizeof(char *));

  /*
   * Process all intrinsic command line parameters. Possibilities:
   *
   *	-r   | --resume	 	: Resume previously interrupted integration
   *
   *	-d n | --debug n 	: Level of debug information, stored in the
   *			   	  DBG file
   *
   *	-?   | --help		: Print usage message
   */
  argpnt1 = argv;
  argpnt2 = my_argv;
  my_argc = 0;
  while (*argpnt1)
    {
      if (!strcmp(*argpnt1, "-r") || !strcmp(*argpnt1, "--resume"))
	{
	  Resume = 1;
	}
      else if (!strcmp(*argpnt1, "-?") || !strcmp(*argpnt1, "--help"))
	{
	  usage(argv[0]);
	}
      else if (!strcmp(*argpnt1, "-d") ||!strcmp(*argpnt1, "--debug"))
	{
	  argpnt1++;
	  if (!*argpnt1)
	    {
	      fprintf(stderr, "\nNo debug level specified!\n");
	      usage(argv[0]);
	    }
	  switch (atoi(*argpnt1))
	    {
	    case 0:
	    case 1:
	    case 2:
	    case 3:
	    case 4:
	    case 5:
	      debug_level = atoi(*argpnt1);
	      break;
	    default:
	      fprintf(stderr, "\nWrong debug level specifier: %s\n", *argpnt1);
	      usage(argv[0]);
	      break;
	    }
	}
      else if ((!strncmp(*argpnt1, "--", 2)))
	{
	  fprintf(stderr, "\nUnknown command line option: %s\n", *argpnt1);
	  usage(argv[0]);
	}
      else if ((!strncmp(*argpnt1, "-", 1)) && isalpha(*(*argpnt1+1)))
	{
	  fprintf(stderr, "\nUnknown command line option: %s\n", *argpnt1);
	  usage(argv[0]);
	}
      else
	{
	  *argpnt2 = *argpnt1;
	  my_argc++;
	  argpnt2++;
	}
      argpnt1++;
    }
  // Initialization of the environment, population and output devices
  Initialize(my_argc, my_argv);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return error_code;
#endif

#ifndef MODULE
#if HAS_SIGNALS
#ifndef LIMITED_SIGNALS
  if (signal(SIGHUP,  CatchSig) == SIG_ERR) Warning(SGE);
  if (signal(SIGUSR1, CatchSig) == SIG_ERR) Warning(SGE);
#endif
  if (signal(SIGFPE,  CatchSig) == SIG_ERR) Warning(SGE);
#endif /* HAS_SIGNALS */
#endif // ! MODULE

#if (DYNAMIC_COHORTS == 1)
  next_cohort_end = max_time;
#else
  next_cohort_end = (floor(env[0]/cohort_limit)+1)*cohort_limit;
#endif /* DYNAMIC_COHORTS */

						/* By default (state)       */
  next_output       =				/* output at start up       */
      (floor((env[0]-identical_zero)/delt_out)+1)*delt_out;
  if (state_out > 0.0)
      next_state_output =
	  (floor((env[0]-identical_zero)/state_out)+1)*state_out;
  else next_state_output = 0.0;

#if (BIFURCATION == 1)
  double		oldBifParVal;

  // Initialise the bifurcation and set the current parameter value
  SetBifOutputTimes(env);

  BifParBase = parameter[BifParIndex];

  if (BifParLogStep)
    parameter[BifParIndex] = (BifParBase*pow(10.0, BifParStep*floor((env[0]+BIFTINY)/BifPeriod)));
  else
    parameter[BifParIndex] = (BifParBase + floor((env[0]+BIFTINY)/BifPeriod)*BifParStep);

  oldBifParVal = parameter[BifParIndex];
#endif // (BIFURCATION == 1)

#if (POPULATION_NR > 0)
						/* Allow the user to carry  */
  UserInit(my_argc, my_argv, env, pop);		/* out some initialization  */
#else
  UserInit(my_argc, my_argv, env, NULL);
#endif // (POPULATION_NR > 0)
#ifdef MODULE
  if (error_code & FATAL_ERROR) return error_code;
#endif

#if (POPULATION_NR > 0)
  SievePop();
#endif // (POPULATION_NR > 0)

#if (BIFURCATION == 1)
  // Bifurcation parameter as additional output
  output_var_nr++;

  // Redo the initialisation in case the user has changed some of the
  // bifurcation parameters
  SetBifOutputTimes(env);

  // Change the BifParBase only when user has changed the parameter value in UserInit()
  if (oldBifParVal != parameter[BifParIndex]) BifParBase = parameter[BifParIndex];

  if (BifParLogStep)
    parameter[BifParIndex] = (BifParBase*pow(10.0, BifParStep*floor((env[0]+BIFTINY)/BifPeriod)));
  else
    parameter[BifParIndex] = (BifParBase + floor((env[0]+BIFTINY)/BifPeriod)*BifParStep);
#endif // (BIFURCATION == 1)

  if ((next_output - env[0]) < identical_zero)
    {						/* Increment next time      */
      next_output += delt_out;			/* Produce output if        */
      FileOut();				/* required at this time    */
#ifdef MODULE
      ret_val |= NORMAL_OUT;			// AMdR - Jul 22, 2008
#endif
    }

#if (POPULATION_NR > 0)
  if ((state_out > 0.0) && ((next_state_output-env[0]) < identical_zero))
    {						/* Increment next time      */
      next_state_output += state_out;		/* Output complete state if */
      FileState();				/* required at this time    */
#ifdef MODULE
      ret_val |= STATE_OUT;			// AMdR - Jul 22, 2008
#endif
    }
#endif // (POPULATION_NR > 0)

  if (!Resume) WriteReport(my_argc, my_argv);	/* Write report file        */

#ifndef MODULE

  while (!((env[0] >= max_time) || ForcedRunEnd))
    CohortCycle(next_cohort_end);
						/* Program shut down        */
  ShutDown(0);					/* procedure                */

  return 0;
#else
  return (ret_val | error_code);		// AMdR - Jul 22, 2008
#endif
}



/*==========================================================================*/


<|start_filename|>animal/html/refresh_my_pet.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>refresh_my_pet</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="refresh_my_pet.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">check that species to be refreshed actually exists</a></li><li><a href="#5">open 3 html files for reading and writing and opisition writing head</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> refresh_my_pet(species)
</pre><pre class="codeinput"><span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>changes a spieces-content to
   Species.xls (single row first 3 sheets and overwriting a species-sheet)
   Species.html (single row)
   /html/primary_parameters.html (single row)
   /html/statistics.html (single row)
   /html/my_pet.html (replace existing file)
cf add_my_pet for adding a species, rather than updating it</pre><pre class="codeinput">  <span class="comment">% selected copy-paste from report_xls_init</span>
  file_name = <span class="string">'Species'</span>; <span class="comment">% name of xls-file that serves as output</span>
  txt_pwd = [pwd, <span class="string">'\'</span>];
  hyp_add_my_pet = <span class="string">'http://www.bio.vu.nl/thb/deb/deblab/add_my_pet/'</span>; <span class="comment">% used in report_xls</span>
  hyper_data = [<span class="string">'=HYPERLINK("'</span>, hyp_add_my_pet, <span class="string">'add_my_pet.pdf"; "data")'</span>];
  hyp_Lifecycles = <span class="string">'http://www.bio.vu.nl/thb/deb/sheets/cycle_pr_files/v3_document.htm'</span>;
  hyper_phylum = [<span class="string">'=HYPERLINK("'</span>, hyp_Lifecycles,<span class="string">'"; "phylum")'</span>];
  cell_name = {<span class="keyword">...</span>
    <span class="string">' A'</span>,<span class="string">' B'</span>,<span class="string">' C'</span>,<span class="string">' D'</span>,<span class="string">' E'</span>,<span class="string">' F'</span>,<span class="string">' G'</span>,<span class="string">' H'</span>,<span class="string">' I'</span>,<span class="string">' J'</span>,<span class="string">' K'</span>,<span class="string">' L'</span>,<span class="string">' M'</span>,<span class="string">' N'</span>,<span class="string">' O'</span>,<span class="string">' P'</span>,<span class="string">' Q'</span>,<span class="string">' R'</span>,<span class="string">' S'</span>,<span class="string">' T'</span>,<span class="string">' U'</span>,<span class="string">' V'</span>,<span class="string">' W'</span>,<span class="string">' X'</span>,<span class="string">' Y'</span>,<span class="string">' Z'</span>, <span class="keyword">...</span>
    <span class="string">'AA'</span>,<span class="string">'AB'</span>,<span class="string">'AC'</span>,<span class="string">'AD'</span>,<span class="string">'AE'</span>,<span class="string">'AF'</span>,<span class="string">'AG'</span>,<span class="string">'AH'</span>,<span class="string">'AI'</span>,<span class="string">'AJ'</span>,<span class="string">'AK'</span>,<span class="string">'AL'</span>,<span class="string">'AM'</span>,<span class="string">'AN'</span>,<span class="string">'AO'</span>,<span class="string">'AP'</span>,<span class="string">'AQ'</span>,<span class="string">'AR'</span>,<span class="string">'AS'</span>,<span class="string">'AT'</span>,<span class="string">'AU'</span>,<span class="string">'AV'</span>,<span class="string">'AW'</span>,<span class="string">'AX'</span>,<span class="string">'AY'</span>,<span class="string">'AZ'</span>, <span class="keyword">...</span>
    <span class="string">'BA'</span>,<span class="string">'BB'</span>,<span class="string">'BC'</span>,<span class="string">'BD'</span>,<span class="string">'BE'</span>,<span class="string">'BF'</span>,<span class="string">'BG'</span>,<span class="string">'BH'</span>,<span class="string">'BI'</span>,<span class="string">'BJ'</span>,<span class="string">'BK'</span>,<span class="string">'BL'</span>,<span class="string">'BM'</span>,<span class="string">'BN'</span>,<span class="string">'BO'</span>,<span class="string">'BP'</span>,<span class="string">'BQ'</span>,<span class="string">'BR'</span>,<span class="string">'BS'</span>,<span class="string">'BT'</span>,<span class="string">'BU'</span>,<span class="string">'BV'</span>,<span class="string">'BW'</span>,<span class="string">'BX'</span>,<span class="string">'BY'</span>,<span class="string">'BZ'</span>, <span class="keyword">...</span>
    <span class="string">'CA'</span>,<span class="string">'CB'</span>,<span class="string">'CC'</span>,<span class="string">'CD'</span>,<span class="string">'CE'</span>,<span class="string">'CF'</span>,<span class="string">'CG'</span>,<span class="string">'CH'</span>,<span class="string">'CI'</span>,<span class="string">'CJ'</span>,<span class="string">'CK'</span>,<span class="string">'CL'</span>,<span class="string">'CM'</span>,<span class="string">'CN'</span>,<span class="string">'CO'</span>,<span class="string">'CP'</span>,<span class="string">'CQ'</span>,<span class="string">'CR'</span>,<span class="string">'CS'</span>,<span class="string">'CT'</span>,<span class="string">'CU'</span>,<span class="string">'CV'</span>,<span class="string">'CW'</span>,<span class="string">'CX'</span>,<span class="string">'CY'</span>,<span class="string">'CZ'</span>, <span class="keyword">...</span>
    <span class="string">'DA'</span>,<span class="string">'DB'</span>,<span class="string">'DC'</span>,<span class="string">'DD'</span>,<span class="string">'DE'</span>,<span class="string">'DF'</span>,<span class="string">'DG'</span>,<span class="string">'DH'</span>,<span class="string">'DI'</span>,<span class="string">'DJ'</span>,<span class="string">'DK'</span>,<span class="string">'DL'</span>,<span class="string">'DM'</span>,<span class="string">'DN'</span>,<span class="string">'DO'</span>,<span class="string">'DP'</span>,<span class="string">'DQ'</span>,<span class="string">'DR'</span>,<span class="string">'DS'</span>,<span class="string">'DT'</span>,<span class="string">'DU'</span>,<span class="string">'DV'</span>,<span class="string">'DW'</span>,<span class="string">'DX'</span>,<span class="string">'DY'</span>,<span class="string">'DZ'</span>};

  report_init
  n_statistics = size(txt_statistics,1);
</pre><h2>check that species to be refreshed actually exists<a name="4"></a></h2><pre class="codeinput">  <span class="keyword">if</span> exist([<span class="string">'pars_'</span>, species, <span class="string">'.m'</span>], <span class="string">'file'</span>) == 0
    fprintf([species, <span class="string">' not found\n'</span>]);
    <span class="keyword">return</span>
  <span class="keyword">end</span>
</pre><h2>open 3 html files for reading and writing and opisition writing head<a name="5"></a></h2><pre class="codeinput">  <span class="comment">% Species.html</span>
  fid_Spec = fopen(<span class="string">'Species.html'</span>, <span class="string">'r+'</span>); <span class="comment">% open file for reading</span>
  Spec     = fread(fid_Spec);             <span class="comment">% read Species.html</span>
  nid_Spec = length(Spec);                <span class="comment">% file size</span>
  <span class="comment">%</span>
  in_Spec = strfind(Spec', species);
  <span class="keyword">if</span> isempty(in_Spec) <span class="comment">% check that species entry actually exists</span>
     fprintf([species, <span class="string">' not found\n'</span>]);
     fclose(fid_Spec);
     <span class="keyword">return</span>
  <span class="keyword">end</span>
  <span class="comment">%</span>
  in_Spec = in_Spec(1); <span class="comment">% select first occurence, next one concerns link</span>
  in_Spec = strfind(Spec(1:in_Spec)', <span class="string">'&lt;TR&gt;'</span>); <span class="comment">% find last &lt;TR&gt;</span>
  n_spec = length(in_Spec);   <span class="comment">% row number in first 3 sheets of Species.xls before the one at which species needs to be added</span>
  in_Spec = in_Spec(end) - 1; <span class="comment">% index of end of previous species</span>
  in_Spec_end = strfind(Spec(in_Spec:end)', <span class="string">'&lt;/TR&gt;'</span>); in_Spec_end = in_Spec + in_Spec_end(1) + 5;  <span class="comment">% index of start next species</span>
  frewind(fid_Spec);          <span class="comment">% reset current position</span>
  fread(fid_Spec, in_Spec);   <span class="comment">% set position on in_Spec</span>
  fseek(fid_Spec, 0, <span class="string">'cof'</span>);  <span class="comment">% prepare for wrting at position in_Spec</span>

  <span class="comment">% primary_parameters.html</span>
  fid_par = fopen(<span class="string">'./html/primary_parameters.html'</span>, <span class="string">'r+'</span>); <span class="comment">% open file for reading</span>
  Par = fread(fid_par);
  nid_Par = length(Par);    <span class="comment">% file size of Par</span>
  in_Par = strfind(Par', species); in_Par = in_Par(1);
  in_Par = strfind(Par(1:in_Par)', <span class="string">'&lt;TR&gt;'</span>);
  in_Par = in_Par(end) - 1; <span class="comment">% index of end of previous species</span>
  in_Par_end = strfind(Par(in_Par:end)', <span class="string">'&lt;/TR&gt;'</span>); in_Par_end = in_Par + in_Par_end(1) + 5;  <span class="comment">% index of start next species</span>
  frewind(fid_par);         <span class="comment">% reset current position</span>
  fread(fid_par, in_Par);   <span class="comment">% set position on in_Par</span>
  fseek(fid_par, 0, <span class="string">'cof'</span>); <span class="comment">% prepare for wrting at position in_Par</span>

  <span class="comment">% statistics.html</span>
  fid_stat = fopen(<span class="string">'./html/statistics.html'</span>, <span class="string">'r+'</span>); <span class="comment">% open file for reading</span>
  Stat = fread(fid_stat);
  nid_Stat = length(Stat);    <span class="comment">% file size of Stat</span>
  in_Stat = strfind(Stat', species); in_Stat = in_Stat(1);
  in_Stat = strfind(Stat(1:in_Stat)', <span class="string">'&lt;TR&gt;'</span>);
  in_Stat = in_Stat(end) - 1; <span class="comment">% index of end of previous species</span>
  in_Stat_end = strfind(Stat(in_Stat:end)', <span class="string">'&lt;/TR&gt;'</span>); in_Stat_end = in_Stat + in_Stat_end(1) + 5;  <span class="comment">% index of start next species</span>
  frewind(fid_stat);          <span class="comment">% reset current position</span>
  fread(fid_stat, in_Stat);   <span class="comment">% set position on in_Stat</span>
  fseek(fid_stat, 0, <span class="string">'cof'</span>);  <span class="comment">% prepare for wrting at position in_Stat</span>


  eval([<span class="string">'pars_'</span>, species]);  <span class="comment">% write species that is added</span>

  <span class="comment">% write trailing species to the 3 html files</span>
  in_span = 1000; <span class="comment">% writing problems for large strings</span>
  in_Spec = in_Spec_end;
  <span class="keyword">while</span> in_Spec &lt;= nid_Spec
    fprintf(fid_Spec, char(Spec(in_Spec: min(nid_Spec, in_Spec + in_span - 1))'));
    in_Spec = in_Spec + in_span;
  <span class="keyword">end</span>
  fclose(fid_Spec);
  <span class="comment">%</span>
  in_Par = in_Par_end;
  <span class="keyword">while</span> in_Par &lt;= nid_Par
    fprintf(fid_par, char(Par(in_Par: min(nid_Par, in_Par + in_span - 1))'));
    in_Par = in_Par + in_span;
  <span class="keyword">end</span>
  fclose(fid_par);
  <span class="comment">%</span>
  in_Stat = in_Stat_end;
  <span class="keyword">while</span> in_Stat &lt;= nid_Stat
    fprintf(fid_stat, char(Stat(in_Stat: min(nid_Stat, in_Stat + in_span - 1))'));
    in_Stat = in_Stat + in_span;
  <span class="keyword">end</span>
  fclose(fid_stat);
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function refresh_my_pet(species)
%
%% Description
%  changes a spieces-content to 
%     Species.xls (single row first 3 sheets and overwriting a species-sheet)
%     Species.html (single row)
%     /html/primary_parameters.html (single row)
%     /html/statistics.html (single row)
%     /html/my_pet.html (replace existing file)
% cf add_my_pet for adding a species, rather than updating it
  
  % selected copy-paste from report_xls_init
  file_name = 'Species'; % name of xls-file that serves as output
  txt_pwd = [pwd, '\'];
  hyp_add_my_pet = 'http://www.bio.vu.nl/thb/deb/deblab/add_my_pet/'; % used in report_xls
  hyper_data = ['=HYPERLINK("', hyp_add_my_pet, 'add_my_pet.pdf"; "data")'];
  hyp_Lifecycles = 'http://www.bio.vu.nl/thb/deb/sheets/cycle_pr_files/v3_document.htm';
  hyper_phylum = ['=HYPERLINK("', hyp_Lifecycles,'"; "phylum")'];
  cell_name = {...
    ' A',' B',' C',' D',' E',' F',' G',' H',' I',' J',' K',' L',' M',' N',' O',' P',' Q',' R',' S',' T',' U',' V',' W',' X',' Y',' Z', ...
    'AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ', ...
    'BA','BB','BC','BD','BE','BF','BG','BH','BI','BJ','BK','BL','BM','BN','BO','BP','BQ','BR','BS','BT','BU','BV','BW','BX','BY','BZ', ...
    'CA','CB','CC','CD','CE','CF','CG','CH','CI','CJ','CK','CL','CM','CN','CO','CP','CQ','CR','CS','CT','CU','CV','CW','CX','CY','CZ', ...
    'DA','DB','DC','DD','DE','DF','DG','DH','DI','DJ','DK','DL','DM','DN','DO','DP','DQ','DR','DS','DT','DU','DV','DW','DX','DY','DZ'};

  report_init
  n_statistics = size(txt_statistics,1); 

  %% check that species to be refreshed actually exists
  if exist(['pars_', species, '.m'], 'file') == 0
    fprintf([species, ' not found\n']);
    return
  end

  %% open 3 html files for reading and writing and opisition writing head
  
  % Species.html
  fid_Spec = fopen('Species.html', 'r+'); % open file for reading 
  Spec     = fread(fid_Spec);             % read Species.html
  nid_Spec = length(Spec);                % file size
  %
  in_Spec = strfind(Spec', species); 
  if isempty(in_Spec) % check that species entry actually exists
     fprintf([species, ' not found\n']);
     fclose(fid_Spec);
     return
  end
  %
  in_Spec = in_Spec(1); % select first occurence, next one concerns link
  in_Spec = strfind(Spec(1:in_Spec)', '<TR>'); % find last <TR>
  n_spec = length(in_Spec);   % row number in first 3 sheets of Species.xls before the one at which species needs to be added
  in_Spec = in_Spec(end) - 1; % index of end of previous species
  in_Spec_end = strfind(Spec(in_Spec:end)', '</TR>'); in_Spec_end = in_Spec + in_Spec_end(1) + 5;  % index of start next species
  frewind(fid_Spec);          % reset current position
  fread(fid_Spec, in_Spec);   % set position on in_Spec 
  fseek(fid_Spec, 0, 'cof');  % prepare for wrting at position in_Spec
   
  % primary_parameters.html
  fid_par = fopen('./html/primary_parameters.html', 'r+'); % open file for reading
  Par = fread(fid_par);
  nid_Par = length(Par);    % file size of Par
  in_Par = strfind(Par', species); in_Par = in_Par(1);
  in_Par = strfind(Par(1:in_Par)', '<TR>'); 
  in_Par = in_Par(end) - 1; % index of end of previous species
  in_Par_end = strfind(Par(in_Par:end)', '</TR>'); in_Par_end = in_Par + in_Par_end(1) + 5;  % index of start next species
  frewind(fid_par);         % reset current position
  fread(fid_par, in_Par);   % set position on in_Par
  fseek(fid_par, 0, 'cof'); % prepare for wrting at position in_Par
   
  % statistics.html
  fid_stat = fopen('./html/statistics.html', 'r+'); % open file for reading
  Stat = fread(fid_stat);
  nid_Stat = length(Stat);    % file size of Stat
  in_Stat = strfind(Stat', species); in_Stat = in_Stat(1);
  in_Stat = strfind(Stat(1:in_Stat)', '<TR>'); 
  in_Stat = in_Stat(end) - 1; % index of end of previous species
  in_Stat_end = strfind(Stat(in_Stat:end)', '</TR>'); in_Stat_end = in_Stat + in_Stat_end(1) + 5;  % index of start next species
  frewind(fid_stat);          % reset current position
  fread(fid_stat, in_Stat);   % set position on in_Stat
  fseek(fid_stat, 0, 'cof');  % prepare for wrting at position in_Stat

 
  eval(['pars_', species]);  % write species that is added
  
  % write trailing species to the 3 html files
  in_span = 1000; % writing problems for large strings
  in_Spec = in_Spec_end;
  while in_Spec <= nid_Spec
    fprintf(fid_Spec, char(Spec(in_Spec: min(nid_Spec, in_Spec + in_span - 1))'));
    in_Spec = in_Spec + in_span;
  end
  fclose(fid_Spec);
  %
  in_Par = in_Par_end;
  while in_Par <= nid_Par
    fprintf(fid_par, char(Par(in_Par: min(nid_Par, in_Par + in_span - 1))'));
    in_Par = in_Par + in_span;
  end
  fclose(fid_par);
  %
  in_Stat = in_Stat_end;
  while in_Stat <= nid_Stat
    fprintf(fid_stat, char(Stat(in_Stat: min(nid_Stat, in_Stat + in_span - 1))'));
    in_Stat = in_Stat + in_span;
  end
  fclose(fid_stat);

##### SOURCE END #####
--></body></html>

<|start_filename|>docs/DEBtool_symbi.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_symbi</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: symbi</H3>

  Interaction between hosts and symbionts in reactors:

<HR>
<H4><A NAME="symbi">symbi</A></H4>

  <TABLE> 
    <TR> <TD></TD><TD>host: 1 reserve, 1 structure, V1-morph</TD></TR>
    <TR> <TD></TD><TD>symbiont: 2 reserves, 1 structure, V1-morph</TD></TR>
  </TABLE>

  Demo that runs:
  <UL>
    <LI> <A HREF="#pars_symbi"><code>pars_symbi</code></A>: parameter setting </LI>
    <LI> <A HREF="#shtime_symbi"><code>shtime_symbi</code></A>: 
         batch culture of autotrophs & herbivores </LI>
    <LI> <A HREF="#shsubstr2graz"><code>shsubstr2graz</code></A>:
         chemostat in equilibrium; substrate & grazing levels </LI>
    <LI> <A HREF="#shsubstr2nitro"><code>shsubstr2nitro</code></A>:
         chemostat in equilibrium; substrate & nitrogen levels </LI>
    <LI> <A HREF="#shsubstr2throu"><code>shsubstr2throu</code></A>:
         chemostat in equilibrium; substrate & throughput levels </LI>
    <LI> <A HREF="#shthrou2graz"><code>shthrou2graz</code></A>:
         chemostat in equilibrium; throughput & grazing levels </LI>
  </UL>

  The theory for the model can be found in: <br> 
  Kooijman, <NAME>. 2002<A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2002.html"> 
  Van herbivorie, via symbiose naar mixotrofie.</A>
  In: <NAME>., <NAME>,
  <NAME>. Theoretische Biologie.  Epsilon-uitgevers, Utrecht. (subm) 

  <p>
  The paper describes the trophic relationships between autothrophs and herbivores, and how herbivory can make a smooth transition to symbiosis. 
  The basis is that herbivores consume the structure and, more important, the reserves of the autotrophs. 
  Autotrophs also have to excrete some reserves in the environment, which can be taken up by the herbivores as well. 
  Stoichiometric constraints and conversion efficiencies dominate the relationships between the partners.

  <p>
  Populations of autotrophs and heterotrophs live in a reactor;
  Model elements are:
  <UL>
    <LI> Inorganic carbon and light are not limiting. </LI>
    <LI> The inflowing medium has organic substrate (X) and/or nitrogen (N, ammonia); 
         the specific throughput rate of the chemostat is called h. </LI>
    <LI> Initially hardly any autotrophs (VA), heterotrophs (VH) or hydrocarbon (CH) are present in the chemostat, and the concentrations nitrogen and substrate equal that in the feed </LI>
    <LI> Substrate contains nitrogen, but this is not available for the autotroph </LI> 
    <LI> The autotroph (VA) excretes nitrogen (N) and carbohydrate (CH), and consumes nitrogen (N) </LI>
    <LI> The heterotroph (VH) excretes nitrogen (N), and consumes, apart from the autotroph (VA), nitrogen (N), carbohydrate (CH) and substrate (X); no faeces is produced, so all wastes are mineralized instantaneously </LI>
    <LI> The autotroph has structure (VA), nitrogen-reserves (EN), and carbohydrate-reserves (EC);<br>
         reserve-densities: mEN = mass EN/ mass VA; mEC = mass EC/ mass VA </LI>
    <LI> The heterotroph has structure (VH), and reserves (E);<br>
         reserve density: mE = mass E/ mass VH </LI>
    <LI> Both auto- and heterotrophs are taken to be V1-morphs, with negligible aging </LI>
  </UL>

  <p>
  Example of use after (optionally) editing file <code>pars_symbi.m</code>: 
  <code>symbi</code>

<HR>
<H4><A NAME="pars_symbi">pars_symbi</A></H4>

  Set the parameters by editing file <code>pars_symbi.m</code> in toolbox <code>symbi</code>.

<HR>
<H4><A NAME="shtime_symbi">shtime_symbi</A></H4>

  Batch reactor; Initial conditions can be changed by editing the file <code>shtime_symbi.m</code>. 
  See pages {340} ff of the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book</A>.<br>
  Four figures are shown of variables against time

  <p>
  fig <B>1</B><br>
  Reserves in Molar: N-reserve (blue) and C-reserve (brown) of autotroph, and reserve (red) of heterotroph

  <p>
  fig <B>2</B><br> 
  Nutrient and substrates in Molar: nitrogen (blue), carbohydrate (brown) and substrate (red)

  <p>
  fig <B>3</B><br>
  Structural masses in Molar: autotroph (green), heterotroph (red)

  <p>
  fig <B>4</B><br>
  Total organic carbon (brown) and nitrogen (blue) in the reactor.  

  <p>
  Example of use after editing <code>pars_symbi.m</code>: 
  <code>clear all; pars_symbi; shtime_symbi</code><br> 
  The command <code>clear; pars_symbi; shtime_symbi(4)</code> will only plot fig <B>4</B>.

<HR>
<H4><A NAME="shsubstr2graz">shsubstr2graz</A></H4>

  Chemostat in equilibrium

  <p>
  Three figures are shown of autotrophs, heterotrophs and their ratio as functions of the substrate concentration in the feed, and the grazing intensity of the herbivores (that is: the preference for living autotrophic structure set by the parameter b_VA).

  <p>
  The range of values for the substrate concentration and grazing intensity can be changed by editing file <code>shsubstr2graz.m</code>

  <p>
  fig <B>1</B><br>
  Autotrophic structure in Molar

  <p>
  fig <B>2</B><br>
  Heterotrophic structure in Molar
  

  <p>
  fig <B>3</B><br>
  Ratio of autotrophic and heterotrophic structure in Molar/Molar

  <p>
  Example of use after editing <code>pars_symbi.m</code>: 
  <code>clear all; pars_symbi; shsubstr2graz</code>.<br> 
  The command <code>clear all; pars_symbi; shsubstr2graz(3)</code> will only plot fig <B>3</B>.

<HR>
<H4><A NAME="shsubstr2nitro">shsubstr2nitro</A></H4>

  Chemostat in equilibrium

  <p>
  Three figures are shown of autotrophs, heterotrophs and their ratio as functions of the substrate and the nitrogen concentration in the feed.

  <p>
  The range of values for the substrate and the nitrogen concentration can be changed by editing file <code>shsubstr2nitro.m</code>

  <p>
  fig <B>1</B><br>
  Autotrophic structure in Molar

  <p>
  fig <B>2</B><br>
  Heterotrophic structure in Molar
  

  <p>
  fig <B>3</B><br>
  Ratio of autotrophic and heterotrophic structure in Molar/Molar

  <p>
  Example of use after editing <code>pars_symbi.m</code>: 
  <code>clear all; pars_symbi; shsubstr2nitro</code>.<br> 
  The command <code>clear; pars_symbi; shsubstr2nitro (3)</code> will only plot fig <B>3</B>.

<HR>
<H4><A NAME="shsubstr2throu">shsubstr2throu</A></H4>

  Chemostat in equilibrium

  <p>
  Three figures are shown of autotrophs, heterotrophs and their ratio as functions of the substrate concentration in the feed, and the throughput rate.

  <p>
  The range of values for the substrate concentration and throughput rate can be changed by editing file <code>shsubstr2throu.m</code>

  <p>
  fig <B>1</B><br>
  Autotrophic structure in Molar

  <p>
  fig <B>2</B><br>
  Heterotrophic structure in Molar
  

  <p>
  fig <B>3</B><br>
  Ratio of autotrophic and heterotrophic structure in Molar/Molar

  <p>
  Example of use after editing <code>pars_symbi.m</code>: 
  <code>clear all; pars_symbi; shsubstr2throu</code>.<br> 
  The command <code>clear; pars_symbi; shsubstr2throu (3)</code> will only plot fig <B>3</B>.

<HR>
<H4><A NAME="shthrou2graz">shthrou2graz</A></H4>

  Chemostat in equilibrium

  <p>
  Three figures are shown of autotrophs, heterotrophs and their ratio as functions of the throughput rate, and the grazing intensity of the herbivores (that is: 
  the preference for living autotrophic structure set by the parameter b_VA).

  <p>
  The range of values for the throughput rate and grazing intensity can be changed by editing file <code>shthrou2graz.m</code>

  <p>
  fig <B>1</B><br>
  Autotrophic structure in Molar

  <p>
  fig <B>2</B><br>
  Heterotrophic structure in Molar
 
  <p>
  fig <B>3</B><br>
  Ratio of autotrophic and heterotrophic structure in Molar/Molar

  <p>
  Example of use after editing <code>pars_symbi.m</code>: 
  <code>clear all; pars_symbi; shthrou2graz</code>.<br> 
  The command <code>clear; pars_symbi; shthrou2graz (3)</code> will only plot fig <B>3</B>.

<HR>
<HR>
<H4><A NAME="endosym">endosym</A></H4>

  Stepwise integration of two interacting population, via endosymbiosis to single population in a reactor:<br>
  <TABLE> 
    <TR> 
      <TD></TD>
      <TD>future host: 1 reserve, 1 structure, V1-morph feeding on one substrate and one product made by future endosymbiont</TD>
    </TR>
    <TR> 
      <TD></TD>
      <TD>future endosymbiont: 1 reserve, 1 structure, V1-morph feeding on one substrate and one product made by future host</TD>
    </TR>
    <TR>
      <TD></TD>
      <TD>final endosymbiosis: 1 reserve, 1 structure, V1-morph feeding on two substrates</TD>
    </TR>
  </TABLE>

  Demo that runs:
  <UL>
    <LI> <A HREF="#pars*"><code>pars*</code></A>: parameter setting </LI>
    <LI> <A HREF="#shtime*"><code>shtime*</code></A>: 
         interacting population in generalized reactor </LI>
    <LI> <A HREF="#shstate*"><code>shstate*</code></A>:
         chemostat in equilibrium; state variables as functions of throughput rate </LI>
  </UL>

  where * is an integer number in the range 0-8, that represents the degree (level) of integration (merging) of the two populations into a single one. 
  The integration levels are:

  <UL>
    <LI> <B>0</B> two independent populations, that each produces a product that is taken by the other species as an alternative substitute for its substrate. 
         Product and substrate are processed sequentially. </LI>
    <LI> <B>1</B> like level 0, but the products and substrates are intermediary between substitutable and complementary, while they are processed intermediary between sequential and parallel. </LI>
    <LI> <B>2</B> like level 0, but the products and substrates are complementary and processed parallelly. </LI>
    <LI> <B>3</B> a single one-structure one-reserve population of the (future) host and three one-structure one-reserve populations of the (future) endosymbiont: 
         free-living in the reactor, in the hosts' mantle spaces, and inside hosts' bodies. 
         The hosts recieve symbionts' product on flux basis from within their bodies, and on concentration basis from its mantle space. 
         The three symbiont populations receive their substrate and product on concentration basis. 
         Diffusive transport between environment, the hosts' mantle spaces and hosts' bodies for both products and symbionts' substrate. </LI>
    <LI> <B>4</B> like level 3, but only with the internal population of symbionts is presented; the populations of symbionts in hosts' mantle spaces and in the free environment are assumed to be extinct. 
         Hosts' mantle space is still delineated to capture the concentration gradients for symbionts' substrate and both products with diffusive transport of these three chemicals between environment, the hosts' mantle spaces and hosts' bodies for both products and symbionts' substrate. </LI>
    <LI> <B>5</B> two one-structure one-reserve populations; one population (= endosymbiont) lives inside the other (= host) and obtains its substrate and hosts' product from inside the host on concentration basis. 
         Hosts' mantle space is no longer delineated. 
         The host recieves symbionts' product on flux basis from within its body, and on concentration basis from the environment. 
         Diffusive transport between environment and hosts' body for both products and symbionts' substrate. </LI>
    <LI> <B>6</B> a single two-structures two-reserves population; 
         each reserve is synthesized from one substrate (from the environment and fed on concentration basis) and one product (synthesized internally and fed on flux basis). </LI>
    <LI> <B>7</B> a single one-structure two-reserves population; 
         each reserve is synthesized from one substrate (from the environment) and one product (synthesized internally and fed on flux basis). 
         So two products are produced, and reserves are excreted (due two stoichiometric restrictions on growth, but recovery fractions are tunable via parameters). </LI>
    <LI> <B>8</B> a single one-structure one-reserve population feeding on two complementary substrates and producing two products. </LI>
  </UL>

  <p>
  The theory for the models can be found in: 
  <br> 
  <NAME>, <NAME>, <NAME> and <NAME>.  Kooi 2003
  <A HREF="http://www.bio.vu.nl/thb/research/bib/KooyAuge2003.html">
  Quantitative steps in symbiogenesis and the evolution of homeostasis.</A> 
 
  <p>
  The paper describes the trophic relationships between two species that become fully interlocked in an endosymbiontic relationship in 8 steps starting from complete independence. 
  Each species feeds on a single substrate and produces a single product, which is taken up by the other species. 
  The substrate and product for each species are initially substitutable, and then become complementary. 
  The species initially live freely in a homogeneous reactor; 
  later the future endosymbiont has three populations: free-living, inside the mantle space of the future host, and inside the host. 
  Each species initially has a single reserve and single structure. 
  First the structures merge, then the reserves. Eventually a single species with one structure and one reserve emerges.
  
  <p>
  The two (and later one) populations of live in a homogeous generalized reactor, where feeding rates of substrates and leaking rates of state variable are each controlled by parameters; 
  The steady state analysis is just for chemostats, where the specific leaking rates of all state variables are equal, and the feeding rates are proportional to the leaking rates.


  <p>
  Example of use after (optionally) editing file <code>pars*.m</code>: 
  <code>endosym</code>

<HR>
<H4><A NAME="pars*">pars*</A></H4>

  Read <code>pars*.m</code> as one of the folling options: 
  <code>pars_endosym.m</code>, <code>pars0.m</code>, </code>pars1.m</code>, .., <code>pars8.m</code>. 
  The * refers to the level of merging between hosts and symbionts, see above. 
  The file <code>pars_endosym.m</code> specifies the parameters of all levels simultaneously. 
  The present version of shtime* and shstate* all make use of this single file.

  <p>
  Set the parameters by editing file <code>pars*.m</code> in toolbox <code>endosym</code>. 
  The parameter vector <code>istate*</code> initializes the state variables for integration in <code>shtime*</code>. 

<HR>
<H4><A NAME="shtime*">shtime*</A></H4>

  Read <code>shtime*</code> as one of the folling options: <code>shtime0</code>, <code>shtime1</code>, .., <code>shtime8</code>. 
  The * refers to the level of merging between hosts and symbionts, see above.

  <p>
  Generalized reactor; 
  Initial conditions can be changed by editing the file <code>pars*.m</code>.<br>
  The figures depent on the choice of merging level (0-8). 
  They show variables as functions of time. Some also show ratio's of structures and reserves, to illustrate the degree of homeostasis.

  <p>
  Example of use after editing <code>pars*.m</code>: 
  <code>clear all; shtime*</code>.<br> 
  The command <code>clear; shtime6 (4)</code> will only plot fig <B>4</B> at merging level 6.

<HR>
<H4><A NAME="shstate*">shstate*</A></H4>

  Read <code>shstate*</code> as one of the folling options: 
  <code>shstate0</code>, <code>shstate1</code>, .., <code>shstate8</code>. 
  The * refers to the level of merging between hosts and symbionts, see above.

  <p>
  Chemostat in equilibrium for all not-trivial throughput rates; 
  the computations might take some time. If continuation fails, time-integration is used to arrive at a initial guess of the states of the system.

  <p>
  The figures depent on the choice of merging level (0-8). 
  They show variables as functions of te throughput rate. 
  Some also show ratio's of structures and reserves, to illustrate the degree of homeostasis.

  <p>
  Example of use after editing <code>pars*.m</code>: 
  <code>clear all; shstate*</code>.<br> 
  The command <code>clear; shstate6 (3)</code> will only plot fig <B>3</B> at merging level 6.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>docs/index_left_new.html<|end_filename|>
<HTML>
<HEAD>
  <TITLE>DEBtool_new</TITLE>
</HEAD>

<BODY BGCOLOR="#AADD77" TEXT="#000000" LINK="#000000" 
      VLINK="#000000" ALINK="#000000">

<IMG SRC="amg.gif" width="96" height="89" ALIGN=BOTTOM>

<P>
<A HREF="http://www.bio.vu.nl/thb/deb/deblab/" TARGET="_top">DEBlab
      </A>
<BR>
<A HREF="index.html" TARGET="_top">DEBtool</A>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0>
  <TR>
      <TD><A HREF="DEBtool_new.html#2013/08/22" TARGET="main"> 
          2013/08/22</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2013/07/05" TARGET="main"> 
          2013/07/05</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2012/10/30" TARGET="main"> 
          2012/10/30</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2012/10/09" TARGET="main"> 
          2012/10/09</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2012/10/01" TARGET="main"> 
          2012/10/01</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2012/09/10" TARGET="main"> 
          2012/09/10</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2012/07/18" TARGET="main"> 
          2012/07/18</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/10/31" TARGET="main"> 
          2011/10/31</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/09/14" TARGET="main"> 
          2011/09/14</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/08/18" TARGET="main"> 
          2011/08/18</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/07/22" TARGET="main"> 
          2011/07/22</A></TD>
  </TR>  
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/06/16" TARGET="main"> 
          2011/06/16</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/04/20" TARGET="main"> 
          2011/04/20</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/03/07" TARGET="main"> 
          2011/03/07</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2011/01/21" TARGET="main"> 
          2011/01/21</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/10/31" TARGET="main"> 
          2010/10/31</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/09/29" TARGET="main"> 
          2010/09/29</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/06/28" TARGET="main"> 
          2010/06/28</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/05/06" TARGET="main"> 
          2010/05/06</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/04/30" TARGET="main"> 
          2010/04/30</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/04/13" TARGET="main"> 
          2010/04/13</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/03/30" TARGET="main"> 
          2010/03/30</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/03/18" TARGET="main"> 
          2010/03/18</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/03/08" TARGET="main"> 
          2010/03/08</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/03/04" TARGET="main"> 
          2010/03/04</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/03/01" TARGET="main"> 
          2010/03/01</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/02/25" TARGET="main"> 
          2010/02/25</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/02/15" TARGET="main"> 
          2010/02/15</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2010/02/11" TARGET="main"> 
          2010/02/11</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/10/25" TARGET="main"> 
          2009/10/25</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/08/05" TARGET="main"> 
          2009/08/05</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/08/03" TARGET="main"> 
          2009/08/03</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/07/29" TARGET="main"> 
          2009/07/29</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/07/13" TARGET="main"> 
          2009/07/13</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/03/31" TARGET="main"> 
          2009/03/31</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/03/18" TARGET="main"> 
          2009/03/18</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/02/22" TARGET="main"> 
          2009/02/22</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/02/05" TARGET="main"> 
          2009/02/05</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2009/01/05" TARGET="main"> 
          2009/01/05</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2008/09/18" TARGET="main"> 
          2008/09/18</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2008/09/05" TARGET="main"> 
          2008/09/05</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2008/08/10" TARGET="main"> 
          2008/08/10</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2008/06/09" TARGET="main"> 
          2008/06/09</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2008/03/17" TARGET="main"> 
          2008/03/17</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2008/02/10" TARGET="main"> 
          2008/02/10</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2007/10/03" TARGET="main"> 
          2007/10/03</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2007/09/17" TARGET="main"> 
          2007/09/17</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2007/09/10" TARGET="main"> 
          2007/09/10</A></TD>
  </TR>
  <TR>
      <TD><A HREF="DEBtool_new.html#2007/08/14" TARGET="main"> 
          2007/08/14</A></TD>
  </TR>

</TABLE>


</BODY>
</HTML>




<|start_filename|>docs/DEBtool_lib_prob.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_lib_prob</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: lib/prob</H3>

  Routines that relate directly or indirectly to probability calculus. 

<H4><A NAME="surv">Survivor functions</A></H4>

Function <a HREF="../lib/prob/html/surv.html"><code>surv</code></a> gives plot-cordinates of an empirical survivor function; 
<a HREF="../lib/prob/html/frac.html"><code>frac</code></a> calculates empirical survivor probabilities. 
Function <a HREF="../lib/prob/html/lik2surv.html"><code>lik2surv</code></a> calculates the survivor function from the -2 log lik ratio function;
<a HREF="../lib/prob/html/haz2surv.html"><code>haz2surv</code></a> does that from the hazard rate; 

<p>
Functio  <a HREF="../lib/prob/html/surv_chi.html"><code>surv_chi</code></a>calculates the survivor probability of the Chi-square distribution;  <a HREF="../lib/prob/html/surv_f.html"><code>surv_f</code></a> does so for the F-distribution, with <a HREF="../lib/prob/html/survi_f.html"><code>survi_f</code></a> is its inverse.

<p>
Function <a HREF="../lib/prob/html/surv_count.html"><code>surv_count</code></a>
obtains Monte Carlo counts for the number of surviving subjects in time.


<H4><A NAME="mean">Means</A></H4>

Function <a HREF="../lib/prob/html/fnchd.html"><code>fnchd</code></a> obtains the expected value of Fisher's non-central hypergeometric distribution.
Function <a HREF="../lib/prob/html/ellipse.html"><code>ellipse</code></a> gets cordinates of isoclines of the bivariate normal pdf.

<p>
Function <a HREF="../lib/prob/html/bincoeff.html"><code>bincoeff</code></a> gets binomial coefficients.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/Odesolvers/ebtrk4.c<|end_filename|>
/***
   NAME
     ebtrk4
   DESCRIPTION
     This file contains the specification of the 4th order Runga-Kutta
     integration method with fixed stepsize for the time integration of the
     ODEs in the Escalator Boxcar Train program.
   NOTES
     
   HISTORY
     Last modification: AMdR - Jan 07, 2012
***/
#ifndef EBTRK4
#define EBTRK4
#endif



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define MAFO "Memory allocation failure in ODE integration routine!"



/*==========================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

static long		ODEAllocated = 0L, SystemSize;
static double		*xin = NULL, *xtemp = NULL;
static double		*der1 = NULL, *der2 = NULL, *der3 = NULL;
#if (POPULATION_NR > 0)
static int		table_size[POPULATION_NR];
static population	u_pop[POPULATION_NR], 	   u_ofs[POPULATION_NR];
static population	u_popgrad1[POPULATION_NR], u_ofsgrad1[POPULATION_NR];
static population	u_popgrad2[POPULATION_NR], u_ofsgrad2[POPULATION_NR];
static population	u_popgrad3[POPULATION_NR], u_ofsgrad3[POPULATION_NR];
#else
static population	*bpoints = NULL;
static population	*u_pop = NULL, 	    *u_ofs = NULL;
static population	*u_popgrad1 = NULL, *u_ofsgrad1 = NULL;
static population	*u_popgrad2 = NULL, *u_ofsgrad2 = NULL;
static population	*u_popgrad3 = NULL, *u_ofsgrad3 = NULL;
#endif // (POPULATION_NR > 0)



/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

void	PrepareCycle()

  /* 
   * PrepareCycle - This routine is called at the beginning of a cohort
   *		    cycle, when the size of the system of ODEs is fixed and
   *		    will not change until the end of the cohort cycle has
   *		    been reached. The different memory copies of the data
   *		    to be integrated and the pointers into the data heap
   *		    can hence safely be set up.
   */

{
  SystemSize    = ENVIRON_DIM;

#if (POPULATION_NR > 0)
  register int		i;

  for(i=0; i<POPULATION_NR; i++)
    {
      table_size[i] = CohortNo[i]+BpointNo[i];
      SystemSize   += table_size[i]*COHORT_SIZE;
    }
#endif // (POPULATION_NR > 0)

  if (!(SystemSize < ODEAllocated))
    {
      ODEAllocated = MemBlocks(SystemSize);
      xin   = (double *)Myalloc((void *)xin, (size_t)ODEAllocated,
				sizeof(double));
      xtemp = (double *)Myalloc((void *)xtemp, (size_t)ODEAllocated,
				sizeof(double));
      der1  = (double *)Myalloc((void *)der1, (size_t)ODEAllocated,
				sizeof(double));
      der2  = (double *)Myalloc((void *)der2, (size_t)ODEAllocated,
				sizeof(double));
      der3  = (double *)Myalloc((void *)der3, (size_t)ODEAllocated,
				sizeof(double));
      if(!(xin && xtemp && der1 && der2 && der3))
	ErrorAbort(MAFO);
    }

  (void)memcpy((DEF_TYPE *)xin,			/* Copy environment vars.   */
	       (DEF_TYPE *)env,
	       ENVIRON_DIM*sizeof(double));
#if (POPULATION_NR > 0)
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)(xin+len),	/* Copy all populations     */
		   (DEF_TYPE *)pop[i],
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      u_pop[i] = (population)(xtemp+len);
      u_ofs[i] = (population)(xtemp+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad1[i] = (population)(der1+len);
      u_ofsgrad1[i] = (population)(der1+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad2[i] = (population)(der2+len);
      u_ofsgrad2[i] = (population)(der2+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad3[i] = (population)(der3+len);
      u_ofsgrad3[i] = (population)(der3+len+CohortNo[i]*COHORT_SIZE);
      len += (table_size[i]*COHORT_SIZE);
    }
#endif // (POPULATION_NR > 0)


  return;
}




/*==========================================================================*/

double	  IntegrationStep(double del_tim, double del_max, int recurs)

  /* 
   * IntegrationStep - Performs an integration with fixed step size but 
   *                   maximum "del_max". 
   */
  
{
  register int		i;
  double		del_h, hh, h6;
  
  del_h = min(accuracy, del_max);
  hh    = del_h*0.5;
  h6    = del_h/6.0;

  initState = xin;
  currentState = xtemp;
  currentDers[1] = der1;
  currentDers[2] = der2;
  currentDers[3] = der3;

  der1[0] = der2[0] = der3[0] = 1.0;		/* Set all time derivatives */

  (void)memcpy((DEF_TYPE *)xtemp, (DEF_TYPE *)xin,
	       SystemSize*sizeof(double));
  rk_level = 1;
  Gradient(xtemp, u_pop, u_ofs, der1, u_popgrad1, u_ofsgrad1, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + hh*der1[i];
  rk_level = 2;
  Gradient(xtemp, u_pop, u_ofs, der2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + hh*der2[i];
  rk_level = 3;
  Gradient(xtemp, u_pop, u_ofs, der3, u_popgrad3, u_ofsgrad3, bpoints);

  for (i=0; i<SystemSize; i++)
    {
      xtemp[i] = xin[i] + del_h*der3[i];
      der3[i] += der2[i];
    }
  rk_level = 4;
  Gradient(xtemp, u_pop, u_ofs, der2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + h6*(der1[i]+der2[i]+2.0*der3[i]);

						/* Update basic data copy   */
  (void)memcpy((DEF_TYPE *)env,			/* Copy environment vars.   */
	       (DEF_TYPE *)xtemp,
	       ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)pop[i],		/* Copy all populations     */
		   (DEF_TYPE *)(xtemp+len),
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      len += (table_size[i]*COHORT_SIZE);
    }
#endif // (POPULATION_NR > 0)
						/* Update local data copy   */
  (void)memcpy((DEF_TYPE *)xin,(DEF_TYPE *)xtemp,
	       SystemSize*sizeof(double));

  return del_h;
}



/*==========================================================================*/


<|start_filename|>lib/regr/html/pregr2.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>pregr2</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="pregr2.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Output</a></li><li><a href="#6">Remarks</a></li><li><a href="#7">Example of use</a></li><li><a href="#8">Code</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [cov, cor, sd, ss] = pregr2 (func, p, x, y, Z, W)
</pre><pre class="codeinput">  <span class="comment">%  created: 2002/02/05 by <NAME>, modified 2010/05/08</span>
  <span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>Calculates covariance matrix and standard deviations of parameters in
regression models, like pregr, but for 2 independent variables.</pre><h2>Input<a name="4"></a></h2><pre>func: character string with name of user-defined function
  f = func (p, x, y) with x: n-vector; y: m-vector; p: k-vector
  f: (n,m)-matrix with model-predictions for dependent variable
  see regr2_NR
p: (2,k) matrix with
   p(1,:) parameter values
   p(2,:) binaries with yes or no conditional values
   all conditional parameters have zero (co)variance
x: (n,1)-vector with first independent variable
y: (m,2)-vector with second independent variable
Z: (n,m)-matrix with dependent variable
W: (n,m)-matrix with weight coefficients</pre><h2>Output<a name="5"></a></h2><pre>cov: (k,k) matrix with covariances
cor: (k,k) matrix with correlation coefficients
sd: (k,1) matrix with standard deviations
ss: scalar with weighted sum of squared deviations</pre><h2>Remarks<a name="6"></a></h2><pre>calls nrdregr2, and user-defined function 'func'
The elements in the covariance and correlation matrices equal zero
  for parameters that have code 0 in the second row of the parameter input matrix.
The values are the maximum likelihood estimates in the case of a identially normally distributed scatter distribution.
Therefore, no corrections for bias are made.</pre><h2>Example of use<a name="7"></a></h2><pre>assuming that function_name, pars, xvalues, yvalues, zdata, and weights are defined properly:
[cov, cor, sd, ss] = pregr2('function_name', pars, xvalues, yvalues, zdata, weights) .</pre><h2>Code<a name="8"></a></h2><pre class="codeinput">  <span class="keyword">global</span> nxy n_pars index;

  [np, k] = size(p); <span class="comment">% np is number of parameters</span>
  index = 1:np;
  <span class="keyword">if</span> k&gt;1
    index = index(1 == p(:,2)); <span class="comment">% indices of iterated parameters</span>
  <span class="keyword">end</span>
  n_pars = size(index, 2); <span class="comment">%number of parameters that must be iterated</span>
  <span class="keyword">if</span> (n_pars == 0)
    <span class="keyword">return</span>; <span class="comment">% no parameters to iterate</span>
  <span class="keyword">end</span>

  [nx, ny] = size(Z); <span class="comment">% nx,ny is number of values of dependent variables</span>
  nxy = nx * ny; <span class="comment">% total number of data points</span>
  <span class="keyword">if</span> exist(<span class="string">'W'</span>) ~= 1
    W = ones(nx, ny);
  <span class="keyword">end</span>

  W = W/ sum(sum(W)); WW = reshape(W, nxy, 1);

  [f, df] = nrdregr2(func, p(:,1), x, y);
  ss = sum(sum((W .* (f - Z) .^ 2))); <span class="comment">% weighted sum of squares</span>
  cov = zeros(np,np); cor = cov; <span class="comment">% initiate cov and cor matrix</span>
  cov(index, index) = inv(df' * (df .* WW(:,ones(1, n_pars))))/ nxy;
  cov = cov * ss;
  sd = sqrt(diag(cov)); <span class="comment">% standard deviations</span>
  cor(index, index) = cov(index, index) ./ (sd(index) * sd(index)');
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [cov, cor, sd, ss] = pregr2 (func, p, x, y, Z, W)
  %  created: 2002/02/05 by <NAME>, modified 2010/05/08
  %
  %% Description
  %  Calculates covariance matrix and standard deviations of parameters in
  %  regression models, like pregr, but for 2 independent variables. 
  %
  %% Input
  %  func: character string with name of user-defined function
  %    f = func (p, x, y) with x: n-vector; y: m-vector; p: k-vector
  %    f: (n,m)-matrix with model-predictions for dependent variable
  %    see regr2_NR
  %  p: (2,k) matrix with
  %     p(1,:) parameter values
  %     p(2,:) binaries with yes or no conditional values
  %     all conditional parameters have zero (co)variance
  %  x: (n,1)-vector with first independent variable
  %  y: (m,2)-vector with second independent variable
  %  Z: (n,m)-matrix with dependent variable
  %  W: (n,m)-matrix with weight coefficients
  %
  %% Output
  %  cov: (k,k) matrix with covariances
  %  cor: (k,k) matrix with correlation coefficients
  %  sd: (k,1) matrix with standard deviations
  %  ss: scalar with weighted sum of squared deviations
  %
  %% Remarks
  %  calls nrdregr2, and user-defined function 'func'
  %  The elements in the covariance and correlation matrices equal zero 
  %    for parameters that have code 0 in the second row of the parameter input matrix. 
  %  The values are the maximum likelihood estimates in the case of a identially normally distributed scatter distribution. 
  %  Therefore, no corrections for bias are made.
  %
  %% Example of use
  %  assuming that function_name, pars, xvalues, yvalues, zdata, and weights are defined properly: 
  %  [cov, cor, sd, ss] = pregr2('function_name', pars, xvalues, yvalues, zdata, weights) . 

  %% Code
  global nxy n_pars index;
  
  [np, k] = size(p); % np is number of parameters
  index = 1:np;
  if k>1
    index = index(1 == p(:,2)); % indices of iterated parameters
  end
  n_pars = size(index, 2); %number of parameters that must be iterated
  if (n_pars == 0)
    return; % no parameters to iterate
  end

  [nx, ny] = size(Z); % nx,ny is number of values of dependent variables
  nxy = nx * ny; % total number of data points
  if exist('W') ~= 1
    W = ones(nx, ny);
  end

  W = W/ sum(sum(W)); WW = reshape(W, nxy, 1); 
     
  [f, df] = nrdregr2(func, p(:,1), x, y);
  ss = sum(sum((W .* (f - Z) .^ 2))); % weighted sum of squares
  cov = zeros(np,np); cor = cov; % initiate cov and cor matrix
  cov(index, index) = inv(df' * (df .* WW(:,ones(1, n_pars))))/ nxy;
  cov = cov * ss;
  sd = sqrt(diag(cov)); % standard deviations
  cor(index, index) = cov(index, index) ./ (sd(index) * sd(index)');
##### SOURCE END #####
--></body></html>

<|start_filename|>docs/DEBtool_exercise.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>DEBtool exercise</TITLE>

  <META 
    NAME ="keywords" CONTENT="DEBtool, Dynamic Energy Budget theory, Dynamic Energy Budgets, DEB theory, DEB theorie, DEB" >
  <META 
    NAME="description" CONTENT="Software package DEBtool">
  <META NAME="distribution" CONTENT="global">
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>DEBtool exercise</H1>

  <P ALIGN="center"> 
  by <A HREF="mailto:<EMAIL>"><NAME></A>, 1 Nov 2009


<H2><A NAME="intro">Introduction</A></H2>

  Open the DEBtool manual <A TARGET="_top" HREF="index.html"><code>index.html</code></A> in the subdirectory <code>manual</code> of DEBtool with some browser (e.g. Explorer, Netscape, Mozilla). 
  If you can read this page you probably already opened it with such a browser; 
  open the manual in a new window to see the exercise and the manual simultaneously. 
  Read the sections on <A TARGET="main" HREF="DEBtool.html#Use"> Use & recommendations</A> and <A TARGET="main" HREF="DEBtool.html#Nomenclature"> Nomenclature</A> of the first page of the DEBtool manual. 
  Click on <A TARGET="_top" HREF="index_contents.html"> Contents</A> to see the various toolboxes (subdirectories) of DEBtool. 
  Visit the <A TARGET="_top" HREF="index_first.html"> Octave intro</A> pages briefly, to know that they offer you a fast introduction to the computer language Octave (or Matlab). 
  It will not be necessary to know anything about Octave in this exercise, but you should be able to change files with an editor that is able to read and
write plain ascii files (e.g. Notepath or Word under Windows, or Emacs; 
  it is essential that the editor does not insert hidden non-ascii characters, which e.g. Word easily does without notice;
  Windows can suppress extensions of file names; 
  Octave can only handle file names with extension .m). 
  In the case that you plan to use Emacs as a text editor (and run Octave under Emacs) a brief visit to <A TARGET="_top" HREF="index_first_e.html"> Emacs intro</A> might be useful. 
  Links to the  manuals of Octave, Gnuplot and Emacs are included in the DEBtool package (these manuals are big).

  <P>
  Start Octave now. 
  A window should open. 
  Test the correct response by Octave by typing <code>1 + 2</code> (followed by the <code>enter</code> key, as allways after a command); 
  Octave should respond with an answer. 
  Try the arrow-keys to regenerate your earlier command, change it and repeat your command.

  <P>
  Check with <code>pwd</code> that Octave has been started in the directory DEBtool. 
  Octave replies with showing the path. 
  If Octave is in a different directory, go to the DEBtool directory using <code>cd pathname</code>, where <code>pathname</code> stands for the path to
DEBtool. 
  The command <code>ls</code> lists the files and subdirectories of DEBtool; 
  you should recognize the names that are listed in the contents.

<H2><A NAME="animal">Animal</A></H2>

  Click on <A TARGET="_top" HREF="index_contents.html"> Contents</A> in the DEBtool manual, and go to <A TARGET="_top" HREF="index_animal.html"> animal</A>. 
  Now go to the animal subdirectory in the Octave window with <code>cd animal</code>. 
  Now open the file <code>pars_animal.m</code> of the subdirectory animal with some text editor.

  <P>
  The parameter file <code>pars_animal.m</code> of animal show a large number of parameters with a short description of each. 
  Any particular function that uses a small number of parameters only. 
  DEBtool allows you to specify parameter values at a certain temperature, and evaluate properties of energetics at another temperature. 
  The first set of parameters are used to do this translation; 
  as long as the value to T equals that of T<sub>1</sub>, the other temperature parameters are not relevant.  
  The second set of parameters are on the chemical composition of the main variables, which are necessary e.g. for specifying mineral fluxes. 
  The next set of parameters link volumes, weights and energies to each other. 
  Notice that <b>structure's molar density</b> [M<sub>V</sub>] = d<sub>V</sub>/ w<sub>V</sub>, while <b>structure's density</b> d<sub>V</sub> is a parameter (weight per volume), and <b>structure's molecular weight</b> w<sub>V</sub> is given by the elemental composition. 
  The last two sets of parameters have no influence on what the organism is doing, but do affect the behaviour of measurements. 
  The last set of 14 parameters directly affect the metabolic behaviour of the organism.

  <P>
  The chosen parametrization for animal's metabolic behaviour avoids to deal with surface areas directly, while food uptake is coupled to the surface area. 
  The reason is to make the parameters for isomorphs better comparable with those for V1-morphs. 
  The following relationships might clarify the links between parameters:
  <ul>
   <li> <b>max mol-specific food uptake rate</b> 
        j<sub>XAm</sub> = {J<sub>XAm</sub>}/ ([M<sub>V</sub>] L<sub>d</sub>); 
        dim(j<sub>XAm</sub>) = mol of food (mol of structure * time)<sup>-1</sup> </li>
   <li> <b>max mol-specific reserve in moles</b> 
        m<sub>Em</sub> = [M<sub>Em</sub>]/ [M<sub>V</sub>]; 
        dim(m<sub>Em</sub>) =  mol of reserve (mol of structure)<sup>-1</sup> </li> 
   <li> <b>energy conductance</b>
        v = y<sub>EX</sub> {J<sub>XAm</sub>}/ [M<sub>Em</sub>] = {J<sub>EAm</sub>}/ [M<sub>Em</sub>]; 
        dim(v) = length of structure * time<sup>-1</sup> </li>
  </ul>
  From these parameters, the following compound parameters are obtained in the routine <code>parscomp</code>, which is called from <code>pars_animal</code>.
  <ul>
    <li> <b>characteristic length</b>
         L<sub>d</sub> = v m<sub>Em</sub>/ (y<sub>EX</sub> j<sub>XAm</sub>); 
         dim(L<sub>d</sub>) = length of structure </li>
    <li> <b> structural lenght at birth</b>
         L<sub>b</sub> = 
         (M<sub>Vb</sub> w<sub>O</sub>(2)/ d<sub>O</sub>(2))<sup>1/3</sup>;
         dim(L<sub>b</sub>) = length of structure </li>
    <li> <b> structural length at puberty</b>
         L<sub>p</sub> = (M<sub>Vp</sub> w<sub>O</sub>(2)/ d<sub>O</sub>(2))<sup>1/3</sup>;
         dim(L<sub>p</sub>) = length of structure </li>
    <li> <b> maximum structural length</b>
         L<sub>m</sub> = v/ (k<sub>M</sub> g); 
         dim(L<sub>m</sub>) = length of structure </li>
    <li> <b>max surface area-specific food uptake rate</b>
         {J<sub>XAm</sub>} = j<sub>XAm</sub> L<sub>d</sub> [M<sub>V</sub>] = [M<sub>V</sub>] v m<sub>Em</sub>/ y<sub>EX</sub>; 
         dim({J<sub>XAm</sub>})= mol of food * time<sup>-1</sup> * length of structure<sup>-2</sup> </li>
    <li> <b>max volume-specific reserve in moles</b>
         [M<sub>Em</sub>] = [M<sub>V</sub>] m<sub>Em</sub>; 
         dim([M<sub>Em</sub>]) = mol of reserve (volume of structure)<sup>-1</sup> </li> 
  </ul>
  The <b>maintenance rate coefficient</b> k<sub>M</sub> = j<sub>EM</sub>/ y<sub>EV</sub> equals the <b>specific maintenance costs</b> j<sub>EM</sub> relative to the <b>growth costs</b> y<sub>EV</sub>; 
  dim(k<sub>E</sub>) = time<sup>-1</sup>.

  <P>
  Read what the function <A TARGET="main" HREF="DEBtool_animal.html#animal"><code>animal</code></A> should be doing in the manual and type <code>animal</code>; 
  given some patience, you will see a window that is opened automatically by Gnuplot, that show you the various aspects of animal energetics. 
  By typing some character, for instance a space, you go from one set of graphs in the gnuplot window to the next set. 
  So you can take your time looking at the various graphs. Select the "full screen" option to maximize the size of the windows; 
  some graphs will still be small.

<H2><A NAME="heating">Effect of heating</A></H2>

<H4> On growth of length</H4>

  Search for <A TARGET="main" HREF="DEBtool_animal.html#shtime2length"><code>shtime2length</code></A> in the DEBtool manual and read the description. 
  Type <code>pars_animal; shtime2length</code>, and you will see one of the graphs you already saw after typing <code>animal</code> in the introductory
paragraph of this excersize. Search for parameter <code>L_T</code> in the file <code>pars_animal.m</code> and change the value 0 by 0.1. 
  Think about what effect this should have on the growth of body length. 
  Save the file;
  if saving gives problems, change the properties of the file, it is possibly stored as "read only" (under Windows: click on the file with the right-hand button of the mouse, and go to properties). 
  Now type <code>pars_animal; shtime2length</code> to see the effects of an increase in the heating costs.

<H4> On growth flux</H4>

  Search for <A TARGET="main" HREF="DEBtool_animal.html#shflux"><code>shflux</code></A> in the DEBtool manual and read the description. 
  Type <code>pars_animal; shflux</code>, and you will see one of the windows you already saw after typing <code>animal</code> in the introductory paragraph of this exercise. 
  Type <code>pars_animal; shflux(2)</code> to see the growth flux as a function of the scaled length, and on full screen. 
  Search for parameter <code>L_T</code> in the file <code>pars_animal.m</code> and change the value 0 by 0.1. 
  Think about what effect this should have on the growth flux. Save the file. 
  Now type <code>pars_animal; shflux(2)</code> to see the effects of an increase in the heating costs. 
  Change the value of <code>L_T</code> back to zero.

<H4> On scaling of respiration with body weight</H4>

  Search for <A TARGET="main" HREF="DEBtool_animal.html#shscale"><code>shscale</code></A> in the DEBtool manual and read the description. 
  Type <code>pars_animal; shscale</code>, and you will see one of the windows you already saw after typing <code>animal</code> in the introductory paragraph of this excersize. 
  Type <code>pars_animal; shscale(3)</code> to see the scaling of dioxygen consumption with body weight only, and on full screen. 
  Search for parameter <code>L_T</code> in the file <code>pars_animal.m</code> and change the value 0 by 0.1. 
  Think about what effect this should have on the scaling of dioxygen consumption with body weight. 
  Save the file. 
  Now type <code>pars_animal; shscale(3)</code> to see the effects of an increase in the heating costs.

  <P>
  You can change other parameters as well, of course. 
  Do not forget to run <code>pars_animal</code> after changing a parameter value. 
  It is easy to use parameter values that have no physiological meaning, and DEBtool does not check the values. 
  If you want to memorise the old values, duplicate the line you want to change first and change the value in the second line. 
  Delete double lines when done. 
  Consider the use of <code>clear</code> regularly to make sure that values of variables are used that escape your notice.

<H2><A NAME="maint">Maintenance rate coefficient from growth curves</A></H2>

  Suppose that for three constant food densities, we found for the body length of an isomorph as function of time the following data
  <table align ="center" >
    <tr>
      <th> time in weeks</th>
      <th> 0 </th>
      <th> 1 </th>
      <th> 2 </th>
      <th> 3 </th>
      <th> 4 </th>
    </tr>
    <tr> 
      <th> first series in cm</th> 
      <td> 1 </td> 
      <td> 2 </td>
      <td> 2.5 </td>
      <td> 2.8 </td>
      <td> 2.9 </td>
    </tr>
    <tr>
      <th> second series in cm</th>
      <td> 1 </td>
      <td> 2.3 </td>
      <td> 3 </td>
      <td> 3.5 </td>
      <td> 3.7 </td>
    </tr>
    <tr> 
      <th> third series in cm</th>
      <td> 1 </td>
      <td> 2.5 </td>
      <td> 3.5 </td>
      <td> 4.1 </td>
      <td> 4.4 </td>
    </tr>
  </table>
  We failed to measure the food densities and the types of food differed in the three cases. 
  Find an estimate for the maintenance rate coefficient, and its standard deviation on the assumption that the scatter is normally distributed with a constant variance. 
  Compare the result using the assumption that the variance of the scatter is proportional to the squared mean. Check your results graphically.
  Is the type of food relevant for the problem? 
  Hints:
  <ul> 
    <li> The DEB theory implies that, at constant food density, the length of an isomorph follows a von Bertalanffy growth curve
         L(t) = L<sub>i</sub> - (L<sub>i</sub> - L<sub>b</sub>) e<sup>-r<sub>B</sub>t</sup>.  
         The DEB theory states that the von Bertalanffy growth rate equals 
         r<sub>B</sub> = (3/k<sub>M</sub> + 3d<sub>M</sub>L<sub>i</sub>/ v)<sup>-1</sup>, 
         where 
         k<sub>M</sub> is the rate coefficient, 
         d<sub>M</sub> the shape coefficient, 
         v the energy conductance, 
         L<sub>b</sub> the length at birth, 
         L<sub>i</sub> the ultimate length, 
         t the time. </li>
    <li> use function 
         <A TARGET="main" HREF="DEBtool_lib_regr.html#nrregr"><code>nrregr</code></A> or 
         <A TARGET="main" HREF="DEBtool_lib_regr.html#nmregr"><code>nmregr</code></A>
         for standard multi-sample regression, function 
         <A TARGET="main" HREF="DEBtool_lib_regr.html#pregr"><code>pregr</code></A> for the standard deviation, function 
         <A TARGET="main" HREF="DEBtool_lib_regr.html#shregr"><code>shregr</code></A> with the all-in-one option for graphical checking, function 
         <A TARGET="main" HREF="DEBtool_lib_regr.html#nmvcregr"><code>nmvcregr</code></A> for regression with constant variation coefficient. </li>
    <li> copy and modify file <code>mydata_regr.m</code> in subdirectory <code>lib/regr</code> for a rapid solution of the problem. 
         This script-file first illustrates how to fit a single model to a single data set, then how to fit two models to two data sets. 
         We here need three models for three data sets, all three similar to the second model, but the von Bertalanffy growth rates of the three sets are now linked. </li>
    <li> realize that we have to fit 6 parameters to the three growth curves: 
         L<sub>b</sub>, L<sub>i,1</sub>, L<sub>i,2</sub>, L<sub>i,3</sub>, k<sub>M</sub>, v/d<sub>M</sub>. 
         Since v and d<sub>M</sub> only occur in combination, these data do not contain information on the two parameters separately, only on the ratio. 
         Also realize that we need three data files to run the regression functions. 
         One way to do this is to create a single data set first, with the name <code>data</code> with time in column 1, and the three series of lengths in columns 2, 3 and 4. 
         Then use <code>data(:,[1 2]),data(:,[1 3]),data(:,[1 4])</code> in the call to the regression routines.
    </li>
  </ul>
  If these hints are not sufficient, look at file <code>lib/regr/mydata_regr_2.m</code> to see the answer. 

  <p>
  This example illustrates that DEB theory allows us to extract information from a combination of data sets, which is not contained in any data set separately. 
  The von Bertalanffy has three parameters. 
  If the data sets have no relationships with each other, we would need 9 parameters; 
  if all initial lengths are equal, we would have 7 parameters. 
  DEB theory implies a link between the data sets, which reduces the number of parameters to 6, with a special meaning. 
  Notice that lack of knowledge on the feeding levels makes that we are dealing here with a collection of length-time curves rather than a surface. 
  If the scaled functional response f has been measured, and DEB theory tells us that L<sub>i</sub> = f L<sub>m</sub>, we would have length as a functon of time and scaled functional response with 4 parameters:
  L<sub>b</sub>, L<sub>m</sub>, k<sub>M</sub>, v/d<sub>M</sub>.

<H2><A NAME="alga">Alga</A></H2>

  Go to the alga subdirectory with <code>cd ../alga</code> and open the file <code>alga/pars_alga.m</code> with some text editor.

  <P>
  The parameter file <code>pars_alga.m</code> gives a short description of each parameter for a 2 reserve 1 structure alga that lives of ammonia and phosphate in a generalized chemostat. 
  The first set of parameters are used to do temperature translations, like in <code>animal</code>; 
  as long as the value to T equals that of T_1, the other temperature parameters are not relevant. 
  The second set of parameters are on the chemical composition of the main variables, which are necessary e.g. for specifying mineral fluxes. 
  The third set of parameters directly affect the metabolic behaviour of the organism, while the last set specifies the local environment of the chemostat. 
  If all specific draining rates are set equal to the specific supply rate, the generalized chemostat is a standard one.

  <P>
  Read what the function <A TARGET="main" HREF="DEBtool_alga.html#alga"><code>alga</code></A> should be doing in the manual and type <code>alga</code>. 
  Let us focus on the steady states of a chemostat, where excreted reserves can be re-used. 
  Read the manual on <A TARGET="main" HREF="DEBtool_alga.html#shchem1"><code>shchem1</code></A> and run <code>shchem1</code>.

  <P>
  Change now, in the file <code>pars_alga.m</code>, the fractions <code>kap_EN</code> and <code>kap_EP</code> of not-used reserves that are returned to the reserves and set them to zero. 
  Think about what effect this would have on the reserve densities. 
  Check your ideas against the actual effects by running <code>pars_alga; shchem1(5)</code>. 
  Now change the concentrations of ammonia <code>X_Nr</code> and phospate <code>X_Pr</code> in the supply to the chemostat, and try to predict the effect before you re-run <code>pars_alga; shchem1</code>.

<HR>
<P>
Go to the <A HREF="/thb/deb/" TARGET="main"> DEB information page</A> or the <A HREF="/thb/deb/deblab/" TARGET="main"> DEB laboratory</A>

</BODY>
</HTML>


<|start_filename|>docs/DEBtool_enzyme.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>
    DEBtool_enzyme
  </TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: enzyme</H3>

Compares enzyme performance in reactions between two
complementary compounds
 
<HR>
<H4><A NAME="enzyme">enzyme</A></H4>

<P>
Demo that runs:
<UL>
  <LI><A HREF="#pars_enzyme"><code>pars_enzyme</code></A>: parameter setting</LI>
  <LI><A HREF="#shcontsu"><code>shcontsu</code></A>: countours for rates</LI>
  <LI><A HREF="#shbatch"><code>shbatch</code></A>: compouds in batch reactors</LI>
</UL>

 The models account for the enzyme-mediated transformation 
   <I>1A + 1B -> 1C</I>, using<BR>
   1 standard enzyme kinetics: reversible binding of substrates to enzyme<BR>
   2 special case: Synthezing Unit (irreversible binding)<BR>
   3 special case: Rejection Unit (association as well as dissociation rates
     very large)

<P>
 The enzyme can bind two substrates in a reversible way, without
 producing a product, but if both substrates are bound, it can produce
 a product. We assume that the product concentration does not affect
 the transformation rate.

<P>
 For the more general transformation <I>n<FONT
 SIZE=-1><SUB>A</SUB></FONT> A + n<FONT SIZE=-1><SUB>B</SUB></FONT> B
 -> n<FONT SIZE=-1><SUB>C</SUB></FONT> C</I>, the number of parameters
 of the transformation becomes excessive; there is a need for
 simplification.

<P>
 A popular symplification is to let the assocation and dissociation
 rates between substrates and enzyme go to infinity, such that their
 ratios remain bounded. This results in a product of two hyperbolic
 terms for the production rate: the Rejection Unit (RU). This
 representation suffers from several theoretical problems.

<P>
 An attractive alternative is to let the dissociation rates between
 substrates and enzyme go to zero: the Synthesizing Unit (SU). It
 allows a reformulation of the process in terms of fluxes, that can be
 applied in spatially structured environments (such as the living
 cell), where the concept `concentration' becomes problematic. It also
 allows a fully stochastic approach for describing the
 transformation. The DEB theory uses the SU as a module at several
 places.

<P>
 The theory behind SU kinetics is given in:<BR>
 Kooijman, <NAME>. 1998.
 <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy98.html">
 The Synthesizing Unit as model for the stoichiometric fusion and 
 branching of metabolic fluxes.</A>
 <I>Biophys. Chem.</I> <B>73</B>: 179 - 188 


<HR>
<H4><A NAME="pars_enzyme">pars_enzyme</A></H4>

Set the parameters by editing file <code>pars_enzyme.m</code> in toolbox enzyme.

<HR>
<H4><A NAME="shcontsu">shcontsu</A></H4>

Contours are shown for the production rate of compound C as function
of the substrate concentrations A and B, given that these are constant.
See page 42 ff of the DEB-book.

<P>Fig <B>1</B>
Synthesizing Unit

<P>Fig <B>2</B>
Classical enzyme kinetics

<P>Fig <B>3</B> 
Rejection Unit

<P>Example of use after editing file <code>pars_enzyme.m</code> in domain enzyme:
<CODE>clear all; pars_enzyme; shcontsu</CODE>.
The command <CODE>clear; pars_enzyme; shcontsu (2)</CODE> gives figure 2 only.

<HR>
<H4><A NAME="shbatch">shbatch</A></H4>

Concentration profiles are shown for product C and substrates A and
B in a batch reactor. The initial conditions, and the observation
period can be changed by editing file <code>shbatch.m</code>.

<P>Fig <B>1</B>
Synthesizing Unit

<P>Fig <B>2</B>
Classical enzyme kinetics

<P>Fig <B>3</B> 
Rejection Unit

<P>Example of use after editing file <code>pars_enzyme.m</code> in toolbox enzyme:
<CODE>clear all; pars_enzyme; shbatch</CODE>. 
The command <CODE>clear; pars_enzyme; shbatch(2)</CODE> gives figure 2 only.

<HR>
<H4><A NAME="su11">su11, ru11, enz11</A></H4>

The command <CODE>[J_C, fractions] = su11(2.5, 3.1)</CODE> assigns the
flux of product to <CODE>J_C</CODE> and the fractions of bounded
enzyme (.., A., .B, AB; the dot standing for free) to
<CODE>fractions</CODE>, for concentration of substrate A = 2.5, and
that of B = 3.1. This is the SU-case, ru11 and enz11 work in a similar
way for the RU and the reversible enzyme case.

<HR>
<H4><A NAME="su">su</A></H4>

The command <CODE>J_C = su(2.5, 3.1, 2, 3)</CODE> assigns the flux of
product to <CODE>J_C</CODE>, for concentration of substrate A = 2.5,
and that of B = 3.1, given the reaction <I>2 A + 3 B -> C</I>.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>docs/DEBtool_lib_regr.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_lib_regr</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: lib/regr</H3>

  Functions for the identification of parameters of user-defined models are parked in this domain. 
  They also quantify the uncertainty in parameter values and show the goodness of fit in graphs. 
  All functions use a Maximum Likelihood criterion for parameter estimation; 
  the underlying assumptions, the algorithm and the number of variables are indicated in the names of the routines.

  <P>
  The string <code>regr</code> in the function names stands for "regression", and assumes a constant normally distributed scatter around a deterministic user-defined model. 
  The script-files <code>mydata_regr</code> and <code>mydata_regr2</code> show examples of applications of the regression routines.

  <P>
  The string <code>surv</code> in the function names stands for "survivor", and assumes a multinomially distributed number of surviving individuals. 
  The first independent variable always has the interpretation "time". 
  The script-files <code>mydata_surv</code> and <code>mydata_surv2</code> show examples of applications of the survivor routines.

  <p> 
  The string <code>vc</code> in the function name 
  (<a HREF="../lib/regr/html/nrvcregr.html"><code>nrvcregr</code></a>, 
   <a HREF="../lib/regr/html/nmvcregr.html"><code>nmvcregr</code></a>, 
   <a HREF="../lib/regr/html/nmvcregr2.html"><code>nmvcregr2</code></a>,
   <a HREF="../lib/regr/html/pvcregr.html"><code>pvcregr</code></a>,
   <a HREF="../lib/regr/html/mre.html"><code>mrevc</code></a>) stands for "variation coefficient". 
  These functions assume that the scatter is (independently) normally distributed with a variation coefficient (i.e. the ratio of the standard deviation and the mean) that is constant.

  <P>
  The following table gives a survey of available parameter-identification routines:
  <table>
    <tr>
      <th></th>
      <th colspan = 2> general data </th>
      <th colspan = 3> survival data</th>
    </tr>
    <tr>
      <th> algorithm </th> <th> 1 var  </th> <th> 2 vars </th>
      <th> 1 var     </th> <th> 2 vars </th> <th> 3 vars </th>
    </tr>
    <tr> 
      <th> <a HREF="#nr"><NAME></a> </th> 
      <td> <a HREF="../lib/regr/html/nrregr.html"><code>nrregr</code></a>
           <a HREF="../lib/regr/html/nrvcregr.html"><code>nrvcregr</code></a> </td> 
      <td> <a HREF="../lib/regr/html/nrregr2.html"><code>nrregr2</code></a>   </td>
      <td> <a HREF="../lib/regr/html/scsurv.html"><code>scsurv</code></a>     </td> 
      <td> <a HREF="../lib/regr/html/scsurv2.html"><code>scsurv2</code></a>   </td>
      <td> <a HREF="../lib/regr/html/scsurv3.html"><code>scsurv3</code></a>   </td>
    </tr>
    <tr> 
      <th> <a HREF="#nm">nelder mead</a> </th> 
      <td> <a HREF="../lib/regr/html/nmregr.html"><code>nmregr</code></a> 
           <a HREF="../lib/regr/html/nmvcregr.html"><code>nmvcregr</code></a>   </td> 
      <td> <a HREF="../lib/regr/html/nmregr2.html"><code>nmregr2</code></a>
           <a HREF="../lib/regr/html/nmvcregr2.html"><code>nmvcregr2</code></a> </td>
      <td> <a HREF="../lib/regr/html/nmsurv.html"><code>nmsurv</code></a>       </td> 
      <td> <a HREF="../lib/regr/html/nmsurv2.html"><code>nmsurv2</code></a>     </td>
      <td> <a HREF="../lib/regr/html/nmsurv3.html"><code>nmsurv3<code></a>      </td>
    </tr>
    <tr> 
      <th> <a HREF="#ga">genetic algorithm</a> </th> 
      <td> <a HREF="../lib/regr/html/garegr.html"><code>garegr</code></a>    </td> 
      <td> <a HREF="../lib/regr/html/garegr2.html"><code>garegr2</code></a>  </td>
      <td> <a HREF="../lib/regr/html/gasurv.html"><code>gasurv</code></a>    </td> 
      <td> <a HREF="../lib/regr/html/gasurv2.html"><code>gasurv2</code></a>  </td>
      <td> <a HREF="../lib/regr/html/gasurv3.html"><code>gasurv3</code></a> </td>
    </tr>
    <tr>
      <th> par-covariances </th> 
      <td> <a HREF="../lib/regr/html/pregr.html"><code>pregr</code></a> 
           <a HREF="../lib/regr/html/pvcregr.html"><code>pvcregr</code></a> </td> 
      <td> <a HREF="../lib/regr/html/pregr2.html"><code>pregr2</code></a>   </td>
      <td> <a HREF="../lib/regr/html/psurv.html"><code>psurv</code></a>     </td> 
      <td> <a HREF="../lib/regr/html/psurv2.html"><code>psurv2</code></a>   </td>
      <td> <a HREF="../lib/regr/html/psurv3.html"><code>psurv3</code></a>   </td>
    </tr>   
    <tr>
      <th> goodness of fit </th> 
      <td> <a HREF="../lib/regr/html/ssq"><code>ssq</code></a>   </td> 
      <td> <a HREF="../lib/regr/html/ssq2"><code>ssq2</code></a> </td>
      <td> <a HREF="../lib/regr/html/dev"><code>dev</code></a>   </td> 
      <td> <a HREF="../lib/regr/html/dev2"><code>dev2</code></a> </td>
      <td> <a HREF="../lib/regr/html/dev3"><code>dev3</code></a> </td>
    </tr>   
    <tr>
      <th> show routines </th> 
      <td> <a HREF="../lib/regr/html/shregr.html"><code>shregr</code></a>   </td> 
      <td> <a HREF="../lib/regr/html/shregr2.html"><code>shregr2</code></a> </td>
      <td> <a HREF="../lib/regr/html/shsurv.html"><code>shsurv</code></a>   </td> 
      <td> <a HREF="../lib/regr/html/shsurv2.html"><code>shsurv2</code></a> </td>
      <td> </td>
    </tr>   
    <tr>
      <th> example script</th> 
      <td> <a HREF="../lib/regr/mydata_regr.m"><code>mydata_regr</code></a>   </td> 
      <td> <a HREF="../lib/regr/mydata_regr2.m"><code>mydata_regr2</code></a> </td>
      <td> <a HREF="../lib/regr/mydata_surv.m"><code>mydata_surv</code></a>   </td> 
      <td> <a HREF="../lib/regr/mydata_surv2.m"><code>mydata_surv2</code></a> </td>
      <td> <a HREF="../lib/regr/mydata_surv3.m"><code>mydata_surv3</code></a> </td>
    </tr>   
  </table>

  <p>
  The <b>uni-variate</b> routines can handle multiple samples, each described by its own model, which allows for the implementation of fuzzy constraints on parameter values. 
  Particular parameters of DEB models occur in respiration as well as in growth data; 
  the maximum throughput rate in a chemostat is frequently known, knowledge that can be used in fitting substrate and biomass data by including this function of parameter values as a new data set.

  <p> 
  The <b><a name = "nr">Newton Raphson method</a></b> converges typically fast for models that are sufficiently smooth, but it has a small domain of attraction;  
  the initial parameter estimate must be chosen within that domain for convergion. 
  The jacobian (i.e. the matrix of derivatives of the loss function with respect to the parameters) is obtained numerially using a fixed (small) step in the parameter values. 
  The "best" parameter values are typically rather accurate. The <b>method of scores</b> that is used for survival data, is a Newton Raphson method, applied to the expected values, rather than observed one.

  <p> 
  The <b><a name = "nm">Nelder Mead method</a></b> converges much slower, but has a much larger domain of attraction. 
  Since it does not use derivatives it typically works well on models that are not smooth. 
  An initial parameter estimate must still be specified in the domain of attraction to the "best" value. 
  The "best" parameter values are typically less accurate, and it is a good idea to run a Newton Raphson method on the result of a Nelder Mead method.

  <p> 
  The <b><a name = "ga">Genetic Algorithm</a></b> converges slowly, and uses a stochastic rather than a deterministic algorithm to arrive at the "best" value. 
  It does not require an initial parameter estimate, just a range in which the "best" value must be. 
  The end result is less sensitive to local minima. 
  It stops if a fixed number of steps does not lead to further improvement (which does not garantee that no improvement is possible). 
  Since genetic algorithms maximize functions, the method is run on minus the weighted sum of squared deviations. 
  It is a good idea to run a Newton Raphson method on the result of a genetic algorithm.

  <p> 
  <b>All methods</b> suffer from the problem that the result can represent a local rather than a global minimum (in decreasing sensitivity of the three methods). 
  It is always a good idea to check the result graphically (using the "show" routines that start with the string <code>sh</code>, and to use common sense (both for checking the goodness of fit and the parameter values). 
  Since the user-interface of the methods is rather similar, only the instructions for the <A HREF="#nrregr">Newton Raphson method</A> are more detailed.s


<HR>
<H4><A NAME="shregr">shregr</A></H4>

  Plots model predictions and data(optional). 
  Plot options can be set with routine <A HREF="#shregr_options"><code>shregr_options</code></A>.

  <P>
  Input as in <A HREF="#nrregr"><code>nrregr</code></A>.
  The plot-range can set optionally in a vector of length 2, with the lower and upper boundaries. 
  The columns >1 in the parameter matrix are ignored. 
  If column 2 in the data matrix is not present, model predictions are plotted only. 
  The colums >2 in the data matrices are ignored.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, and data <code>xy</code> are defined properly: 
  <code>shregr('function_name', pars, xy)</code>, or if the user-defined function codes for two data sets, for instance
  <code>shregr('function_name', pars, xy1, xy2)</code>.

<HR>
<H4><A NAME="shregr_options">shregr_options</A></H3>

  Sets options for plotting routines <code>shregr</code> and <code>shsurv</code>. 
  This routine sets default values which you can overwrite, once you have run <code>shregr</code>.

  <P>
  Input:
  <ul>
    <li> 'default': resets all <code>shregr_options</code> to default values;
        <code>shregr_options('default')</code> </li>
  </ul>
  or
  <ul>
    <li> string, scalar:
      <ul>
        <li> 'dataset': sets data sets that must be plotted; default is all. 
             In the case of 4 data sets, of instance, you can select number 2 and 4 by 
             <code>shregr_options('dataset', [2 4])</code> </li> 
        <li> 'Range': plot range for the independent variables. 
             In the case of 4 data sets, of instance, you can set the plot range of data set 3 from 0 to 15 by 
             <code>shregr_options('Range', 3, [0 15])</code> </li>
        <li> 'xlabel': x-labels for the plots.  
             In the case of 4 data sets, for instance, you can label the x-axis of data set 2 with 'time, h' by
             <code>shregr_options('xlabel', 2, 'time, h')</code> </li>
        <li> 'ylabel': y-labels for the plots, see <code>xlabel</code> </li>
        <li> 'all_in_one': all selected data sets are plotted in one graph. 
             The x,y-labels are those of the first selected data set. 
             The data points are projected on the curves. 
             Default: multiplot. 
             Set single plot by <code>shregr_options('all_in_one', 1)</code> </li>
     </ul>
    </li> 
  </ul>

<HR>
<H4><A NAME="nrregr2">nrregr2</H4>

  Finds parameter values in (non-linear) weighted least-squares regression problems like <A HREF="#nrregr"><code>nrregr</code></A>, but for 2 independent variables, rather than a single one. 
  So this routine fits a surface, no a curve. 
  See <A HREF="#nmregr2"><code>nmregr2</code></A> for the simplex method, and <A HREF="#garegr2"><code>garegr2</code></A> for a genetic
algorithm in 2 independent variables.

  <p>
  Options in the numerical procedure can be set by <A HREF="#nrregr_options"><code>nrregr_options</code></A>.

  <P>
  Input:
  <ul>
    <li> string with name of user-defined function.<br>
         The user-defined function must take the two column vectors of values for the independent variable and a single vector-argument with parameter values as inputs, and a matrix value of model predictions as output. 
         The size of the output matrix must match the number of values of the independent variable: 
         the first independent variable in the rows, the second one in the columns </li>
    <li> (n,1 or 2)-matrix with initial estimates, see <A HREF="#nrregr"><code>nrregr</code></A> </li>
    <li> (nx,1)-matrix with values of first independent variable </li> 
    <li> (ny,1)-matrix with values of second independent variable </li> 
    <li> (nx,ny)-matrix with values of the dependent variable </li>
    <li> (nx,ny)-matrix with values of the weight coefficients.
         Optional; default is all ones. 
         The weight coefficients need not sum to unity </li>
  </ul>

  <P>
  Output:
  <ul> 
    <li> parameter matrix similar to the parameter input matrix, but the initial estimates are replaced by the values  the minimize the weighted sum of squared deviations (see <A HREF="#ssq2"><code>ssq2</code></A>) </li>
    <li> scalar, which equals 0 for unsuccessful termination, and 1 for successful termination. 
         If the option report is set to 1 (default), unsuccessful termination is reported </li>
  </ul>

  <P> 
  The iteration is terminated if the norm, i.e. the sum of squared derivetives of sum of squared deviations with respect to the iterated parameters, is less than the maximum norm or if the number of iterations exceeds a maximum values (see <A HREF="#nrregr_options"><code>nrregr_options</code></A>).

  <P>
  For advices see <A HREF="#nrregr"><code>nrregr</code></A>. 
  There is no need to use the values of the second dependent variable in the user defined function. 
  This allows the implementation of a multi-variable function in compact form, where all clumns are treated as dependent variables that have the same values for the single independent variable. 
  Use <A HREF="#nrregr"><code>nrregr</code></A>, if the dependent variables have different values for the independent variable. 
  Both matrices for the independent variables can have more than one column, to pass information about other variables to the user-defined function. See <A HREF = "index_alga.html#ncplim" TARGET="_top"><code>cnplim</code></A> for an application.

  <P>
  Example of use, assuming that 'xvalues', 'yvalues', 'zdata', 'weights', function 'function_name' and initial paramer estimates 'ipars' are properly defined: 
  <code>pars = nrregr2('function_name', ipars, xvalues, yvalues, zdata, weights)</code>. 
  See script file <code>mydata_regr2.m</code> for an example of specification. 
  If progression seems hopeful, but the number of iterations not large enough, you can continue with 
  <code>pars = nrregr2('function_name', pars, xvalues, yvalues, zdata)</code>. 
  Alternatively you can increase the maximum number of iterations with <A HREF="#nrregr_options"><code>nrregr_options</code></A>.

<HR>
<H4><A NAME="nmregr2">nmregr2</A></H4>

  Finds parameter values in (non-linear) weighted least-squares regression problems using Nelder Mead's simplex method. 
  The convergence is usually slow, but the domain of attraction is rather large.  
  See 
  <A HREF="#nrregr2"><code>nrregr2</code></A> for the definition of the user-defined function and 
  <A HREF="#nmregr"><code>nmregr</code></A> for one independent variable with multiple samples.

  <P>
  Options in the numerical procedure can be set by <A HREF="#nmregr_options"><code>nmregr_options</code></A>.

  <P>
  It is usually a good idea to run <A HREF="#nrregr2"><code>nrregr2</code></A> on the result of <code>nmregr2</code>.

<HR>
<H4><A NAME="nmvcregr2">nmvcregr2</A></H4>

  Finds parameter values in Maximum Likelihood regression problems using Nead Melder's simplex method. 
  The standard deviation is here taken to be proportional to the mean (unlike <A HREF="#nmregr2"><code>nmregr2</code></A>, where the standard deviation is assumed to be constant).

  <P>
  Options in the numerical procedure can be set by <A HREF="#nmregr_options"><code>nmregr_options</code></A>.

<HR>
<H4><A NAME="garegr2">garegr2</A></H4>

  Finds parameter values in (non-linear) weighted least-squares regression problems using a genetic algorithm. 
  The (stochastic) convergence is usually slow, but it does not require an initial estimate, only a range. 
  The process starts from an initial set of (randomly generated) trials. See <A HREF="#nrregr2"><code>nrregr2</code></A> for the definition of the user-defined function and <A HREF="#garegr"><code>garegr</code></A> for one independent variable with multiple samples.

  <P>
  Options in the numerical procedure can be set by <A HREF="#garegr_options"><code>garegr_options</code></A>.

  <P>
  It is usually a good idea to run <A HREF="#nrregr2"><code>nrregr2</code></A> on the result of <code>garegr2</code>.

<HR>
<H4><A NAME="pregr2">pregr2</A></H4>

  Calculates covariance matrix and standard deviations of parameters in regression models, like <A HREF="#pregr"><code>pregr</code></A>, but for 2 independent variables.

  <P>
  Input as in <A HREF="#nrregr2"><code>nrregr2</code></A>.

  <P>
  Output (4 items):
  <ul>
    <li> covariance matrix of parameter estimates </li>
    <li> correlation matrix of parameter estimates </li>
    <li> vector of standard deviations of parameter estimates </li>
    <li> weighted sum of squared deviations from model predictions </li>
  </ul>

  <P>
  The elements in the covariance and correlation matrices equal zero for parameters that have code 0 in the second row of the parameter input matrix. 
  The values are the maximum likelihood estimates in the case of a identially normally distributed scatter distribution. 
  Therefore, no corrections for bias are made.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, <code>xvalues</code>, <code>yvalues</code>, <code>zdata</code>, and <code>weights</code> are defined properly: 
  <code>[cov, cor, sd, ss] = pregr2('function_name',  pars, xvalues, yvalues, zdata, weights) </code>.

<HR>
<H4><A NAME="ssq2">ssq2</A></H4>

  Calculates weighted sum of squared deviations from model predictions.

  <P>
  Input as in <A HREF="#nrregr2"><code>nrregr2</code></A>.

  <P>
  Output: 
  <ul>
    <li> scalar with sum of squared deviations. 
         Identical to 4th output of <A HREF="#pregr2"><code>pregr2</code></A> </li>
  </ul>

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, <code>xvalues</code>, <code>yvalues</code>, </code>zdata</code>, and <code>weights</code> are defined properly: 
  <code> ssq2('function_name', pars, xvalues, yvalues, zdata, weights)</code>.

<HR>
<H4><A NAME="shregr2">shregr2</A></H4>

  Plots model predictions and data (optionally). 
  Options can be set by <A HREF="#shregr2_options"><code>shregr2_options</code></A>. 
  It allows you to plot a response surface in 3 dimensions, together with your data, or sets of xz-curves or yz-curves. 
  The data are projected on the surface, and on the curves, to show the difference between the data and model predictions. 
  These projections help to reveal which data-point relates to which curve.

  <P>
  Inputs as in <A HREF="#nrregr2"><code>nrregr2</code></A>; 
  the data matrix is optional. 
  The ranges of the two independent variables can be set optionally in two 2-vectors with upper and lower values.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, <code>xvalues</code>, <code>yvalues</code>, and <code>zdata</code> are defined properly: 
  <code>shregr2('function_name', pars, xvalues, yvalues, zdata)</code> or 
  <code>shregr2 ('function_name', pars, xvalues, yvalues)</code>.

<HR>
<H4><A NAME="shregr2_options">shregr2_options</A></H3>

  Sets options for plotting routine <code>shregr2</code>. 
  This routine sets default values which you can overwrite, once you have run <code>shregr2</code>.

  <P>
  Input:
  <ul>
    <li> 'default': resets all <code>shregr2_options</code> to default values;
         <code>shregr2_options('default')</code> </li>
  </uL> 
  or
  <ul>
    <li> string, scalar:
      <ul>
        <li> 'plotnr': selects the plots that must be shown; default is [1 2];
             plotnr 1 is z versus x and plotnr 2 is z versus y. 
             Select plotnr 1 by <code>shregr2_options('plotnr', 1)</code> </li>
        <li> 'Range': plot range for the independent variables. 
             Set plot-range for y-values as independent variables in plot number 2 from 0 to 15 by 
             <code>shregr2_options('Range', 2, [0 15])</code> </li>
        <li> 'xlabel': x-label for the plots.  
             You can label the x-data with 'time, h' by <code>shregr2_options('xlabel', 'time, h')</code> </li>
        <li> 'ylabel': y-label for the plots, see 'xlabel' </li>
        <li> 'zlabel': z-label for the plots, see 'xlabel' </li>
        <li>  'all_in_one': 
             all selected data sets are plotted in one 3 dimensional graph. 
             The data points are projected on the surface. 
             Default: multiplot. 
             Set single plot by <code>shregr2_options('all_in_one',1)</code> </li>
      </ul>
    </li>
  </ul>

<HR>
<H4><A NAME="scsurv"> scsurv</A></H4>

  Finds maximum likelihood estimates from survival data using the method of scores, with numerically obtained values for the jacobian. 
  It can deal with an arbitrary number of samples, which might share one or more parameters. 
  The convergence is usually fast, but the domain of attraction can be small, depending on data and model. 
  See 
  <A HREF="#nmsurv"><code>nmsurv</code></A> for simplex method, and 
  <A HREF="#scsurv2"><code>scsurv2</code></A> and 
  <A HREF="#nmsurv2"><code>nmsurv2</code></A> for 2 independent variables.

  <P>
  Options in the numerical procedure can be set by <A HREF="#scsurv_options"><code>scsurv_options</code></A>.

  <p>
  Input:
  <uL>
    <li> string with name of a user-defined function for the survival model.<br>
         The user-defined function must take a single vector-argument with parameter values and one or more data matrices as inputs, and a vector value of model predictions for each data matrix as output. 
         Examples:
         <code>f = func(p, tn)</code> or 
         <code>[f1, f2] = func(p, tn1, tn2)</code> or 
         <code>[f1, f2, f3] = func(p, tn1, tn2, tn3)</code>. 
         The rows of <code>fi</code> must match those of <code>tni</code>. 
         The number of samples is arbitrary (in principle) </li>
    <li> (k, 1 or 2)-matrix with initial parameter estimates </li>
         The initial parameter estimates in column 1, and booleans in column 2, where 
         0 stands for "keeping the corresponding parameter fixed", and 
         1 for "iterate the corresponding parameter values".
         If the second column is omitted, values one are assumed (i.e. all parameters are iterated).
    <li> one or more (n,2) matrices with data: 
         time in column 1 and the number of survivors in column 2. 
         The matrices might differ in number of rows between the samples. 
         The procedure uses only the first two columns, and pass the input matrices to the user defined function. 
         This allows the addition of more columns, which might contain data-point specific information, as a kind of fixed parameters </li>
  </ul>

  <P>
  Output:
  <ul>
    <li> parameter matrix similar to the parameter input matrix, but the initial estimates are replaced by the values that maximize the likelihood function (see <A HREF="#dev"><code>dev</code></A>) </li>
    <li> scalar, which equals 0 for unsuccessful termination, and 1 for successful termination. 
         If the option report is set to 1 (default), unsuccessful termination is reported </li>
  </ul>

  <P> 
  The iteration is terminated if the norm, i.e. the sum of squared derivetives of the deviance with respect to the iterated parameters, is less than the maximum norm or if the number of iterations exceeds a maximum values (see <A HREF="#scsurv_options"><code>scsurv_options</code></A>).

  <P>
  Example of use, assuming that <code>data</code> and function <code>function_name</code> and initial paramer estimates <code>ipars</code> are properly defined: 
  <code>pars = scsurv('function_name', ipars, data)</code> or 
  <code>pars = scsurv('function_name', ipars, data1, data2)</code> 
  (or more data sets, depending on the definition of the model functions.). 
  See script file <code>mydata_surv.m</code> for an example of specification. 
  If progression seems hopeful, but the number of iterations not large enough, you can continue with 
  <code>pars = scsurv('function_name', pars, data)</code>. 
  Alternatively you can increase the maximum number of iterations with <A HREF="#scsurv_options"><code>scsurv_options</code></A>.

<HR>
<H4><A NAME="scsurv_options">scsurv_options</A></H4>

  Sets options for parameter finding routine <code>scsurv</code> and <code>scsurv2</code> and <code>scsurv3</code>. 
  These routines set default value which you can overwrite. See <A HREF="#nrregr_options"><code>nrregr_options</code></A> for further explanation.

<HR>
<H4><A NAME="nmsurv">nmsurv</A></H4>

  Finds maximum likelihood estimates from survival data using Nelder Mead's simplex method. 
  The convergence is usually slow, but the domain of attraction is rather large. 
  See 
  <A HREF="#scsurv"><code>scsurv</code></A> for the definition of the user-defined function, and 
  <A HREF="#scsurv2"><code>scsurv2</code></A> and 
  <A HREF="#nmsurv2"><code>nmsurv2</code></A> for 2 independent variables and 
  <A HREF="#scsurv3"><code>scsurv3</code></A> and 
  <A HREF="#nmsurv3"><code>nmsurv3</code></A> for 3 independent variables.

  <P>
  Options in the numerical procedure can be set by <A HREF="#nmsurv_options"><code>nmsurv_options</code></A>.

  <P>
  It is usually a good idea to run <A HREF="#scsurv"><code>scsurv</code></A> on the result of nmsurv.

<HR>
<H4><A NAME="nmsurv_options">nmsurv_options</A></H4>

  Sets options for parameter finding routine <code>nmsurv</code>, <code>nmsurv2</code> and <code>nmsurv3</code>. 
  These routines set default value which you can overwrite. 
  See <A HREF="#nmregr_options"><code>nmregr_options</code></A> for further explanation.

<HR>
<H4><A NAME="gasurv">gasurv</A></H4>

  Finds maximum likelihood estimates from survival data using a genetic algorithm. 
  The (stochastic) convergence is usually slow, but it does not require an initial estimate, only a range. 
  The process starts from an initial set of (randomly generated) trials. 
  See 
  <A HREF="#scsurv"><code>scsurv</code></A> for the definition of the user-defined function, and 
  <A HREF="#scsurv2"><code>scsurv2</code></A>, 
  <A HREF="#nmsurv2"><code>nmsurv2</code></A> and 
  <A HREF="#gasurv2"><code>gasurv2</code></A> for 2 independent variables and 
  <A HREF="#scsurv3"><code>scsurv3</code></A>, 
  <A HREF="#nmsurv3"><code>nmsurv3</code></A> and 
  <A HREF="#gasurv3"><code>gasurv3</code></A> for 3 independent variables. 
  See 
  <A HREF="#garegr"><code>garegr</code></A> for a description of the outputs.

  <P>
  Options in the numerical procedure can be set by <A HREF="#gasurv_options"><code>gasurv_options</code></A>.

  <P>
  It is usually a good idea to run <A HREF="#scsurv"><code>scsurv</code></A> on the result of <code>gasurv</code>.

<HR>
<H4><A NAME="gasurv_options">gasurv_options</A></H4>

  Sets options for parameter finding routine <code>gasurv</code>, <code>gasurv2</code> and <code>gasurv3</code>. 
  These routines set default value which you can overwrite. 
  See <A HREF="#garegr_options"><code>garegr_options</code></A> for further explanation.

<HR>
<H4><A NAME="psurv">psurv</A></H4>

  Calculates covariance matrix and standard deviations of parameters in survivor models.

  <P>
  Input: 
  user-defined function name, data matrix, and parameter values, as in <A HREF="#scsurv"><code>scsurv</code></A>.

  <P>
  Output:
  <ul>
    <li> covariance matrix of parameter estimates </li>
    <li> correlation matrix of parameter estimates </li>
    <li> vector of standard deviations of parameter estimates </li>
    <li> deviance</li>
  </ul>

  <P>
  The elements in the covariance and correlation matrices equal zero for parameters that have code 0 in the second row of the parameter input
matrix. 
  The values are the maximum likelihood estimates, therefore, no corrections for bias are made.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, and <code>tn1</code> (and possibly more data matrices) are defined properly: 
  <code>[cov, cor, sd, ss] = psurv('function_name', pars, tn1, tn2, ...)</code>.

<HR>
<H4><A NAME="dev">dev</A></H4>

  Calculates the deviance: two times the difference between the log likelihood function and its maximum (which based on the multinomial distribution where the death probabilities correspond with the observed relative frequencies). 
  The maximum likelihood estimates minimize the deviance. See <A HREF="#dev2"><code>dev2</code></A> for the surface-equivalent.


  <P>
  Input: 
  user-defined function name, data matrix, and parameter values, as in <A HREF="#scsurv"><code>scsurv</code></A>.

  <P>
  Output: 
  scalar with deviance. Identical with 4th output of <A HREF="#psurv"><code>psurv</code></A>.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, and <code>tn1</code> (and possibly more data matrices) are defined properly: 
  <code>dev('function_name', pars, tn1, tn2, ...)</code>.

<HR>
<H4><A NAME="plsurv">plsurv</A></H4>

  Calculates the profile likelihood function for a parameter that is indicated with code <code>2</code> in the second column of the parameter matrix.
  The other parameters with positive codes are ml-estimated using the simplex method for each evaluation of the target parameter. 
  See <A HREF="#plsurv2"><code>plsurv2</code></A> for response surfaces.

  <P>
  Input: 
  user-defined function name, parameter values, and one or more data matrices as in <A HREF="#scsurv"><code>scsurv</code></A>. 
  The last argument is a 2 or 3 -vector with the lower and upper boundaries of the indicated parameter. 
  The value of that parameter in the parameter matrix must be within the range. 
  The optional element 3 specifies the numer of parameter evaluations; default: 100.

  <P>
  Output:
  <ul>
    <li> (99,2)-matrix with parameter values and deviance </li>
    <li> scalar with value 1 for successful convergence at all parameter evalation points; 
         and value 0 with one or more convergence problems </li>
  </ul>

  <P>
 Example of use, assuming that <code>function_name</code>, <code>pars</code>, <code>tn1</code> (and possibly more data matrices) and <code>Range</code> are defined properly:
  <code>plsurv('function_name', pars, tn1, tn2, ..., Range)</code>.

<HR>
<H4><A NAME="shsurv">shsurv</A></H4>

  Plots model predictions and data (optional). 
  Plot options can be set with routine <A HREF="#shsurv_options"><code>shsurv_options</code></A>.

  <P>
  Input: 
  user-defined function name, parameter values, and one or more data matrices as in <A HREF="#scsurv"><code>scsurv</code></A>. 
  The plot-range can set optionally in a vector of length 2, with the lower and upper boundaries. 
  The columns >1 in the parameter matrix are ignored. 
  If column 2 in the data matrix is not present, model predictions are plotted only. 
  The colums >2 in the data matrices are ignored.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, and data <code>tn</code> are defined properly: 
  <code>shsurv('function_name', pars, tn)</code>, or if the user-defined function codes for two data sets, for instance
  <code>shsurv('function_name', pars, tn1, tn2)</code>. 

  <P>
  Set options for plotting routine <code>shsurv</code> with <A HREF="#shregr_options"><code>shregr_options</code></A>.

<HR>
<H4><A NAME="scsurv2">scsurv2</H4>

  Finds maximum likelihood estimates from survivor data like <A HREF="#scsurv"><code>scsurv</code></A>, but for an additional independent variable, rather than time only. So this routine fits a surface, no a curve.

  <p>
  Options in the numerical procedure can be set by <A HREF="#scsurv_options"><code>scsurv_options</code></A>.

  <P>
  Input:
  <ul>
    <li> string with the name of a user-defined function for the survival model.
         The user-defined function must take the two column vectors of values for the independent variable and a single vector-argument with parameter values as inputs, and a matrix value of model predictions as output. 
         The size of the output matrix must match the number of values of the independent variable:  
         the first independent variable (time) in the rows, the second one in the columns </li>
    <li> (k, 1 or 2)-matrix with initial parameter estimates in column 1 and booleans in column 2, where 
         0 stands for "keeping the corresponding parameter fixed", and 
         1 for "iterate the corresponding parameter values". 
         If column 2 is omitted, values one are assumed (i.e. all parameters are iterated) </li>
    <li> (nt,1 or more)-matrix with time points </li>
    <li> (ny,1 or more)-matrix with second independent variable </li>
         The second and other columns can accomodate modifying factors.
         The extra columns are just passed to the user-defined function, see e.g. 
         <A HREF ="../tox/DEBtool_tox.html#fomortph" TARGET="_parent"><code>fomortph</code></A> for an example; 
         notice that the plotting routine <A HREF="#shsurv2"><code>shsurv2</code></A> then only works properly with option <code>plotnr</code> is either 1 or 2.
    <li> (nt,ny)-matrix with the number of surviving individual </li>
  </ul>

  <P>
  Output: 
  <ul>
    <li> parameter matrix similar to the parameter input matrix, but the initial estimates are replaced by the values the that maximize the likelihood function (see <A HREF="#dev2"><code>dev2</code></A>)</li>
    <li> scalar, which equals 0 for unsuccessful termination, and 1 for successful termination. 
         If the option report is set to 1 (default), unsuccessful termination is reported </li>
  </ul>

  <P> 
  The iteration is terminated if the norm, i.e. the sum of squared derivetives of the deviance with respect to the iterated parameters, is less than the maximum norm or if the number of iterations exceeds a maximum values 
  (see <A HREF="#scsurv_options"><code>scsurv_options</code></A>).

  <P>
  Example of use, assuming that 'tvalues', 'yvalues', 'numbers', function 'function_name' and initial paramer estimates 'ipars' are properly defined: 
  <code>pars = scsurv2('function_name', ipars, tvalues, yvalues, numbers)</code>. 
  See sample file 'mydata_surv2.m' for an example of specification. 
  If progression seems hopeful, but the number of iterations not large enough, you can continue with 
  <code>pars = scsurv2('function_name', pars, tvalues, yvalues, numbers)</code>. 
  Alternatively you can increase the maximum number of iterations with <A HREF="#scsurv_options"><code>scsurv_options</code></A>.

<HR>
<H4><A NAME="nmsurv2">nmsurv2</A></H4>

  Finds maximum likelihood estimates from survival data using Nelder Mead's simplex method. 
  The convergence is usually slow, but the domain of attraction is rather large. 
  See 
  <A HREF="#scsurv2"><code>scsurv2</code></A> for the definition of the user-defined function, and 
  <A HREF="#scsurv"><code>scsurv</code></A> and 
  <A HREF="#nmsurv"><code>nmsurv</code></A> for one independent variable (time) with multiple samples.

  <P>
  Options in the numerical procedure can be set by <A HREF="#nmsurv_options"><code>nmsurv_options</code></A>.

  <P>
  It is usually a good idea to run <A HREF="#scsurv2"><code>scsurv2</code></A> on the result of <code>nmsurv2</code>.

<HR>
<H4><A NAME="gasurv2">gasurv2</A></H4>

  Finds maximum likelihood estimates from survival data using a genetic algorithm. 
  The (stochastic) convergence is usually slow, but it does not require an initial estimate, only a range. 
  The process starts from an initial set of (randomly generated) trials. 
  See 
  <A HREF="#scsurv2"><code>scsurv2</code></A> for the definition of the user-defined function, and 
  <A HREF="#scsurv"><code>scsurv</code></A>, 
  <A HREF="#nmscsurv"><code>nmscsurv</code></A> and 
  <A HREF="#gasurv"><code>gasurv</code></A> for one independent variable (time) with multiple samples.

  <P>
  Options in the numerical procedure can be set by <A HREF="#gasurv_options"><code>gasurv_options</code></A>.

  <P>
  It is usually a good idea to run <A HREF="#scsurv2"><code>scsurv2</code></A> on the result of <code>gasurv2</code>.

<HR>
<H4><A NAME="psurv2">psurv2</A></H4>

  Calculates covariance matrix and standard deviations of parameters in survivor models, like <A HREF="#psurv"><code>psurv</code></A>, but for 2 independent variables.

  <P>
  Input: 
  user-defined function name, 2 vectors of independent variables, a matrix with surviving individuals, and parameter values, as in <A HREF="#scsurv2"><code>scsurv2</code></A>.

  <P>
  Output:
  <ul>
    <li> covariance matrix of parameter estimates </li>
    <li> correlation matrix of parameter estimates </li>
    <li> vector of standard deviations of parameter estimates </li>
    <li> deviance </li>
  </ul>

  <P>
  The elements in the covariance and correlation matrices equal zero for parameters that have code 0 in the second row of the parameter input matrix. 
  The values are the maximum likelihood estimates, therefore, no corrections for bias are made.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, <code>tvalues</code>, <code>yvalues</code>, <code>numbers,</code> are defined properly: 
  <code>[cov, cor, sd, ss] = pregr2('function_name',  pars, tvalues, yvalues, numbers)</code>.

<HR>
<H4><A NAME="dev2">dev2</A></H4>

  Calculates deviance, see <A HREF="#dev"><code>dev</code></A>.

  <P>
  Input: 
  user-defined function name, 2 vectors of independent variables, a matrix with surviving individuals, and parameter values, as in <A HREF="#scsurv2"><code>scsurv2</code></A>.

  <P>
  Output: 
  scalar with the deviance. Identical with 4th output of <A HREF="#psurv2"><code>psurv2</code></A>.

  <P>
  Example of use, assuming that <code>function_name</code>, <code>pars</code>, <code>tvalues</code>, <code>yvalues</code>, <code>numbers</code> are defined properly: 
  <code> dev2('function_name', pars, tvalues, yvalues, numbers)</code>.

<HR>
<H4><A NAME="plsurv2">plsurv2</A></H4>

  Calculates the profile likelihood function for a parameter that is indicated with code <code>2</code> in the second column of the parameter matrix.
  The other parameters with positive codes are ml-estimated using the simplex method for each evaluation of the target parameter. 
  See <A HREF="#plsurv"><code>plsurv</code></A> for the multiple sample case.

  <P>
  Input: 
  user-defined function name, parameter values, times, second dependent variable, data matrix as in <A HREF="#scsurv2"><code>scsurv2</code></A>. 
  The last argument is a 2 or 3 -vector with the lower and upper boundaries of the indicated parameter. 
  The value of that parameter in the parameter matrix must be within the range. 
  The optional element 3 specifies the numer of parameter evaluations; default: 100.


  <P>
  Output:
  <ul> 
    <li> (99,2)-matrix with parameter values and deviance </li>
    <li> scalar with value 1 for successful convergence at all parameter evalation points; 
         and value 0 with one or more convergence problems </li>
  </ul>

  <P>
  Example of use, assuming that 
  <code>function_name</code>, 
  <code>pars</code> (parameter matrix), 
  <code>t</code> (time-vector), 
  <code>y</code> (vector with second dependent variable), 
  <code>tny</code> (matrix with numbers of survivors) and 
  <code>Range</code> (2-vector with lower and upper boundary for target parameter) are defined properly: 
  <code>plsurv('function_name', pars, t, y, tny, Range)</code>.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>






<|start_filename|>lib/regr/html/scsurv.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>scsurv</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="scsurv.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Output</a></li><li><a href="#6">Remarks</a></li><li><a href="#7">Example of use</a></li><li><a href="#8">Code</a></li><li><a href="#9">set options if necessary</a></li><li><a href="#10">obtain time intervals and numbers of death</a></li><li><a href="#12">start of numerical minimization</a></li><li><a href="#13">trouble report</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [q, info] = scsurv(func, p, varargin)
</pre><pre class="codeinput">  <span class="comment">%  created: 2001/09/11 by <NAME>; modified 2008/09/18</span>
  <span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>Finds maximum likelihood estimates from survival data using the method of scores,
  with numerically obtained values for the jacobian.
It can deal with an arbitrary number of samples, which might share one or more parameters.
The convergence is usually fast, but the domain of attraction can be small, depending on data and model.
See nmsurv for simplex method, and scsurv2 and nmsurv2 for 2 independent variables.</pre><h2>Input<a name="4"></a></h2><pre>func: string with name of user-defined function
   f = func (p, tn) with
     p: k-vector with parameters; tn: (n,c)-matrix; f: n-vector
   [f1, f2, ...] = func (p, tn1, tn2, ...) with  p: k-vector  and
    tni: (ni,k)-matrix; fi: ni-vector with model predictions
   The dependent variable in the output f; For tn see below.
p: (k,2) matrix with
   p(:,1) initial guesses for parameter values
   p(:,2) binaries with yes or no iteration (optional)
tni (read as tn1, tn2, .. ): (ni,2) matrix with
   tni(:,1) time: must be increasing with rows
   tni(:,2) number of survivors: must be non-increasing with rows
   tni(:,3, 4, ... ) data-pont specific information data (optional)
   The number of data matrices tn1, tn2, ... is optional but &gt;0</pre><h2>Output<a name="5"></a></h2><pre>q: matrix like p, but with ml-estimates
info: 1 if convergence has been successful; 0 otherwise</pre><h2>Remarks<a name="6"></a></h2><pre>calls scdsurv, and user-defined function 'func'
set options with 'scsurv_options'
The iteration is terminated if the norm, i.e.
  the sum of squared derivetives of the deviance with respect to the iterated parameters,
  is less than the maximum norm or if the number of iterations exceeds a maximum values (see scsurv_options).
If progression seems hopeful, but the number of iterations not large enough,
  you can continue with pars = scsurv('function_name', pars, data).
Alternatively you can increase the maximum number of iterations with scsurv_options.</pre><h2>Example of use<a name="7"></a></h2><pre>assuming that data and function function_name and initial paramer estimates ipars are properly defined:
pars = scsurv('function_name', ipars, data) or
pars = scsurv('function_name', ipars, data1, data2)
(or more data sets, depending on the definition of the model functions.).
See script file mydata_surv.m for an example of specification.</pre><h2>Code<a name="8"></a></h2><pre class="codeinput">  <span class="keyword">global</span> index l N ntn listtn listf listg global_txt
  <span class="keyword">global</span> max_step_number max_step_size max_norm report; <span class="comment">% option settings</span>
</pre><h2>set options if necessary<a name="9"></a></h2><pre class="codeinput">  <span class="keyword">if</span> prod(size(max_step_number)) == 0
    scsurv_options(<span class="string">'max_step_number'</span>, 20);
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(max_step_size)) == 0
    scsurv_options(<span class="string">'max_step_size'</span>, 1e20);
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(max_norm)) == 0
    scsurv_options(<span class="string">'max_norm'</span>, 1e-8);
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(report)) == 0
    scsurv_options(<span class="string">'report'</span>, 1);
  <span class="keyword">end</span>

  ntn = nargin - 2; <span class="comment">% number of data sets</span>
  <span class="keyword">for</span> i = 1:ntn <span class="comment">% loop across data sets</span>
    ci = num2str(i); <span class="comment">% character string with value of i</span>
    <span class="keyword">if</span> i == 1
      listtn = [<span class="string">'tn'</span>, ci, <span class="string">','</span>]; <span class="comment">% initiate list tn</span>
      listf = [<span class="string">'f'</span>, ci, <span class="string">','</span>];   <span class="comment">% initiate list f</span>
      listg = [<span class="string">'g'</span>, ci, <span class="string">','</span>];   <span class="comment">% initiate list g</span>
    <span class="keyword">else</span>
      listtn = [listtn, <span class="string">' tn'</span>, ci, <span class="string">','</span>]; <span class="comment">% append list tn</span>
      listf = [listf, <span class="string">' f'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list f</span>
      listg = [listg, <span class="string">' g'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list g</span>
    <span class="keyword">end</span>
  <span class="keyword">end</span>

  nl = size(listtn,2); listtn = listtn(1:(nl - 1)); <span class="comment">% remove last ','</span>
  nl = size(listf,2); listf = listf(1:(nl - 1)); <span class="comment">% remove last ','</span>
  nl = size(listg,2); listg = listg(1:(nl - 1)); <span class="comment">% remove last ','</span>

  global_txt = strrep([<span class="string">'global '</span>, listtn], <span class="string">','</span>, <span class="string">' '</span>);
  eval(global_txt); <span class="comment">% make data sets global</span>

  global_txt = strrep([<span class="string">'global '</span>, listtn], <span class="string">','</span>, <span class="string">' '</span>);
  eval(global_txt); <span class="comment">% make data sets global</span>

  N = zeros(ntn, 1); <span class="comment">% initiate data counter</span>
  <span class="keyword">for</span> i = 1:ntn <span class="comment">% loop across data sets</span>
    ci = num2str(i); <span class="comment">% character string with value of i</span>
    eval([<span class="string">'tn'</span>, ci, <span class="string">' = varargin{'</span>, ci,<span class="string">'};'</span>]); <span class="comment">% assing unnamed arguments to xywi</span>
    eval([<span class="string">'[N('</span>, ci, <span class="string">'), k] = size(tn'</span>, ci, <span class="string">');'</span>]); <span class="comment">% number of data points</span>
    <span class="keyword">if</span> i == 1
</pre><h2>obtain time intervals and numbers of death<a name="10"></a></h2><pre class="codeinput">      D = tn1(:,2) - [tn1(2:N(i),2);0]; <span class="comment">% initiate death count</span>
      n0 =  tn1(1,2) * ones(N(1),1); <span class="comment">% initiate start number</span>
</pre><pre class="codeinput">    <span class="keyword">else</span>
      eval([<span class="string">'D = [D; tn'</span>, ci,<span class="string">'(:,2) - [tn'</span>, ci, <span class="string">'(2:N(i),2);0]];'</span>]);
                                <span class="comment">% append death counts</span>
      eval([<span class="string">'n0 = [n0; tn'</span>, ci, <span class="string">'(1,2) * ones(N('</span>, ci,<span class="string">'),1)];'</span>]);
				<span class="comment">% append initial numbers</span>
    <span class="keyword">end</span>
  <span class="keyword">end</span>

  q = p; <span class="comment">% copy input parameter matrix into output</span>
  info = 1; <span class="comment">% convergence has been successful</span>
  likmax = D' * log(max(1e-10, D ./ n0)); <span class="comment">% max of log lik function</span>

  [np, k] = size(p); <span class="comment">% k: number of parameters</span>
  index = 1:np;
  <span class="keyword">if</span> k&gt;1
    index = index(0 &lt; p(:,2)); <span class="comment">% indices of iterated parameters</span>
  <span class="keyword">end</span>
  l = max(size(index));  <span class="comment">% l: number of parameters that must be iterated</span>
  <span class="keyword">if</span> (l == 0)
    <span class="keyword">return</span>; <span class="comment">% no parameters to iterate</span>
  <span class="keyword">end</span>

  norm = 1 + max_norm; <span class="comment">% make sure that we start with iteration</span>
  step_number = 0; <span class="comment">% initiate number of iterations</span>
</pre><h2>start of numerical minimization<a name="12"></a></h2><pre class="codeinput">  <span class="keyword">while</span> (norm &gt; max_norm) &amp; (step_number &lt; max_step_number)
    step_number = step_number + 1; <span class="comment">% increment step number</span>
    [prob, dprob] = scdsurv(func, q(:,1));
				<span class="comment">% obtain death prob and derivatives</span>
    dlik = dprob'*(D./prob); <span class="comment">% deriv of log lik to pars</span>
    norm = dlik'*dlik; <span class="comment">% sum of squared derivatives</span>

    <span class="keyword">if</span> report ~= 0 <span class="comment">% monitor progress</span>
      dev = 2 * (likmax - D'*log(prob));
				<span class="comment">% deviance: 2* log lik minus its supremum</span>
      fprintf([<span class="string">'step '</span>, num2str(step_number), <span class="string">' norm '</span>, num2str(norm), <span class="keyword">...</span>
	      <span class="string">' dev '</span>, num2str(dev), <span class="string">'\n'</span>]);
    <span class="keyword">end</span>

    step = ((n0./prob * ones(1,l).*dprob)'*dprob)\dlik; <span class="comment">% planned step</span>
    step_size = step'*step;
    step = step*min(max_step_size, step_size)/step_size;
				<span class="comment">% reduce step if necessary</span>
    q(index,1) = q(index,1) + step; <span class="comment">% make step</span>

  <span class="keyword">end</span>
</pre><h2>trouble report<a name="13"></a></h2><pre class="codeinput">  <span class="keyword">if</span> step_number == max_step_number
    <span class="keyword">if</span> report ~= 0 <span class="comment">% print warning</span>
      fprintf([<span class="string">'no convergence within '</span>, num2str(max_step_number), <span class="keyword">...</span>
	      <span class="string">' steps \n'</span>]);
    <span class="keyword">end</span>
    info = 0; <span class="comment">% convergence has not been successful</span>
  <span class="keyword">end</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [q, info] = scsurv(func, p, varargin)
  %  created: 2001/09/11 by <NAME>; modified 2008/09/18
  %
  %% Description
  %  Finds maximum likelihood estimates from survival data using the method of scores, 
  %    with numerically obtained values for the jacobian. 
  %  It can deal with an arbitrary number of samples, which might share one or more parameters. 
  %  The convergence is usually fast, but the domain of attraction can be small, depending on data and model. 
  %  See nmsurv for simplex method, and scsurv2 and nmsurv2 for 2 independent variables. 
  %
  %% Input
  %  func: string with name of user-defined function
  %     f = func (p, tn) with
  %       p: k-vector with parameters; tn: (n,c)-matrix; f: n-vector
  %     [f1, f2, ...] = func (p, tn1, tn2, ...) with  p: k-vector  and
  %      tni: (ni,k)-matrix; fi: ni-vector with model predictions
  %     The dependent variable in the output f; For tn see below.
  %  p: (k,2) matrix with
  %     p(:,1) initial guesses for parameter values
  %     p(:,2) binaries with yes or no iteration (optional)
  %  tni (read as tn1, tn2, .. ): (ni,2) matrix with
  %     tni(:,1) time: must be increasing with rows
  %     tni(:,2) number of survivors: must be non-increasing with rows
  %     tni(:,3, 4, ... ) data-pont specific information data (optional)
  %     The number of data matrices tn1, tn2, ... is optional but >0
  %
  %% Output
  %  q: matrix like p, but with ml-estimates
  %  info: 1 if convergence has been successful; 0 otherwise
  %
  %% Remarks
  %  calls scdsurv, and user-defined function 'func'
  %  set options with 'scsurv_options'
  %  The iteration is terminated if the norm, i.e. 
  %    the sum of squared derivetives of the deviance with respect to the iterated parameters, 
  %    is less than the maximum norm or if the number of iterations exceeds a maximum values (see scsurv_options).
  %  If progression seems hopeful, but the number of iterations not large enough, 
  %    you can continue with pars = scsurv('function_name', pars, data). 
  %  Alternatively you can increase the maximum number of iterations with scsurv_options. 
  %
  %% Example of use
  %  assuming that data and function function_name and initial paramer estimates ipars are properly defined: 
  %  pars = scsurv('function_name', ipars, data) or 
  %  pars = scsurv('function_name', ipars, data1, data2) 
  %  (or more data sets, depending on the definition of the model functions.). 
  %  See script file mydata_surv.m for an example of specification. 

  %% Code
  global index l N ntn listtn listf listg global_txt
  global max_step_number max_step_size max_norm report; % option settings

  %% set options if necessary
  if prod(size(max_step_number)) == 0 
    scsurv_options('max_step_number', 20);
  end
  if prod(size(max_step_size)) == 0 
    scsurv_options('max_step_size', 1e20);
  end
  if prod(size(max_norm)) == 0
    scsurv_options('max_norm', 1e-8);
  end
  if prod(size(report)) == 0
    scsurv_options('report', 1);
  end

  ntn = nargin - 2; % number of data sets
  for i = 1:ntn % loop across data sets
    ci = num2str(i); % character string with value of i
    if i == 1
      listtn = ['tn', ci, ',']; % initiate list tn
      listf = ['f', ci, ','];   % initiate list f
      listg = ['g', ci, ','];   % initiate list g
    else     
      listtn = [listtn, ' tn', ci, ',']; % append list tn
      listf = [listf, ' f', ci,',']; % append list f
      listg = [listg, ' g', ci,',']; % append list g
    end
  end

  nl = size(listtn,2); listtn = listtn(1:(nl - 1)); % remove last ','
  nl = size(listf,2); listf = listf(1:(nl - 1)); % remove last ','
  nl = size(listg,2); listg = listg(1:(nl - 1)); % remove last ','

  global_txt = strrep(['global ', listtn], ',', ' ');
  eval(global_txt); % make data sets global

  global_txt = strrep(['global ', listtn], ',', ' ');
  eval(global_txt); % make data sets global

  N = zeros(ntn, 1); % initiate data counter
  for i = 1:ntn % loop across data sets
    ci = num2str(i); % character string with value of i
    eval(['tn', ci, ' = varargin{', ci,'};']); % assing unnamed arguments to xywi
    eval(['[N(', ci, '), k] = size(tn', ci, ');']); % number of data points
    if i == 1
      %% obtain time intervals and numbers of death
      D = tn1(:,2) - [tn1(2:N(i),2);0]; % initiate death count
      n0 =  tn1(1,2) * ones(N(1),1); % initiate start number
    else     
      eval(['D = [D; tn', ci,'(:,2) - [tn', ci, '(2:N(i),2);0]];']);
                                % append death counts
      eval(['n0 = [n0; tn', ci, '(1,2) * ones(N(', ci,'),1)];']);
				% append initial numbers
    end
  end

  q = p; % copy input parameter matrix into output
  info = 1; % convergence has been successful
  likmax = D' * log(max(1e-10, D ./ n0)); % max of log lik function

  [np, k] = size(p); % k: number of parameters
  index = 1:np;
  if k>1
    index = index(0 < p(:,2)); % indices of iterated parameters
  end
  l = max(size(index));  % l: number of parameters that must be iterated
  if (l == 0)
    return; % no parameters to iterate
  end
  
  norm = 1 + max_norm; % make sure that we start with iteration
  step_number = 0; % initiate number of iterations

  %% start of numerical minimization
  while (norm > max_norm) & (step_number < max_step_number)
    step_number = step_number + 1; % increment step number
    [prob, dprob] = scdsurv(func, q(:,1));
				% obtain death prob and derivatives
    dlik = dprob'*(D./prob); % deriv of log lik to pars
    norm = dlik'*dlik; % sum of squared derivatives

    if report ~= 0 % monitor progress
      dev = 2 * (likmax - D'*log(prob));
				% deviance: 2* log lik minus its supremum
      fprintf(['step ', num2str(step_number), ' norm ', num2str(norm), ...
	      ' dev ', num2str(dev), '\n']); 
    end

    step = ((n0./prob * ones(1,l).*dprob)'*dprob)\dlik; % planned step
    step_size = step'*step;
    step = step*min(max_step_size, step_size)/step_size;
				% reduce step if necessary
    q(index,1) = q(index,1) + step; % make step

  end

  %% trouble report
  if step_number == max_step_number
    if report ~= 0 % print warning
      fprintf(['no convergence within ', num2str(max_step_number), ...
	      ' steps \n']);
    end    
    info = 0; % convergence has not been successful
  end

##### SOURCE END #####
--></body></html>

<|start_filename|>docs/DEBtool_plant.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_plant</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: plant</H3>

Plant growth, reproduction: 6 reserves, 2 structures, generalized morphology

<HR>
<H4><A NAME="plant">plant</A></H4>

  Demo that runs:
  <UL>
    <LI> <A HREF="#pars_plant"><code>pars_plant</code></A>: parameter setting </LI>
    <LI> <A HREF="#shtime_plant"><code>shtime_plant</code></A>: development of root & shoot </LI>
  </UL>

  The model accounts for:
    effects of light (J_L.F), dioxygen (X_O) and carbon dioxide (X_C)
    concentrations in the air, ammonium (X_NH), nitrate (X_NO) and
    water (X_H) concentrations in the soil, and temperature (T).
  These environmental parameters are taken to be constant in the
    present implementation, but it is not difficult to let them vary in time.

  <P>
  Control vector:<BR>
  X = [J_L.F, X_C, X_O, X_NH, X_NO, X_H, T]

  <P>
  The plant is decomposed in:
    shoot product (PS, e.g. wood), structure (VS), general reserves (ES), nitrogen-reserves (ENS) and carbon-reserves (ECS)<BR>
    root  product (PR, e.g. wood), structure (VR), general reserves (ER), nitrogen-reserves (ENR) and carbon-reserves (ECR)<BR>
  State vector:<BR>
    M = [M_PS, M_VS, M_ECS, M_ENS, M_ES, M_PR, M_VR, M_ECR, M_ENR, M_ER]

  <P>
  The plant develops through an embryonic, juvenile and adult phase<BR>
  No assimilation occurs during the embryonic phase<BR>
  No reproduction allocation occurs during the juvenile phase

  <P>
  The interaction between root and shoot resembles that between host and symbiont. 
  It differs by translocation of general reserves, and the occurrence of the ratio of shoot and root surface area's in the saturation constants for nutrients and water.

  <P>
  Uptake is proportional to surface area of root or shoot. 
  The area's are take to be functions of the structure, and specified in routine <code>flux</code>; 
  many plants develop from a V1-morph, via a isomorph, to a V0-morph.  
  Maintenance of root and shoot is proportional to their structure.

  <P>
  The effect of water is incorporated with a single parameter for water availability. 
  This is too simple, since what counts is water transport, which depends on water in the soil as well as relative humidity in the atmosphere. 
  The saturation constant depends on the ratio if the surface area's of shoot and root (see <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">
 DEB-book</A> page {155}); 
  evaporation through shoots surface area, and uptake through roots surface area are in control of water transport.

  <P>
  The effect of both ammonia and nitrate are implemented, since their relative abundance dominates the preference of the plant. 
  Observe that, for suitable parameter choices, the shoot/root ratio depends on environmental conditions such that adverse conditions are compensated, to some extend. No optimality criteria are incorporated;
  just plain DEB mechanisms (see <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html"> DEB-book</A> page {209}). 
  Aging is not implemented.

  <P>
  Example of use after (optionally) editing file <code>pars_plant.m</code>: 
  <code>plant</code>

<HR>
<H4><A NAME="pars_plant">pars_plant</A></H4>

  Set the parameters by editing file <code>pars_plant.m</code> in toolbox plant.

<HR>
<H4><A NAME="shtime_plant">shtime_plant</A></H4>

  The plant is exposed to a constant environment.<BR> 
  Being usually below ground, the values for roots have been made negative, and the zero-line is plotted in brown. 
  See pages {207} ff of the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book</A>.<BR> 

  Four plots are shown of variables against time

  <P>
  Fig <B>1</B>
  Structure of shoot (green) and root (red)

  <P>
  Fig <B>2</B>
  Product of shoot (green) and root (red); you can think of wood, for instance

  <P>
  Fig <B>3</B> 
  Reserves of shoot and root; general reserve (red),
  C-reserve (brown), N-reserve (blue)

  <P>
  Fig <B>4</B> 
  Reserve densities of shoot and root (= reserve per structure); 
  general reserve (red), C-reserve (brown), N-reserve (blue).  
  The general reserve density of the root is clipped to the maximum value of the other reserve densities. 
  This is done because the seed initially starts with general root reserves only, which means that the general root reserve density is infinitely large.

  <P>
  Example of use after editing file <code>pars_plant.m</code> in toolbox plant:
  <code>pars_plant;shtime_plant</code>. 
  The command <code>pars_plant;shtime_plant(2)</code> gives figure 2 only.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>docs/DEBtool_lib_misc.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_lib_misc</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: lib/misc</H3>

Miscellaneous routines for the library. 
Some of these routines might move to other subdirectories in the future.

<H3><A NAME = "interpol">Interpolation, integration, differentiation, extremes, roots</A></H3>

  The following table summarizes the supporting functions.

  <table>
    <tr>
      <th></th>
      <th colspan = 2> general data</th>
      <th> periodic data</th>
    </tr>
    <tr>
      <th></th> <th> first order </th> <th> cubic </th> <th> Fourier</th>
    </tr>
    <tr>
      <th> task </th> <th> spline </th> <th> spline </th> <th> series </th>
    </tr>
    <tr> 
      <th> parametrisation</th> 
      <th> - </th>
      <th> <a HREF="../lib/misc/html/knot.html"><code>knot</code></a>, <a HREF="../lib/misc/html/knot_p.html"><code>knot_p</code></a> </th>
      <th> <a HREF="../lib/misc/html/get_fourier.html"><code>get_fourier</code></a> </th> 
    </tr>
    <tr> 
      <th> interpolation </th> 
      <th> <a HREF="../lib/misc/html/spline1.html"><code>spline1</code></a> </th>
      <th> <a HREF="../lib/misc/html/spline.html"><code>spline</code></a>, <a HREF="../lib/misc/html/spline_p.html"><code>spline_p</code></a> </th> 
      <th> <a HREF="../lib/misc/html/fnfourier.html"><code>fnfourier</code></a></th>
    </tr>
    <tr>
      <th> differentiation </th> 
      <th> <a HREF="../lib/misc/html/spline1.html"><code>spline1</code></a> </th> 
      <th> <a HREF="../lib/misc/html/spline.html"><code>spline</code></a>, <a HREF="../lib/misc/html/spline_p.html"><code>spline_p</code></a> </th>
      <th> <a HREF="../lib/misc/html/dfnfourier.html"><code>dfnfourier</code></a> </th> 
    </tr>   
    <tr>
      <th> 2nd differentiation </th> 
      <th> zero </th> 
      <th> <a HREF="../lib/misc/html/spline.html"><code>spline</code></a>, <a HREF="../lib/misc/html/spline_p.html"><code>spline_p</code></a> </th>
      <th> <a HREF="../lib/misc/html/ddfnfourier.html"><code>ddfnfourier</code></a> </th> 
    </tr>   
    <tr> 
      <th> integration </th> 
      <th> <a HREF="../lib/misc/html/ispline1.html"><code>ispline1</code></a> </th> 
      <th> <a HREF="../lib/misc/html/ispline.html"><code>ispline</code></a> </th>
      <th> <a HREF="../lib/misc/html/ifnfourier.html"><code>ifnfourier</code></a> </th> 
    </tr>
    <tr>
      <th> roots </th> 
      <th> <a HREF="../lib/misc/html/rspline1.html"><code>rspline1</code></a> </th> 
      <th> <a HREF="../lib/misc/html/rspline.html"><code>rspline</code></a> </th>
      <th> <a HREF="../lib/misc/html/rfnfourier.html"><code>rfnfourier</code></a> </th> 
    </tr>   
    <tr>
      <th> extremes </th> 
      <th> <a HREF="../lib/misc/html/espline1.html"><code>espline1</code></a> </th> 
      <th> <a HREF="../lib/misc/html/espline.html"><code>espline</code></a> </th>
      <th> <a HREF="../lib/misc/html/efnfourier.html"><code>efnfourier</code></a> </th> 
    </tr>   
    <tr>
      <th> example script</th> 
      <th> <a HREF="../lib/misc/mydata_smooth.m"><code>mydata_smooth</code></a> </th> 
      <th> <a HREF="../lib/misc/mydata_smooth.m"><code>mydata_smooth</code></a> </th>
      <th> <a HREF="../lib/misc/mydata_smooth.m"><code>mydata_smooth</code></a> </th> 
    </tr>   
    <tr>
      <th></th> 
      <th></th> 
      <th> <a HREF="../lib/misc/mydata_spline.m"><code>mydata_spline</code></a> </th>
      <th></th> 
    </tr>   
  </table>


<H3><A NAME = "reconfig">Reconfiguration</A></H3>

The function <a HREF="../lib/misc/html/wrap.html"><code>wrap</code></a> wraps a vector into a matrix, like function reshape, but the number of elements doesn't need to match. Function <a HREF="../lib/misc/html/trian.html"><code>trian</code></a> wraps a vector into an upper trangular matrix, function <a HREF="../lib/misc/html/itrian.html"><code>itrian</code></a> does the inverse.

<p>
Function <a HREF="../lib/misc/html/select_marker.html"><code>select_marker</code></a> modifies the specification of a marker that can be used in plotting.

<p>
Function <a HREF="../lib/misc/html/v2struct.html"><code>v2struct</code></a> converts variables into a structure, function <a HREF="../lib/misc/html/vars_pull.html"><code>vars_pull</code></a> does the opposite. Function <a HREF="../lib/misc/html/comp_struct.html"><code>comp_struct</code></a> checks two structures for differences. Function <a HREF="../lib/misc/html/matrix2file.html"><code>matrix2file</code></a> writes a matrix of numbers to an m-file.

<H3><A NAME = "calculus">Calculus</A></H3>

Function <a HREF="../lib/misc/html/beta0.html"><code>beta0</code></a> computes a special incomplete beta function; function <a HREF="../lib/misc/html/gamma.html"><code>gamma</code></a> the incomplete gamma function.

<p>
Functions <a HREF="../lib/misc/html/re.html"><code>re</code></a> and <a HREF="../lib/misc/html/im.html"><code>im</code></a> separate the real and imaginary parts of complex numbers.

<p>
Function <a HREF="../lib/misc/html/ricatti.html"><code>ricatti</code></a> solves the Riccati equation. Function <a HREF="../lib/misc/html/rotate.html"><code>rotate</code></a> rotates a 2-vector.

<p>
Functions <a HREF="../lib/misc/html/roots3.html"><code>roots3</code></a> and <a HREF="../lib/misc/html/rooth.html"><code>rooth</code></a> find roots of a cubic polynomial. Function <a HREF="../lib/misc/html/cont1.html"><code>cont1</code></a> finds intervals for which a function exceeds a specief level.

<p>
Functions <a HREF="../lib/misc/html/dirfield.html"><code>dirfield</code></a> and <a HREF="../lib/misc/html/dirfield3.html"><code>dirfield3</code></a> compute the direction fields for 2 and 3 variables.

<H3><A NAME = "numerics">Numerics</A></H3>

Function <a HREF="../lib/misc/html/rkutta.html"><code>rkutta</code></a> intergrates a set of ode's using a Runge Kutta 5 method; <a HREF="../lib/misc/html/int2equi.html"><code>int2equi</code></a> integrates till equilibrium. Function <a HREF="../lib/misc/html/numdif.html"><code>numdif</code></a> numerically differentiates a function of several variables. Function <a HREF="../lib/misc/html/nmmin.html"><code>nmmin</code></a> finds the minimum of a function. 

<p>
Function <a HREF="../lib/misc/html/cummax.html"><code>cummax</code></a> gets cumulative maxima from a series of numbers.

<H3><A NAME = "DEB">DEB</A></H3>

Function <a HREF="../lib/misc/html/C2K.html"><code>C2K</code></a> converts Celsius to Kelvin, <a HREF="../lib/misc/html/K2C.html"><code>K2C</code></a> does the opposite. <a HREF="../lib/misc/html/tempcorr.html"><code>tempcorr</code></a> computes the temperature correction factor, <a HREF="../lib/misc/html/shtemp2corr.html"><code>shtemp2corr</code></a> produces a plot of the correction factor as function of temperature.

<p>
Functions <a HREF="../lib/misc/html/shstar.html"><code>shstar</code></a> and <a HREF="../lib/misc/html/shloglogstar.html"><code>shloglogstar</code></a> plot a star where slopes are multiples of 1/3.

<p>
Functions <a HREF="../lib/misc/html/printpar.html"><code>printpar</code></a> and <a HREF="../lib/misc/html/print_txt_var.html"><code>print_txt_var</code></a> print text in combination with values.

<H3><A NAME = "markup">Markup</A></H3>

Function <a HREF="../lib/misc/html/debtool_fn_markup.html"><code>debtool_fn_markup</code></a> specifies the markup rules for function in DEBtool_M.
It can be used as template to write DEBtool functions.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/ebtstop.c<|end_filename|>
/***
   NAME
     ebtstop.c
   PURPOSE
     This file contains the ShutDown() routine and the routine
     WriteRepport() to generate a report of the run statistics. 
   NOTES
     
   HISTORY
     AMdR - Jul 20, 1995 : Created.
     AMdR - Feb 11, 2018 : Revised last.
***/

#define	EBTSTOP_C				/* Identification of file   */
#define	EBTLIB					/* and file grouping        */

#include "escbox.h"				/* Include general header   */
#include "ebtmain.h"
#include "ebtstop.h"
#include "ebtutils.h"


/* <NAME> 2020/04/02 */
#include "ebttint.h"

/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define ESF  "Unable to open ESF file for storing end state of populations!"
#define REP  "Unable to open REP file for generating report file of the run!"
#define MARN "Memory allocation failure in storing user defined report notes!"



/*==========================================================================*/
/*
 * Start of function implementations.
 */
						/* ARGSUSED                 */
#ifndef MODULE
EXTERN_C void	ShutDown(int exitcode)
#else
EXTERN_C int	ShutDown(int exitcode)
#endif

  /* 
   * ShutDown - Routine closes the output file and saves the entire end
   *		state of the population and the environment in the end
   *		state file. 
   */

{
  char                  filename[MAXFILENAMELEN];
  FILE                  *esf;

  if (resfil) (void)fclose(resfil);		/* Close result file        */
  if (csbfil) (void)fclose(csbfil);		/* Close binary state file  */

#if ((BIFURCATION == 1) && (MEASUREBIFSTATS == 1))
  if (averages)  (void)fclose(averages);	// Close bifurcation output
  if (gaverages) (void)fclose(gaverages);	// files
  if (variances) (void)fclose(variances);
  if (extrema)   (void)fclose(extrema);
#endif
						/* Save final state         */
						/* Open ESF file with       */
						/* lower case extension     */
  (void)strcpy(filename, runname);
  (void)strcat(filename, "esf");
  esf=fopen(filename, "w");
  if(!esf)                                      /* On error try upper case  */
    {
      (void)strcpy(filename, runname); (void)strcat(filename, "ESF");
      esf=fopen(filename, "w");
      if(!esf) ErrorAbort(ESF);                 /* On repeated error exit   */
#ifdef MODULE
      if (error_code & FATAL_ERROR) return error_code;
#endif
    }

  WriteStateToFile(esf, NULL);			/* Write state to .esf file */
  (void)fclose(esf);                            /* Close end state file     */

#ifndef MODULE
  (void)strcpy(filename, runname);
  filename[strlen(filename)-1] = '\0';		// Remove trainling dot
  (void)fprintf(stderr, "\n\nRUN %-s COMPLETED at T = %.2f:\n", filename, env[0]);
  (void)fprintf(stderr, "** %-70s **\n\n", 
	  "Program terminated. Normal closure of output files succeeded.");

  (void)fflush(stdout); 
  (void)fflush(stderr);

  if (exitcode >= 0)
    {
#if (DEBUG > 0)
      if (exitcode) abort();
      else
#endif  /* DEBUG */
      exit(exitcode);
    }
  return;
#else
  return error_code;
#endif /* MODULE */
}



/*==========================================================================*/

void ReportNote(const char *fmt, ...)

{
  va_list		argpnt;
  register int		i;
  static int		lines = 0, count = 0;
  
  if ((!usernotes) || (count >= (lines-1)))
    {
      lines += 10;
      usernotes = (char **)Myalloc((void *)usernotes,
				   (size_t)lines, sizeof(char *));
      if (!usernotes) ErrorAbort(MARN);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
      for (i=count; i<lines; i++) usernotes[i] = (char *)NULL;
    }
  usernotes[count] = (char *)Myalloc((void *)NULL, REPORTNOTE_MAX, sizeof(char));
  if (!(usernotes[count])) ErrorAbort(MARN);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

  va_start(argpnt, fmt);
#ifdef _MSC_VER
  _vsnprintf(usernotes[count], REPORTNOTE_MAX, fmt, argpnt);
#else
  vsnprintf(usernotes[count], REPORTNOTE_MAX, fmt, argpnt);
#endif
  va_end(argpnt);
  
  count++;

  return;
} /* ReportNotes */



/*==========================================================================*/

void	  WriteReport(int argc, char **argv)

{
  register int		i;
  char			filename[MAXFILENAMELEN], *ch, **unp;
  FILE			*rep;
						/* Open REP file with	    */
						/* lower case extension	    */
  ch=strcpy(filename, runname); ch=strcat(filename, "rep");
  rep=fopen(filename, "w");
  
  if(!rep)					/* On error try upper case  */
    {
      ch=strcpy(filename, runname); ch=strcat(filename, "REP");
      rep=fopen(filename, "w");
      if(!rep) ErrorAbort(REP);			/* On repeated error exit   */
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
    }
  
  while(*ch) ch++;
  while(*(--ch)!='.') *ch=' ';
  *ch='\0';
  
  for(i=0; i<79; i++) (void)fprintf(rep, "*");
  (void)fprintf(rep, "\n");
  (void)fprintf(rep, "\n%2s%-s\n", " ", "PROGRAM, RUN AND ARGUMENTS");
  (void)fprintf(rep, "%4sProgram   : %-s\n", " ", progname);
  (void)fprintf(rep, "%4sRun       : %-s\n", " ", filename);
  (void)fprintf(rep, "%4sArguments : ", " ");
  for (i=2; i<argc; i++) (void)fprintf(rep, " %-s", argv[i]);
  (void)fprintf(rep, "\n");

  if (usernotes)
    {
      unp = usernotes;
      (void)fprintf(rep, "\n%2s%-s\n", " ", "MODEL SPECIFIC NOTES");
      while (*unp)
	{
	  (void)fprintf(rep, "%4s%-s\n", " ", *unp);
	  unp++;
	}
    }
  
  (void)fprintf(rep, "\n%2s%-s\n", " ", "USED VALUES FOR CONTROL VARIABLES");
  (void)fprintf(rep, "%4s%-65s%5s%-s\n", " ", 
		"Time integration method", "  :  ",
#if    (TIME_METHOD ==  RK2)
                "RK2");
#elif  (TIME_METHOD ==  RK4)
                "RK4");
#elif  (TIME_METHOD  == RKF45)
		"RKF45");
#elif  (TIME_METHOD ==  RKCK)
                "RKCK");
#elif  (TIME_METHOD ==  DOPRI5)
                "DOPRI5");
#elif  (TIME_METHOD ==  DOPRI8)
                "DOPRI8");
#elif  (TIME_METHOD ==  RADAU5)
                "RADAU5");
#else
		"RKCK");
#endif
  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.accuracy, "  :  ", accuracy);
  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.cohort_limit, "  :  ", cohort_limit);
  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.identical_zero, "  :  ", identical_zero);

  (void)fprintf(rep, "%4s%-65s%5s%-10.2f\n", " ", 
		description.max_time, "  :  ", max_time);
  (void)fprintf(rep, "%4s%-65s%5s%-10.2f\n", " ", 
		description.delt_out, "  :  ", delt_out);

#if (POPULATION_NR > 0)
  register int		j;

  (void)fprintf(rep, "%4s%-65s%5s%-10.2f\n", " ", 
		description.state_out, "  :  ", state_out);
  
  (void)fprintf(rep, "\n%2s%-s\n", " ", "USED VALUES OF TOLERANCES");

  (void)fprintf(rep, "%4s%-65s%5s", " ",
		description.abs_tols[number], "  :  ");
  for(i=0; i<POPULATION_NR; i++)
      (void)fprintf(rep, "%-7.4G", abs_tols[i][number]);
  (void)fprintf(rep, "\n");

  for(j=0; j<I_STATE_DIM; j++)
    {
      (void)fprintf(rep, "%4s%-65s%5s", " ",
		    description.rel_tols[i_state(j)], "  :  ");
      for(i=0; i<POPULATION_NR; i++)
	  (void)fprintf(rep, "%-7.4G", rel_tols[i][i_state(j)]);
      (void)fprintf(rep, "\n");
    }
  
  for(j=0; j<I_STATE_DIM; j++)
    {
      (void)fprintf(rep, "%4s%-65s%5s", " ",
		    description.abs_tols[i_state(j)], "  :  ");
      for(i=0; i<POPULATION_NR; i++)
	  (void)fprintf(rep, "%-7.4G", abs_tols[i][i_state(j)]);
      (void)fprintf(rep, "\n");
    }
#endif // (POPULATION_NR > 0)
  
#if PARAMETER_NR
  (void)fprintf(rep, "\n%2s%-s\n", " ", "USED VALUES OF PARAMETERS");
  
  for(i=0; i<PARAMETER_NR; i++)
      (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		    description.parameter[i], "  :  ", parameter[i]);
#endif

#if (BIFURCATION == 1)
  (void)fprintf(rep, "\n%2s%-s\n", " ", "USED VALUES OF BIFURCATION VARIABLES");
  
  (void)fprintf(rep, "%4s%-65s%5s%-4d\n", " ", 
		description.bifparindex, "  :  ", BifParIndex);

  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.bifparstep , "  :  ", BifParStep);

  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.bifparlastval , "  :  ", BifParLastVal);

  (void)fprintf(rep, "%4s%-65s%5s%-4d\n", " ", 
		description.bifparlogstep, "  :  ", BifParLogStep);

  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.bifoutput , "  :  ", BifOutput);

#if (POPULATION_NR > 0)
  (void)fprintf(rep, "%4s%-65s%5s%-10.4G\n", " ", 
		description.bifstateoutput , "  :  ", BifStateOutput);
#endif // (POPULATION_NR > 0)
#endif // (BIFURCATION == 1)

  for(i=0; i<79; i++) (void)fprintf(rep, "*");
  (void)fprintf(rep, "\n");
  
  (void)fclose(rep);
  
  return;
}



/*==========================================================================*/


<|start_filename|>lib/misc/html/v2struct.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>v2struct</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2016-03-13"><meta name="DC.source" content="v2struct.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>v2struct</h1><!--introduction--><p>Pack/Unpack Variables to/from a scalar structure.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#3">Syntax</a></li><li><a href="#4">Description</a></li><li><a href="#5">Examples</a></li><li><a href="#6">Usage example (includes sub-functions)</a></li><li><a href="#7">Revision history</a></li></ul></div><h2>Syntax<a name="3"></a></h2><pre>  Pack
    S = v2struct
    S = v2struct(x,y,z,...)
    S = v2struct(fieldNames)
    S = v2struct(A,B,C,..., fieldNames)
    S = v2struct(x,..., nameOfStruct2Update, fieldNames)
    v2struct
    v2struct(x,y,z,...)
    v2struct(fieldNames)
    v2struct(A,B,C,..., fieldNames)
    v2struct(x,..., nameOfStruct2Update, fieldNames)</pre><pre>  Unpack
    v2struct(S)
    [a,b,c,...] = v2struct(S)
    v2struct(S,fieldNames)</pre><h2>Description<a name="4"></a></h2><pre>  v2struct has dual functionality in packing &amp; unpacking variables into structures and
  vice versa, according to the syntax and inputs.</pre><pre>  Function features:
    * Pack variables to structure with enhanced field naming
    * Pack and update variables in existing structure
    * Unpack variables from structure with enhanced variable naming
    * Unpack only specific fields in a structure to variables
    * Unpack without over writing existing variables in work space</pre><pre>  In addition to the obvious usage, this function could by highly useful for example in
  working with a function with multiple inputs. Packing variables before the call to
  the function, and unpacking it in the beginning of the function will make the function
  call shorter, more readable, and you would not have to worry about arguments order any
  more. Moreover you could leave the function as it is and you could pass same inputs to
  multiple functions, each of which will use its designated arguments placed in the
  structure.</pre><h2>Examples<a name="5"></a></h2><pre>% see 'Usage example' section below for convenient presentation of these examples.</pre><pre>  % NOTE: whenever using filedNames cell array please note the following
  %  1. fieldNames cell array must include a cell with the string 'fieldNames'
  %  2. fieldNames cell array input must be the last input.</pre><pre>% Pack
    x = zeros(3); x2 = ones(3); y = 'Testing123'; z = cell(2,3);
    fieldNames1 = {'fieldNames', 'x', 'y', 'z'};
    fieldNames2 = {'fieldNames', 'a', 'b', 'c'};
    fieldNames3 = {'fieldNames', 'x'};
    nameOfStruct2Update = 'S';</pre><pre>     % The four examples below return structure S with same values however the
     % structure's field names are defined differently in every syntax.
    % Example 1.
    % structure field names defined by variables names.
     S = v2struct(x,y,z)
    % Example 2.
    % structure field names defined according to the cell array fieldNames.
     % NOTE: variables with the names in fieldNames1 must exist in the caller workspace.
     S = v2struct(fieldNames1)
    % Example 3.
    % same as #1. but arguments are passed explicitly
     S = v2struct(zeros(3), 'Testing123', cell(2,3), fieldNames1)
    % Example 4.
    % field names defined by content of fieldNames2 while
    % the values are set according to the passed arguments. In this case the structure
    % S returned would be: S.a=x, S.b=y, S.c=z
     S = v2struct(x,y,z, fieldNames2)</pre><pre>    % Example 5.
    % update structure S. The fields that would be updated are according to content
    % of fieldNames3. Note that you must pass a variable with the name
    % 'nameOfStruct2Update' placed before 'fieldNames3'. This variable should contain
    % the name of the structure you want to update as a string. Also note that if you
    % set an output structure name which is different than the one stated in
    % nameOfStruct2Update a new structure would be created and the structure that was
    % meant to be updated would not get updated.
     S.oldField = 'field to be saved for future use'
     S = v2struct(x2, nameOfStruct2Update, fieldNames3)</pre><pre>    % Example 6.
    % pack all variables in caller workspace. Call without input arguments.
      S = v2struct</pre><pre>    % The following examples return the same results as the examples above but the
    % structure would be returned with the default name 'Sv2struct'. Be cautious as
    % this might lead to overriding of arguments.
    % Example 7.
     v2struct(x,y,z)
    % Example 8.
     v2struct(fieldNames1)
    % Example 9.
     v2struct(zeros(3), 'Testing123', cell(2,3), fieldNames1)
    % Example 10.
     v2struct(x,y,z, fieldNames2)
    % Example 11.
     S.oldField = 'field to be saved for future use'
     v2struct(x2, nameOfStruct2Update, fieldNames3)
    % Example 12.
     v2struct</pre><pre>% Unpack
    clear S x x2 y z fieldNames1 fieldNames2 fieldNames3 nameOfStruct2Update
    S.x = zeros(3); S.y = 'Testing123'; S.z = cell(2,3);
    fieldNames3 = {'fieldNames','x','z'};</pre><pre>    % Example 1.
    % This example creates or overwrites variables x, y, z in the caller with the
    % contents of the corresponding named fields.
     v2struct(S)</pre><pre>    % Example 2.
    % This example assigns the contents of the fields of the scalar structure
    % S to the variables a,b,c rather than overwriting variables in the caller. If
    % there are fewer output variables than there are fields in S, the remaining fields
    % are not extracted.
     [a,b,c] = v2struct(S)</pre><pre>    % Example 3.
    % This example creates or overwrites variables x and z in the caller with the
    % contents of the corresponding named fields.
     v2struct(S, fieldNames3)</pre><pre>    % Example 4.
    % This example assigns the contents of the fields 'x' and 'z' defined by
    % fieldNames3 of the scalar structure S to the variables a and b rather than
    % overwriting variables in the caller. If there are fewer output variables than
    % there are fields in S, the remaining fields are not extracted.
     [a,b] = v2struct(S, fieldNames3)</pre><pre>     % This example unpacks variables 'y' and 'z' only without overwriting variable 'x'.
     % NOTE the addition of the field named 'avoidOverWrite' to the structure to be
     % unpacked. This is mandatory in order to make this functionality work. The
     % contents of this field can be anything, it does not matter.
    S.avoidOverWrite = '';
    x = 'do not overwrite me';
    v2struct(S)</pre><h2>Usage example (includes sub-functions)<a name="6"></a></h2><pre>  1. run attached v2structDemo1.m file for on screen presentation of examples.
  2. run attached v2structDemo2.m file and read comments in file for a suggestion of
     how to use v2struct in managing input to other functions with improved usability.</pre><h2>Revision history<a name="7"></a></h2><pre>  2011-05-19, <NAME>., Creation
  2011-05-29, Adi N., Update structure added, some documentation and demo function changes
  2011-06-02, Adi N., Fixed updating structure functionality
  2011-06-05, Adi N., Added functionality: avoid overwritring existing variables, added
                      unpacking examples to demo1 .m file.
  2011-06-30, Adi N., fieldNames usage corrected, now must include a specific string to
                      be triggered. Documentation enhanced. Code tweaked.
  2011-07-14, Adi N., Fixed bug in packing with variables only
  2011-08-14, Adi N., Clarified warning and error when packing/unpacking with
                      fieldNames.
  2011-09-12, Adi N., Added easy packing of all variables in caller workspace (thanks
                      to <NAME> for the suggestion), fixed bug in warning
                      handling in packing case, edited comments.</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% v2struct
% Pack/Unpack Variables to/from a scalar structure.

%%
function varargout = v2struct(varargin)
%    Inspired by the function: mmv2truct - <NAME>, University of Maine, Orono, ME
%    04469 4/28/99, 9/29/99, renamed 10/19/99 Mastering MATLAB 5, Prentice Hall,
%    ISBN 0-13-858366-8

%% Syntax
%    Pack
%      S = v2struct
%      S = v2struct(x,y,z,...)
%      S = v2struct(fieldNames)
%      S = v2struct(A,B,C,..., fieldNames)
%      S = v2struct(x,..., nameOfStruct2Update, fieldNames)
%      v2struct
%      v2struct(x,y,z,...)
%      v2struct(fieldNames)
%      v2struct(A,B,C,..., fieldNames)
%      v2struct(x,..., nameOfStruct2Update, fieldNames)
%
%    Unpack
%      v2struct(S)
%      [a,b,c,...] = v2struct(S)
%      v2struct(S,fieldNames)

%% Description
%    v2struct has dual functionality in packing & unpacking variables into structures and
%    vice versa, according to the syntax and inputs.
%
%    Function features:
%      * Pack variables to structure with enhanced field naming
%      * Pack and update variables in existing structure
%      * Unpack variables from structure with enhanced variable naming
%      * Unpack only specific fields in a structure to variables
%      * Unpack without over writing existing variables in work space
%
%    In addition to the obvious usage, this function could by highly useful for example in
%    working with a function with multiple inputs. Packing variables before the call to
%    the function, and unpacking it in the beginning of the function will make the function
%    call shorter, more readable, and you would not have to worry about arguments order any
%    more. Moreover you could leave the function as it is and you could pass same inputs to
%    multiple functions, each of which will use its designated arguments placed in the
%    structure.

%      [a,b,c,...] = v2struct(S,fieldNames)
%
% Input:
%
% * Pack - inputs
%
%      x,y,z,...           - any variable to pack. can be replaced by fieldNames below.
%      nameOfStruct2Update - optional, name of structure to update if desired.
%      fieldNames          - optional, cell array of strings, which must include a cell
%                            with the string 'fieldNames' and must be the last input.
% * Unpack - inputs
%
%      S          - name of structure to be unpacked.
%      fieldNames - optional, cell array of strings, which must include a cell with the
%                   string 'fieldNames' and must be the last input.
%
% Output:
%
% * Pack - outputs 
%
%      S - the packed structure. If there is no output argument then a structure named
%          Sv2struct would be created in the caller workspace.
%
% * Unpack - outputs  
%
%      a,b,c,... - variables upacked from the structure.
%                  if there are no output arguments then variables would be created in
%                  the caller workspace with naming according to name of inputs.

%% Examples
%  % see 'Usage example' section below for convenient presentation of these examples.
%
%    % NOTE: whenever using filedNames cell array please note the following
%    %  1. fieldNames cell array must include a cell with the string 'fieldNames'
%    %  2. fieldNames cell array input must be the last input.
%
%  % Pack
%      x = zeros(3); x2 = ones(3); y = 'Testing123'; z = cell(2,3);
%      fieldNames1 = {'fieldNames', 'x', 'y', 'z'};
%      fieldNames2 = {'fieldNames', 'a', 'b', 'c'};
%      fieldNames3 = {'fieldNames', 'x'};
%      nameOfStruct2Update = 'S';
%
%       % The four examples below return structure S with same values however the
%       % structure's field names are defined differently in every syntax. 
%      % Example 1.
%      % structure field names defined by variables names.
%       S = v2struct(x,y,z) 
%      % Example 2.
%      % structure field names defined according to the cell array fieldNames. 
%       % NOTE: variables with the names in fieldNames1 must exist in the caller workspace.
%       S = v2struct(fieldNames1) 
%      % Example 3.
%      % same as #1. but arguments are passed explicitly
%       S = v2struct(zeros(3), 'Testing123', cell(2,3), fieldNames1) 
%      % Example 4.
%      % field names defined by content of fieldNames2 while
%      % the values are set according to the passed arguments. In this case the structure
%      % S returned would be: S.a=x, S.b=y, S.c=z
%       S = v2struct(x,y,z, fieldNames2) 
%
%      % Example 5.
%      % update structure S. The fields that would be updated are according to content
%      % of fieldNames3. Note that you must pass a variable with the name
%      % 'nameOfStruct2Update' placed before 'fieldNames3'. This variable should contain
%      % the name of the structure you want to update as a string. Also note that if you
%      % set an output structure name which is different than the one stated in
%      % nameOfStruct2Update a new structure would be created and the structure that was
%      % meant to be updated would not get updated.
%       S.oldField = 'field to be saved for future use'
%       S = v2struct(x2, nameOfStruct2Update, fieldNames3)
%
%      % Example 6.
%      % pack all variables in caller workspace. Call without input arguments.
%        S = v2struct
%
%      % The following examples return the same results as the examples above but the
%      % structure would be returned with the default name 'Sv2struct'. Be cautious as
%      % this might lead to overriding of arguments.
%      % Example 7.
%       v2struct(x,y,z)
%      % Example 8.
%       v2struct(fieldNames1)
%      % Example 9.
%       v2struct(zeros(3), '<PASSWORD>', cell(2,3), fieldNames1)
%      % Example 10.
%       v2struct(x,y,z, fieldNames2)
%      % Example 11.
%       S.oldField = 'field to be saved for future use'
%       v2struct(x2, nameOfStruct2Update, fieldNames3)
%      % Example 12.
%       v2struct
%
%  % Unpack
%      clear S x x2 y z fieldNames1 fieldNames2 fieldNames3 nameOfStruct2Update
%      S.x = zeros(3); S.y = 'Testing123'; S.z = cell(2,3);
%      fieldNames3 = {'fieldNames','x','z'};
%
%      % Example 1.
%      % This example creates or overwrites variables x, y, z in the caller with the
%      % contents of the corresponding named fields.
%       v2struct(S)
%
%      % Example 2.
%      % This example assigns the contents of the fields of the scalar structure
%      % S to the variables a,b,c rather than overwriting variables in the caller. If
%      % there are fewer output variables than there are fields in S, the remaining fields
%      % are not extracted.
%       [a,b,c] = v2struct(S)
%
%      % Example 3.
%      % This example creates or overwrites variables x and z in the caller with the
%      % contents of the corresponding named fields.
%       v2struct(S, fieldNames3)
%
%      % Example 4.
%      % This example assigns the contents of the fields 'x' and 'z' defined by
%      % fieldNames3 of the scalar structure S to the variables a and b rather than
%      % overwriting variables in the caller. If there are fewer output variables than
%      % there are fields in S, the remaining fields are not extracted.
%       [a,b] = v2struct(S, fieldNames3)
%
%       % This example unpacks variables 'y' and 'z' only without overwriting variable 'x'. 
%       % NOTE the addition of the field named 'avoidOverWrite' to the structure to be
%       % unpacked. This is mandatory in order to make this functionality work. The
%       % contents of this field can be anything, it does not matter. 
%      S.avoidOverWrite = '';
%      x = 'do not overwrite me';
%      v2struct(S)
%
%% Usage example (includes sub-functions)
%    1. run attached v2structDemo1.m file for on screen presentation of examples.
%    2. run attached v2structDemo2.m file and read comments in file for a suggestion of
%       how to use v2struct in managing input to other functions with improved usability.

%% Revision history
%    2011-05-19, <NAME>., Creation
%    2011-05-29, Adi N., Update structure added, some documentation and demo function changes
%    2011-06-02, Adi N., Fixed updating structure functionality
%    2011-06-05, Adi N., Added functionality: avoid overwritring existing variables, added
%                        unpacking examples to demo1 .m file.
%    2011-06-30, Adi N., fieldNames usage corrected, now must include a specific string to
%                        be triggered. Documentation enhanced. Code tweaked.
%    2011-07-14, <NAME>., Fixed bug in packing with variables only
%    2011-08-14, <NAME>., Clarified warning and error when packing/unpacking with
%                        fieldNames.
%    2011-09-12, <NAME>., Added easy packing of all variables in caller workspace (thanks 
%                        to <NAME> for the suggestion), fixed bug in warning
%                        handling in packing case, edited comments.

% parse input for field names
if isempty(varargin)
   gotCellArrayOfStrings = false;
   toUnpackRegular = false;
   toUnpackFieldNames = false;
   gotFieldNames = false;
else
   gotCellArrayOfStrings = iscellstr(varargin{end});
   
   toUnpackRegular = (nargin == 1) && isstruct(varargin{1});
   if toUnpackRegular
      fieldNames = fieldnames(varargin{1})';
      nFields = length(fieldNames);
   end
   
   gotFieldNames = gotCellArrayOfStrings & any(strcmpi(varargin{end},'fieldNames'));
   if gotFieldNames
      fieldNamesRaw = varargin{end};
      % indices of cells with actual field names, leaving out the index to 'fieldNames' cell.
      indFieldNames = ~strcmpi(fieldNamesRaw,'fieldNames');
      fieldNames = fieldNamesRaw(indFieldNames);
      nFields = length(fieldNames);
   end
   toUnpackFieldNames = (nargin == 2) && isstruct(varargin{1}) && gotFieldNames;
end


% Unpack
if toUnpackRegular || toUnpackFieldNames 
   
   struct = varargin{1};
   assert(isequal(length(struct),1) , 'Single input nust be a scalar structure.');
   CallerWS = evalin('caller','whos'); % arguments in caller work space
   
   % update fieldNames according to 'avoidOverWrite' flag field.
   if isfield(struct,'avoidOverWrite')
      indFieldNames = ~ismember(fieldNames,{CallerWS(:).name,'avoidOverWrite'});
      fieldNames = fieldNames(indFieldNames);
      nFields = length(fieldNames);
   end
   
   if toUnpackRegular % Unpack with regular fields order
      if nargout == 0 % assign in caller
         for iField = 1:nFields
            assignin('caller',fieldNames{iField},struct.(fieldNames{iField}));
         end
      else % dump into variables
         for iField = 1:nargout
            varargout{iField} = struct.(fieldNames{iField});
         end
      end
      
   elseif toUnpackFieldNames % Unpack with fields according to fieldNames
      if nargout == 0 % assign in caller, by comparing fields to fieldNames
         for iField = 1:nFields
            assignin('caller',fieldNames{iField},struct.(fieldNames{iField}));
         end
      else % dump into variables
         assert( isequal(nFields, nargout) , ['Number of output arguments',...
            ' does not match number of field names in cell array']);
         for iField = 1:nFields
            varargout{iField} = struct.(fieldNames{iField});
         end
      end
   end
   
% Pack   
else
   % build cell array of input names
   CallerWS = evalin('caller','whos');
   inputNames = cell(1,nargin);
   for iArgin = 1:nargin
      inputNames{iArgin} = inputname(iArgin);
   end
   nInputs = length(inputNames);
   
      % look for 'nameOfStruct2Update' variable and get the structure name
   if ~any(strcmpi(inputNames,'nameOfStruct2Update')) % no nameOfStruct2Update
      nameStructArgFound = false;
      validVarargin = varargin;
   else % nameOfStruct2Update found
      nameStructArgFound = true;
      nameStructArgLoc = strcmp(inputNames,'nameOfStruct2Update');
      nameOfStruct2Update = varargin{nameStructArgLoc};
      % valid varargin with just the inputs to pack and fieldNames if exists
      validVarargin = varargin(~strcmpi(inputNames,'nameOfStruct2Update'));
      % valid inputNames with just the inputs name to pack and fieldNames if exists
      inputNames = inputNames(~strcmpi(inputNames,'nameOfStruct2Update'));
      nInputs = length(inputNames);
      % copy structure from caller workspace to enable its updating
      if ismember(nameOfStruct2Update,{CallerWS(:).name}) % verify existance
         S = evalin('caller',nameOfStruct2Update);
      else
         error(['Bad input. Structure named ''',nameOfStruct2Update,...
            ''' was not found in workspace'])
      end
   end
   
   % when there is no input or the input is only variables and perhaps
   % also nameOfStruct2Update   
   if ~gotFieldNames
      % no input, pack all of variables in caller workspace
      if isequal(nInputs, 0)
         for iVar = 1:length(CallerWS)
            S.(CallerWS(iVar).name) = evalin('caller',CallerWS(iVar).name);
         end
         % got input, check input names and pack
      else
         for iInput = 1:nInputs
            if gotCellArrayOfStrings % called with a cell array of strings
               errMsg = sprintf(['Bad input in cell array of strings.'...
                           '\nIf you want to pack (or unpack) using this cell array as'...
                           ' designated names'...
                           '\nof the structure''s fields, add a cell with the string'...
                           ' ''fieldNames'' to it.']);
            else
               errMsg = sprintf(['Bad input in argument no. ', int2str(iArgin),...
                                 ' - explicit argument.\n'...
                          'Explicit arguments can only be called along with a matching'...
                          '\n''fieldNames'' cell array of strings.']);
            end
            assert( ~isempty(inputNames{iInput}), errMsg);
            S.(inputNames{iInput}) = validVarargin{iInput};
         end
         
         % issue warning for possible wrong usage when packing with an input of cell array of
         % strings as the last input without it containing the string 'fieldNames'.
         if gotCellArrayOfStrings
            name = inputNames{end};
            % input contains structure and a cell array of strings
            if (nargin == 2) && isstruct(varargin{1})
               msgStr = [inputNames{1},''' and ''',inputNames{2},''' were'];
               % input contains any arguments with an implicit cell array of strings
            else
               msgStr = [name, ''' was'];
            end
            warnMsg = ['V2STRUCT - ''%s packed in the structure.'...
               '\nTo avoid this warning do not put ''%s'' as last v2struct input.'...
               '\nIf you want to pack (or unpack) using ''%s'' as designated names'...
               ' of the'...
               '\nstructure''s fields, add a cell with the string ''fieldNames'' to'...
               ' ''%s''.'];
            fprintf('\n')
            warning('MATLAB:V2STRUCT:cellArrayOfStringNotFieldNames',warnMsg,msgStr,...
                     name,name,name)
         end
      end
   % fieldNames cell array exists in input
   elseif gotFieldNames
      nVarToPack = length(varargin)-1-double(nameStructArgFound);
      if nVarToPack == 0 % no variables to pack
         for iField = 1:nFields
            S.(fieldNames{iField}) = evalin('caller',fieldNames{iField});
         end
         
         % else - variables to pack exist
         % check for correct number of fields vs. variables to pack
      elseif ~isequal(nFields,nVarToPack)
         error(['Bad input. Number of strings in fieldNames does not match',...
                'number of input arguments for packing.'])
      else
         for iField = 1:nFields
            S.(fieldNames{iField}) = validVarargin{iField};
         end
      end
      
   end % if ~gotFieldNames

if nargout == 0
   assignin( 'caller', 'Sv2struct',S );
else
   varargout{1} = S;
end

end % if nargin

##### SOURCE END #####
--></body></html>

<|start_filename|>lib/regr/html/shsurv2.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>shsurv2</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="shsurv2.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Example of use, assuming that function_name, pars, tvalues, yvalues, and numbers are defined properly:</a></li><li><a href="#6">Code</a></li><li><a href="#8">gset linestyle 1 lt 2 lw 2 pt 3 ps 0.5</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> shsurv2 (func, p, t, y, Z)
</pre><pre class="codeinput">  <span class="comment">%  created: 2002/02/10 by <NAME>; 2005/01/27</span>
  <span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>Plots model predictions and data (optionally). Options can be set by shregr2_options.
It allows you to plot a response surface in 3 dimensions, together with your data, or sets of tn-curves or yn-curves.
The data are projected on the surface, and on the curves, to show the difference between the data and model predictions.
These projections help to reveal which data-point relates to which curve.</pre><h2>Input<a name="4"></a></h2><pre>func: name of user-defined function (see scsurv2)
p: (r,k)-matrix with parameters in p(1,:)
t: (n,1)-vector with first independent variable (time)
y: (m,1)-vector with second independent variable
Z: (n,m)-matrix with observed numbers of survivors (optional)</pre><h2>Example of use, assuming that function_name, pars, tvalues, yvalues, and numbers are defined properly:<a name="5"></a></h2><pre>shsurv2('function_name', pars, tvalues, yvalues, numbers) or shsurv2 ('function_name', pars, tvalues, yvalues).</pre><h2>Code<a name="6"></a></h2><pre class="codeinput">  <span class="keyword">global</span> xtext ytext ztext plotnr Range all_in_one;

  <span class="comment">%  set options if necessary</span>
  <span class="keyword">if</span> prod(size(plotnr)) == 0 <span class="comment">% select plot number</span>
    plotnr = 3; <span class="comment">% plotnr 1 and 2</span>
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(all_in_one)) == 0 <span class="comment">% all graphs in one</span>
    all_in_one = 0;
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(Range)) == 0 <span class="comment">% set plot ranges</span>
    Range = [0, 1.1*max(t); 0.9*min(y(:,1)), 1.1*max(y(:,1))];
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(xtext)) == 0
    xtext = <span class="string">'time '</span>;
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(ytext)) == 0
    ytext = <span class="string">' '</span>;
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(ztext)) == 0
    ztext = <span class="string">'number '</span>;
  <span class="keyword">end</span>

  nt = max(size(t)); ny = max(size(y(:,1))); nty = nt*ny;
  N = 100; M = 10;

  xaxis = linspace(Range(1,1), Range(1,2), N)';
  yaxis = linspace(Range(2,1), Range(2,2), N)';
  Xaxis = linspace(Range(1,1), Range(1,2), M)';
  Yaxis = linspace(Range(2,1), Range(2,2), M)';


  p = p(:,1);
  eval([<span class="string">'F = '</span>, func,<span class="string">' (p, t, y);'</span>]);
  Z = Z./(ones(nt,1)*Z(1,:));

  clf;

  <span class="keyword">if</span> all_in_one == 1
</pre><pre class="codeinput">    hold <span class="string">on</span>;
    <span class="keyword">for</span> i = 1:M
      eval([<span class="string">'f = '</span>, func, <span class="string">'(p, Xaxis(i), yaxis);'</span>]);
      xyz = [Xaxis(i*ones(N,1)), yaxis, f'];
      plot3(xyz(:,1), xyz(:,2), xyz(:,3), <span class="string">'r'</span>);
    <span class="keyword">end</span>
    <span class="keyword">for</span> j = 1:M
      eval([<span class="string">'f = '</span>, func, <span class="string">'(p, xaxis, Yaxis(j));'</span>]);
      xyz = [xaxis, Yaxis(j*ones(N,1)), f];
      plot3(xyz(:,1), xyz(:,2), xyz(:,3), <span class="string">'r'</span>);
    <span class="keyword">end</span>
    xlabel(xtext); ylabel(ytext); zlabel(ztext);
    view(-37.5, 30);
    grid <span class="string">on</span>
    axis <span class="string">square</span>
    rotate3d <span class="string">on</span>;

    xlabel(xtext); ylabel(ytext); zlabel(ztext);
</pre><h2>gset linestyle 1 lt 2 lw 2 pt 3 ps 0.5<a name="8"></a></h2><pre class="codeinput">    <span class="keyword">if</span> prod(size(Z)) ~= 0
      xyz = zeros(nty, 3);
      <span class="keyword">for</span> i= 1:nt
        xyz((i-1)*ny + (1:ny), :) = [t(i*ones(ny,1)), y(:,1), Z(i,:)'];
      <span class="keyword">end</span>
      plot3(xyz(:,1), xyz(:,2), xyz(:,3),<span class="string">'*b'</span>); <span class="comment">%% with points;</span>
      z = ones(2,1);
      <span class="keyword">for</span> i = 1:nt
        <span class="keyword">for</span> j=1:ny
	      xyz = [t(i*z), y(j*z,1), [Z(i,j);F(i,j)]];
	      plot3 (xyz(:,1), xyz(:,2), xyz(:,3),<span class="string">'m'</span>);
        <span class="keyword">end</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>
</pre><pre class="codeinput">  <span class="keyword">elseif</span> (plotnr == 1)
    hold <span class="string">on</span>;
    <span class="keyword">for</span> i = 1:ny
      eval([<span class="string">'f = '</span>, func, <span class="string">'(p, xaxis, y(i,:));'</span>]);
      plot(xaxis, f, <span class="string">'r'</span>)
      <span class="keyword">if</span> prod(size(Z)) ~= 0
        plot(t, Z(:,i), <span class="string">'b+'</span>);
        <span class="keyword">for</span> j = 1:nt
          plot(t([j,j]), [Z(j,i); F(j,i)], <span class="string">'m'</span>);
        <span class="keyword">end</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>
    xlabel(xtext);
    ylabel(ztext);

  <span class="keyword">elseif</span> (plotnr == 2)
    hold <span class="string">on</span>;
    <span class="keyword">for</span> i = 1:nt
      eval([<span class="string">'f = '</span>, func, <span class="string">'(p, t(i), yaxis);'</span>]);
      plot(yaxis, f, <span class="string">'r'</span>);
      <span class="keyword">if</span> prod(size(Z)) ~= 0
        plot(y(:,1), Z(i,:)', <span class="string">'b+'</span>);
        <span class="keyword">for</span> j = 1:ny
          plot(y([j j],1), [Z(i, j); F(i, j)], <span class="string">'m'</span>);
        <span class="keyword">end</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>
    xlabel(ytext);
    ylabel(ztext);

  <span class="keyword">else</span>
    clf;

    subplot(1,2,1); hold <span class="string">on</span>;
    <span class="keyword">for</span> i = 1:ny
      eval([<span class="string">'f = '</span>, func, <span class="string">'(p, xaxis, y(i,1));'</span>]);
      plot(xaxis, f, <span class="string">'r'</span>);
      <span class="keyword">if</span> prod(size(Z)) ~= 0
        plot(t, Z(:,i), <span class="string">'b+'</span>);
        <span class="keyword">for</span> j = 1:nt
          plot(t([j, j]), [Z(j,i); F(j,i)], <span class="string">'m'</span>);
        <span class="keyword">end</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>
    xlabel(xtext);
    ylabel(ztext);

    subplot(1,2,2); hold <span class="string">on</span>;
    <span class="keyword">for</span> i = 1:nt
      eval([<span class="string">'f = '</span>, func, <span class="string">'(p, t(i), yaxis);'</span>]);
      plot(yaxis, f, <span class="string">'r'</span>);
      <span class="keyword">if</span> prod(size(Z)) ~= 0
        plot(y(:,1), Z(i,:)', <span class="string">'b+'</span>);
        <span class="keyword">for</span> j = 1:ny
          plot(y([j, j],1), [Z(i,j); F(i,j)], <span class="string">'m'</span>);
        <span class="keyword">end</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>
    xlabel(ytext);
    ylabel(ztext);

  <span class="keyword">end</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function shsurv2 (func, p, t, y, Z)
  %  created: 2002/02/10 by <NAME>; 2005/01/27
  %
  %% Description
  %  Plots model predictions and data (optionally). Options can be set by shregr2_options. 
  %  It allows you to plot a response surface in 3 dimensions, together with your data, or sets of tn-curves or yn-curves. 
  %  The data are projected on the surface, and on the curves, to show the difference between the data and model predictions. 
  %  These projections help to reveal which data-point relates to which curve. 
  %
  %% Input
  %  func: name of user-defined function (see scsurv2)
  %  p: (r,k)-matrix with parameters in p(1,:)
  %  t: (n,1)-vector with first independent variable (time)
  %  y: (m,1)-vector with second independent variable
  %  Z: (n,m)-matrix with observed numbers of survivors (optional)
  %
  %% Example of use, assuming that function_name, pars, tvalues, yvalues, and numbers are defined properly: 
  %  shsurv2('function_name', pars, tvalues, yvalues, numbers) or shsurv2 ('function_name', pars, tvalues, yvalues). 

  %% Code
  global xtext ytext ztext plotnr Range all_in_one;

  %  set options if necessary
  if prod(size(plotnr)) == 0 % select plot number
    plotnr = 3; % plotnr 1 and 2
  end
  if prod(size(all_in_one)) == 0 % all graphs in one
    all_in_one = 0;
  end
  if prod(size(Range)) == 0 % set plot ranges
    Range = [0, 1.1*max(t); 0.9*min(y(:,1)), 1.1*max(y(:,1))];
  end
  if prod(size(xtext)) == 0
    xtext = 'time ';
  end
  if prod(size(ytext)) == 0
    ytext = ' ';
  end
  if prod(size(ztext)) == 0
    ztext = 'number ';
  end

  nt = max(size(t)); ny = max(size(y(:,1))); nty = nt*ny;
  N = 100; M = 10;

  xaxis = linspace(Range(1,1), Range(1,2), N)';
  yaxis = linspace(Range(2,1), Range(2,2), N)';
  Xaxis = linspace(Range(1,1), Range(1,2), M)';
  Yaxis = linspace(Range(2,1), Range(2,2), M)';

  
  p = p(:,1);
  eval(['F = ', func,' (p, t, y);']);
  Z = Z./(ones(nt,1)*Z(1,:));

  clf; 
  
  if all_in_one == 1
    hold on;
    for i = 1:M
      eval(['f = ', func, '(p, Xaxis(i), yaxis);']);
      xyz = [Xaxis(i*ones(N,1)), yaxis, f'];
      plot3(xyz(:,1), xyz(:,2), xyz(:,3), 'r');
    end
    for j = 1:M
      eval(['f = ', func, '(p, xaxis, Yaxis(j));']);
      xyz = [xaxis, Yaxis(j*ones(N,1)), f];
      plot3(xyz(:,1), xyz(:,2), xyz(:,3), 'r');
    end
    xlabel(xtext); ylabel(ytext); zlabel(ztext);
    view(-37.5, 30);
    grid on
    axis square
    rotate3d on;
  
    xlabel(xtext); ylabel(ytext); zlabel(ztext);
    %% gset linestyle 1 lt 2 lw 2 pt 3 ps 0.5
  
    if prod(size(Z)) ~= 0
      xyz = zeros(nty, 3);
      for i= 1:nt
        xyz((i-1)*ny + (1:ny), :) = [t(i*ones(ny,1)), y(:,1), Z(i,:)'];
      end
      plot3(xyz(:,1), xyz(:,2), xyz(:,3),'*b'); %% with points;
      z = ones(2,1);
      for i = 1:nt
        for j=1:ny
	      xyz = [t(i*z), y(j*z,1), [Z(i,j);F(i,j)]];
	      plot3 (xyz(:,1), xyz(:,2), xyz(:,3),'m');
        end
      end
    end
 
  elseif (plotnr == 1)
    hold on;
    for i = 1:ny
      eval(['f = ', func, '(p, xaxis, y(i,:));']);
      plot(xaxis, f, 'r')
      if prod(size(Z)) ~= 0
        plot(t, Z(:,i), 'b+');
        for j = 1:nt
          plot(t([j,j]), [Z(j,i); F(j,i)], 'm');
        end
      end
    end
    xlabel(xtext);
    ylabel(ztext);

  elseif (plotnr == 2)
    hold on;
    for i = 1:nt
      eval(['f = ', func, '(p, t(i), yaxis);']);
      plot(yaxis, f, 'r');
      if prod(size(Z)) ~= 0
        plot(y(:,1), Z(i,:)', 'b+');
        for j = 1:ny
          plot(y([j j],1), [Z(i, j); F(i, j)], 'm');
        end
      end
    end
    xlabel(ytext);
    ylabel(ztext);

  else
    clf;
    
    subplot(1,2,1); hold on;
    for i = 1:ny
      eval(['f = ', func, '(p, xaxis, y(i,1));']);
      plot(xaxis, f, 'r');
      if prod(size(Z)) ~= 0
        plot(t, Z(:,i), 'b+');
        for j = 1:nt
          plot(t([j, j]), [Z(j,i); F(j,i)], 'm');
        end
      end
    end
    xlabel(xtext);
    ylabel(ztext);
  
    subplot(1,2,2); hold on;
    for i = 1:nt
      eval(['f = ', func, '(p, t(i), yaxis);']);
      plot(yaxis, f, 'r');
      if prod(size(Z)) ~= 0
        plot(y(:,1), Z(i,:)', 'b+');
        for j = 1:ny
          plot(y([j, j],1), [Z(i,j); F(i,j)], 'm');
        end
      end
    end
    xlabel(ytext);
    ylabel(ztext);

  end
##### SOURCE END #####
--></body></html>

<|start_filename|>animal/html/mydata_reprod_rate.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_reprod_rate</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-02-26"><meta name="DC.source" content="mydata_reprod_rate.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><pre class="codeinput"><span class="comment">% script to illustrate reprod_rate</span>

z = 1;           <span class="comment">% -, zoom factor</span>
F_m = 6.5;       <span class="comment">% l/d.cm^2, {F_m} max spec searching rate</span>
kap_X = 0.8;     <span class="comment">% -, digestion efficiency of food to reserve</span>
kap_X_P = 0.1;   <span class="comment">% -, faecation efficiency of food to faeces</span>
<span class="comment">% kap_X_P does not affect state varables, only mineral and faeces fluxes</span>
v = 0.02;        <span class="comment">% cm/d, energy conductance</span>
kap = 0.8;       <span class="comment">% -, alloaction fraction to soma = growth + somatic maintenance</span>
kap_R = 0.95;    <span class="comment">% -, reproduction efficiency</span>
p_M = 18;        <span class="comment">% J/d.cm^3, [p_M] vol-specific somatic maintenance</span>
p_T =  0;        <span class="comment">% J/d.cm^2, {p_T} surface-specific som maintenance</span>
k_J = 0.002;     <span class="comment">% 1/d, maturity maint rate coefficient</span>
E_G = 2800;      <span class="comment">% J/cm^3, [E_G], spec cost for structure</span>

<span class="comment">% life stage parameters: b = birth; i = metamorphosis; p = puberty</span>
<span class="comment">% E_H is the cumulated energy from reserve invested in maturation</span>
E_Hb = 275e-3 * z^3; <span class="comment">% J, E_H^b, maturity at birth</span>
E_Hs = E_Hb + 1e-5;  <span class="comment">% J, E_H^s, maturity at start acceleration</span>
E_Hj = E_Hb + 2e-5;  <span class="comment">% J, E_H^j, maturity at end acceleration</span>
E_Hp = 50 * z^3;     <span class="comment">% J, E_H^p, maturity at puberty</span>

f = 1;               <span class="comment">% -, scaled functional response</span>

p_Am = z * p_M/ kap; E_m = p_Am/ v; g = E_G/ kap/ E_m; k_M = p_M/ E_G; L_T = 0;
U_Hb = E_Hb/ p_Am; U_Hp = E_Hp/ p_Am;
pars_reprod_rate = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hp];

L = (.001:.05:1)'; Lf = [.15 .5];
[R, UE0, Lb, Lp, info] = reprod_rate(L, f, pars_reprod_rate, Lf);

subplot(1,3,1)
plot(L, R, <span class="string">'r'</span>, Lp, 0, <span class="string">'or'</span>)
xlabel(<span class="string">'length, cm'</span>)
ylabel(<span class="string">'reprod rate, #/d'</span>)

<span class="comment">% now with acceleration</span>

E_Hj = 20 * z^3;
U_Hj = E_Hj/ p_Am;
pars_reprod_rate_j = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hj; U_Hp];
[R, UE0, Lb, Lj, Lp, info] = reprod_rate_j(L, f, pars_reprod_rate_j, Lf);

subplot(1,3,2)
plot(L, R, <span class="string">'r'</span>, Lp, 0, <span class="string">'or'</span>)
xlabel(<span class="string">'length, cm'</span>)
ylabel(<span class="string">'reprod rate acc, #/d'</span>)

<span class="comment">% now with delayed acceleration</span>

E_Hs = 2 * z^3;
U_Hs = E_Hs/ p_Am;
pars_reprod_rate_s = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hs; U_Hj; U_Hp];
[R, UE0, Lb, Ls, Lj, Lp, info] = reprod_rate_s(L, f, pars_reprod_rate_s, Lf);

subplot(1,3,3)
plot(L, R, <span class="string">'r'</span>, Lp, 0, <span class="string">'or'</span>)
xlabel(<span class="string">'length, cm'</span>)
ylabel(<span class="string">'reprod rate d acc, #/d'</span>)
</pre><img vspace="5" hspace="5" src="mydata_reprod_rate_01.png" alt=""> <p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
% script to illustrate reprod_rate

z = 1;           % -, zoom factor
F_m = 6.5;       % l/d.cm^2, {F_m} max spec searching rate
kap_X = 0.8;     % -, digestion efficiency of food to reserve
kap_X_P = 0.1;   % -, faecation efficiency of food to faeces
% kap_X_P does not affect state varables, only mineral and faeces fluxes
v = 0.02;        % cm/d, energy conductance
kap = 0.8;       % -, alloaction fraction to soma = growth + somatic maintenance
kap_R = 0.95;    % -, reproduction efficiency
p_M = 18;        % J/d.cm^3, [p_M] vol-specific somatic maintenance
p_T =  0;        % J/d.cm^2, {p_T} surface-specific som maintenance
k_J = 0.002;     % 1/d, maturity maint rate coefficient
E_G = 2800;      % J/cm^3, [E_G], spec cost for structure

% life stage parameters: b = birth; i = metamorphosis; p = puberty
% E_H is the cumulated energy from reserve invested in maturation
E_Hb = 275e-3 * z^3; % J, E_H^b, maturity at birth
E_Hs = E_Hb + 1e-5;  % J, E_H^s, maturity at start acceleration
E_Hj = E_Hb + 2e-5;  % J, E_H^j, maturity at end acceleration
E_Hp = 50 * z^3;     % J, E_H^p, maturity at puberty

f = 1;               % -, scaled functional response 

p_Am = z * p_M/ kap; E_m = p_Am/ v; g = E_G/ kap/ E_m; k_M = p_M/ E_G; L_T = 0; 
U_Hb = E_Hb/ p_Am; U_Hp = E_Hp/ p_Am;
pars_reprod_rate = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hp];

L = (.001:.05:1)'; Lf = [.15 .5]; 
[R, UE0, Lb, Lp, info] = reprod_rate(L, f, pars_reprod_rate, Lf);

subplot(1,3,1)
plot(L, R, 'r', Lp, 0, 'or')
xlabel('length, cm')
ylabel('reprod rate, #/d')

% now with acceleration

E_Hj = 20 * z^3;
U_Hj = E_Hj/ p_Am;
pars_reprod_rate_j = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hj; U_Hp];
[R, UE0, Lb, Lj, Lp, info] = reprod_rate_j(L, f, pars_reprod_rate_j, Lf);

subplot(1,3,2)
plot(L, R, 'r', Lp, 0, 'or')
xlabel('length, cm')
ylabel('reprod rate acc, #/d')

% now with delayed acceleration

E_Hs = 2 * z^3;
U_Hs = E_Hs/ p_Am;
pars_reprod_rate_s = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hs; U_Hj; U_Hp];
[R, UE0, Lb, Ls, Lj, Lp, info] = reprod_rate_s(L, f, pars_reprod_rate_s, Lf);

subplot(1,3,3)
plot(L, R, 'r', Lp, 0, 'or')
xlabel('length, cm')
ylabel('reprod rate d acc, #/d')

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebtcsbdefs.h<|end_filename|>
/***
   NAME
     ebtcsbdefs.h
   PURPOSE
     Define some structs used both in ebtutils.c and in ebtcsbfile (in the ebttool)
   NOTES

   HISTORY
     AMdR - Oct 07, 2016 : Revised.
     AvdM - May 11, 2005 : Created.
***/

#ifndef EBTCSBDEFS_H
#define EBTCSBDEFS_H

#if defined(_MSC_VER) && (_MSC_VER <= 1600)
   typedef __int32 uint32_t;
#else
   #include <stdint.h>
#endif

typedef struct envdim {
                        double          timeval;
                        int             columns;
                        int             data_offset;
                        uint32_t        memory_used;
                       } Envdim;

typedef struct popdim {
                        double          timeval;
                        int             population;
                        int             cohorts;
                        int             columns;
                        int             data_offset;
                        int             lastpopdim;
                       } Popdim;



/*===========================================================================*/
#endif /* EBTCSBDEFS_H */


<|start_filename|>docs/DEBtool_fig_3.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_fig</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: fig_3</H3>

  A collection of functions that produces the figures of the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book third edition</A>. 
  These functions show the actual data, how the data have been fitted, and what parameters are used in the various specific applications of the DEB theory; the DEB book gives biological background of and conclusions from the figures. 
  The files also illustrate the use of functions in the library of DEBtool and the subtleties of parameter identifiability. 
  Make sure that the <b>path to DEBtool and all its subdirectories</b> is set; 
  this large collection of scripts and functions not only uses DEBtool/lib/ but also other toolboxes. 
  Subdirectory <code>fig_3</code> has subdirectories <code>ch1, ch2, ., ch11</code> for figures in 11 chapters.

  <p>
  The first lines in each source-script file gives the figure name, the bib-codes for data-sources and the names of the output files as used in the DEB-book. 
  This info is used for maintenance purposes.

  <p>
  If you run several figures, you might need to clear previous plots with <code>clf</code>.

<HR>
<H4><A NAME="fig">fig</A></H4>

  All figures are run from a single function <code>fig</code>, which requires a character string as input, with a chapter and a figure number, separated by a dot. 
  If this figure has code, it runs the code, which is in one of the subdirectories ch1, ch2, ., ch11 and gives the page number of the DEB book as output. Many routines give details on parameter values, standard deviations and produce output during the search for the best fitting parameters.

  <p>
  To view the code, first inspect function <code>fig</code> to learn the name of the source function in one of the subdirectories, then inspect that function. 
  So the code for figure <code>'1.7'</code> can be found in <code>KooyHoef89</code> in <code>/fig_3/ch1</code>. 
  This code typically calls other functions, which are either in that subdirectory, or in sister directories of <code>fig_3</code>.


  <p>
  Support exists for the following figures
  <ol>
    <li> 2, 6, 7, 8 </li>
    <li> 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 17, 19 </li>
    <li> 1, 2 </li>
    <li> 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 </li>
    <li> 1, 5, 6, 8, 9, 12 </li>
    <li> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 </li>
    <li> 2, 6, 7, 8, 10, 11, 12, 15, 17, 18, 20, 21, 22, 23, 24, 25 </li>
    <li> 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15 </li>
    <li> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17 </li>
    <li> 8, 11 </li>
    <li> 1 </li>
  </ol>

  <P>
  Example of use: 
  <CODE>fig('1.7')</CODE> to run figure <code>7</code> of chapter <code>1</code>.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page
 
</BODY>
</HTML>


<|start_filename|>docs/DEBtool_popDyn.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_popDyn</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: popDyn</H3>

  A collection of routines for stepping from individuals to populations with different book-keeping schemes.
  

<HR>
<H4><A NAME="sgr">sgr, ssd, fis0</A></H4>
  Specific population growth rate (sgr), population statistics (ssd) and f for which sgr=0 (fis0).


<HR>
<H4><A NAME="cpm">SSM</A></H4>
  Semi Structured Model for populations in a generalized reactor, starting from a single freshly-laid egg.
  Embryoa, juveniles and adults are delineated, but without an internal structure.

<HR>
<H4><A NAME="cpm">cpm</A></H4>
  Cohort Projection Model for populations with synchronized periodic reproduction events in a generalized reactor, starting from a single freshly-laid egg.


<HR>
<H4><A NAME="ebt">ebt</A></H4>
  Escalator Boxcar Train for populations in a generalized reactor, starting from a single freshly-laid egg.


<HR>
  Back to the <A HREF="index.html" TARGET="_top">DEBtool</A>

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/escbox.h<|end_filename|>
/***
  NAME
    escbox.h
  PURPOSE
    This file contains all include statements for the program, some
    constant and type definitions that are used in the population data
    representations and the prototypes of various functions.
    This file is meant to be included in all escalator boxcar train
    modules, as it contains the global definitions that are accessible to
    all modules. 
  NOTES
     
  HISTORY
    AMdR - Jul 19, 1995 : Created.
    AMdR - May 23, 2019 : Revised last.
***/

#ifndef ESCBOX_H
#define ESCBOX_H

#if defined(MODULE)
#include "ebttooldefs.h"
#endif

#define RK2                       98110801                                          // Key values to indicate the different integration methods
#define RK4                       98110802
#define RKF45                     98110803
#define RKCK                      98110804
#define DOPRI5                    98110805
#define DOPRI8                    98110806
#define RADAU5                    98110807
#define CVODE                     98110808
#define CVBDF                     98110809

#define MAXDERS                   20                                                // Max. stages in ODE solver

#if defined(PROBLEMFILE)                                                            // If program header file is defined, include it. 
#include PROBLEMFILE
#else
#error You failed to specify the PROBLEMFILE constant. Use the "ebt" script!
#endif

#ifndef TIME_METHOD
#define TIME_METHOD               RKCK
#endif

#ifndef DYNAMIC_COHORTS
#define DYNAMIC_COHORTS           0
#endif
#if (DYNAMIC_COHORTS > 0)
#define DYNAMIC_COHORTS    1
#if ((TIME_METHOD != DOPRI5) && (TIME_METHOD != DOPRI8) && \
     (TIME_METHOD != RADAU5) && (TIME_METHOD != CVODE ) && (TIME_METHOD != CVBDF))
#undef  TIME_METHOD
#define TIME_METHOD               DOPRI5
#endif
#else
#define DYNAMIC_COHORTS           0
#endif

#ifndef EVENT_NR
#define EVENT_NR                  0
#endif
#if (EVENT_NR > 0)
#if ((TIME_METHOD != DOPRI5) && (TIME_METHOD != DOPRI8) && \
     (TIME_METHOD != RADAU5) && (TIME_METHOD != CVODE ) && (TIME_METHOD != CVBDF))
#undef  TIME_METHOD
#define TIME_METHOD               DOPRI5
#endif
#else
#define EVENT_NR                  0
#endif

#ifndef BIFURCATION
#define BIFURCATION               0
#ifndef MEASUREBIFSTATS
#define MEASUREBIFSTATS           0
#endif
#elif (BIFURCATION == 1)
#ifndef MEASUREBIFSTATS
#define MEASUREBIFSTATS           1
#endif
#endif

#ifndef CHECK_EXTINCTION
#define CHECK_EXTINCTION          2                                                 // 0: Ignore all tests; 1: Ignore run ending; 2: Test and end run
#endif

#include "ebttune.h"
#include "ctype.h"
#include "math.h"
#include "stdio.h"
#include "string.h"

#if HAS_FLOAT_H
#include "float.h"
#endif

#if HAS_SIGNALS
#include "signal.h"
#endif

#if defined(_GNU_SOURCE)
#include "fenv.h"
#endif

#include "limits.h"
#include "stddef.h"
#include "stdlib.h"
#include "stdarg.h"
#include "sys/stat.h"


/*==================================================================================================================================*/
/*
 * Definition of some global constants. Most of these definitions only take
 * effect if the flag EBTLIB is defined, which occurs in the
 * Escalator Boxcar Train module files.
 */

#if (POPULATION_NR > 0)                                                             // The number of replicate  
#define COHORT_SIZE               (1+I_STATE_DIM)                                   // size of cohort           
#else
#define I_CONST_DIM               0
#define I_STATE_DIM               0
#define COHORT_SIZE               0
#endif

#if defined(DBL_MAX)                                                                // Stub value for missing data point
#define MISSING_VALUE             (DBL_MAX)
#elif defined(MAXDOUBLE)
#define MISSING_VALUE             (MAXDOUBLE)
#else
#define MISSING_VALUE             (1.23456789e+307)
#endif

#define   BIFTINY                 1.0E-4                                            // Tiny value used in bifurcation computations 
#ifdef EBTLIB
#if defined(PATH_MAX)                                                               // Maximum length of the full path to a file      
#define MAXFILENAMELEN            (PATH_MAX)
#elif defined(MAXPATHLEN)
#define MAXFILENAMELEN            (MAXPATHLEN)
#elif defined(_MAX_PATH)
#define MAXFILENAMELEN            (_MAX_PATH)
#else
#define MAXFILENAMELEN            (512)
#endif

#define DESCRIP_MAX               80                                                // The maximum length of a quantity description   

#define REPORTNOTE_MAX            4096                                              // The maximum length of a ReportNote             

#define MEM_BLOCK_SIZE            256                                               // Number of doubles in allocated memory block   
#define SMALLEST_STEP             1.0E-12                                           // The minimum step size allowed in integration   
#define DEFAULT_STEP              0.1                                               // Default step size in integration              
#ifndef LARGEST_STEP
#define LARGEST_STEP              1.0                                               // The maximum step size allowed in integration
#endif
#define MIN_ACCURACY              1.0E-16                                           // The minimum accuracy allowed in integration   
#endif // EBTLIB 

#define NOSWITCH                  -1                                                // Stub values for problem without events
#define NO_EVENT                  -1
#define NO_COHORT_END             0
#define COHORT_END                1


#ifndef I_CONST_DIM
#define I_CONST_DIM               0
#endif


/*==================================================================================================================================*/
/*
 * Definition of the cohort structure that will hold the data of one 
 * population cohort. Also defined is a pointer type to a single cohort and
 * the population data type.
 */

typedef double                    cohort[COHORT_SIZE];
typedef cohort                    *cohort_pnt;
typedef cohort_pnt                population;
#if (I_CONST_DIM > 0)
typedef double                    cohortID[I_CONST_DIM];
typedef cohortID                  *cohortID_pnt;
typedef cohortID_pnt              popID;
#endif
typedef int                       cohort_ind[COHORT_SIZE];
typedef cohort_ind                *cohort_ind_pnt;
typedef cohort_ind_pnt            population_index;


/*==================================================================================================================================*/
/* 
 * Defining macro's for global use in all files
 */

#define number                    (0)
#define i_state(a)                ((a+1))
#define i_const(a)                ((a))

#define DEF_TYPE                  void                                              // Basic pointer type       
#define CONST                     const
#define SIZE_TYPE                 size_t

#define MemBlocks(a)              (((a/MEM_BLOCK_SIZE)+1)*MEM_BLOCK_SIZE)
#define EBTDEBUG(a)               (dbgfil && (debug_level >= (a)))


/*==================================================================================================================================*/
/*
 * Definition of global variables and functions accessible in user
 * specified problem file.
 */

#ifndef EBTLIB
#define CycleStart                SetBpointNo
#define CycleEnd                  InstantDynamics

extern double                     cohort_limit;
extern double                     next_output, next_state_output;
#if (POPULATION_NR > 0)
extern int                        cohort_no[POPULATION_NR];
extern int                        bpoint_no[POPULATION_NR];
#endif // (POPULATION_NR > 0)
extern int                        rk_level;
extern int                        ForcedCohortEnd;
extern int                        ForcedRunEnd;
extern int                        LocatedEvent;
extern int                        parameter_nr;
#if PARAMETER_NR
extern double                     parameter[PARAMETER_NR];
#endif
#if (BIFURCATION == 1)
extern int                        BifParIndex;
extern double                     BifOutput;
extern double                     BifStateOutput;
extern double                     BifPeriod;
#endif // (BIFURCATION == 1)
#if ((POPULATION_NR > 0) && (I_CONST_DIM > 0))
extern popID                      popIDcard[POPULATION_NR];
extern popID                      ofsIDcard[POPULATION_NR];
#endif
extern int                        AddCohorts(population *, int, int);

extern int                        imax(int, int);
extern int                        imin(int, int);
extern double                     max(double, double);
extern double                     min(double, double);

#ifdef iszero
#undef iszero
#endif
extern int                        iszero(double);
extern int                        ismissing(double);
extern int                        isequal(double, double);
extern void                       SetStepSize(double);
extern void                       SievePop(void);
extern void                       ErrorAbort(const char *);
extern void                       ErrorExit(const int, const char *);
extern void                       Warning(const char *);
extern void                       ReportNote(const char *, ...);
extern void                       LabelState(int, const char *, ...);
extern void                       measureBifstats(double *env, population *pop);
#endif // EBTLIB 




/*==================================================================================================================================*/
/*
 * Prototyping all functions that are defined in the problem-specific
 * program file
 */

#ifdef  EBTLIB
#undef  EXTERN
#define EXTERN                    extern
#else
#undef  EXTERN
#define EXTERN
#endif
EXTERN void                       UserInit(int, char **, double *, population *);
EXTERN void                       SetBpointNo(double *, population *, int *);
EXTERN void                       SetBpoints(double *, population *, population *);
EXTERN void                       Gradient(double *, population *, population *, double *, population *, population *, population *);
EXTERN void                       EventLocation(double *, population *, population *, population *, double *);
EXTERN int                        ForceCohortEnd(double *, population *, population *, population *);
EXTERN void                       InstantDynamics(double *, population *, population *);
EXTERN void                       DefineOutput(double *, population *, double *);


/*==================================================================================================================================*/
#endif // ESCBOX_H 


<|start_filename|>docs/DEBtool_lib_pet.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_lib_pet</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3><A NAME="toolbox_lib_pet">Toolbox: lib/pet</A></H3>

Routines for the add_my_pet collection. 
The aim is to 
<ul>
  <li>estimate DEB parameters from a collection of data sets</li>
  <li>present goodness of fit and accuracy
  <li>evaluate implied properties
</ul>   

<H4><A NAME="Todo">Preparation of an entry</H4>

Make sure that the path to DEBtool_M and AmPtool and their subdirectories has been set in Matlab.
An AmP entry consists of a set of 4 files, 3 Matlab functions (<code>mydata_my_pet.m</code>, <code>predict_my_pet.m</code>, <code>pars_init_my_pet.m</code>) and 
  a Matlab script (<code>run_my_pet.m</code>), where <code>my_pet</code> is replaced by the scientific name of your species with spaces replaced by <code>_</code>.
The mydata-file sets data and references, 
the pars_init-file specifies the model type and initial parameter values, 
the predict-file computes expectations for the data, given parameter values and 
the run-file runs the parameter estimation procedure.
The notation in these files follows the <a href="https://www.bio.vu.nl/thb/research/bib/Kooy2010_n.pdf">DEB notation rules</a>.
The 4 files are now discussed in some more detail:

<h5><A NAME="mydata">mydata</h5>

Copy-and-rename template-file <code>DEBtool_M/lib/pet/mydata_my_pet.m</code> in your current directory, 
  and have a look at mydata-files for related species for editing inspiration.
Temperatures have to be specified in Kelvin, while function <code>C2K</code> converts Celsius to Kelvin.
Since Celsius is more intuitive, all entries use this function.
Bibkeys follow the structure: max 4 characters for the first author, max 4 for the second one (if existing), 4 for the year.

<p>
Consult Wikipedia for taxonomic info, and <a href = "https://www.bio.vu.nl/thb/deb/deblab/add_my_pet/AmPeco.html">AmPeco</a> for available eco-codes.
The fields <code>data_0</code> and <code>data_1</code> refer to the zero- and uni-variate data sets that are specified in the mydata-file.
See the <a href="http://www.debtheory.org/wiki/index.php?title=AmP_estimation_procedure#Data_and_data_types"> DEBwiki manual</a> for allowed codes;
the data sets themselves don't need to have these names, the concepts matter.
E.g., while data-code  <code>ap</code>, for age at puberty, is in the list, our advice is to work, instead, with <code>tp</code> for time since birth at puberty,
to avoid that uncertainty about age at birth (due to uncertainty about the start of development), affects the results too much.
<a href="http://www.debtheory.org/wiki/index.php?title=Completeness"><code>COMPLETE</code></a> quantifies the level of data-completeness.

<p>
The zero-variate data (in sequence of the units) are filled first, then the uni-variate data.
Contrary to the above-mentioned fields, the data-fields can be entry-specific, but all data must have units, label, bibkey and, if time is in the units, also
temp, units.temp, label.temp. 
The comment-field is optional but we stimulate frequent use, e.g. with remarks about accuracy. 
Remove empty fields.

<p>
The weights only need to be changed if more or less emphasis in terms of goodness of fit is desired.
Avoid large numbers (weights multipliers by factor 3 of 5 already have a big effect); 
value zero means that the predictions for that dataset do not contribute to the loss-function, so don't effect parameter estimation.
The weights for the pseudo-data generally do not require editing; 
the default values are chosen such that pseudo-data hardly affects parameter estimation in the case that real data determines parameters well.

<p>
Plots with the same labels and units can be combined into one plot, by assigning datasets to a group and setting a caption.
Please observe that AmP follows the lava-colour scheme from high to low: white, via red and blue, to black.
Female data first, followed male data, whith the consequence that female data is plotted in red, male data in blue.
For data at several temperatures: high temperatures first; the same for food levels.
The presentation of results can (optionally) be customized with function <a href="../lib/pet/html/custom_results_template.html"><code>custom_results_my_pet</code></a>.
A detailed account of the method is presented in the <a href="http://www.debtheory.org/wiki/index.php?title=AmP_estimation_procedure" 
TARGET = "_top">DEBwiki manual</a>.

<p>
Discussion points can have optional references, set by <code>metaData.bibkey.D1 = bibkey;</code>, with bibkey replaced by the correct key.
Discussion points are required if your entry is a modification of an existing one. 
Please explain what is new and why.
Facts must have references.

<p> 
The links to websites, as used in the species-toolbar, depend on the species; 
general websites are allways included (if they have the species), but the rest is taxon-specific (fishes, molluscs, etc). 
See existing entries.

<p>
Acknowledgements are optional; you can here refer e.g. to grant numbers.

<p>
References follow the rules of <a href"http://www.bibtex.org/" target="_blank">BibTex</a>, and this program is actually run to produce the web-presentation.
Make sure that all data has a reference.
If you measured the data yourself, please select type "Mics" and mention this in field "note".
Do something similar for personal communications.
Please notice that the type of bib-entry is not a free choice; a limited number of types are allowed by Bibtex.

<h5><A NAME="predict">predict</h5>

Copy-and-edit a predict-file from a related species.
The <a href="https://www.bio.vu.nl/thb/deb/deblab/add_my_pet/species_list.html">species-list</a> shows the data-types for all entries, 
  which can be used to find predict files of related species that specify additional predictions for your data.
Notice that all assigned variables have a comment that starts with a specification of its units.
Notice also that predictions can depend on the model-type, as specified in the pars_init-file.
The model-type is, however, not a free choice: related species have the same model-type.
Make sure that all data specified in the mydata-file are predicted, but no more.

<p>
The predict-file starts with extracting all parameters, as set in the pars_init-file, and all data, as set in the mydata-file.
Matlab function <a href="../lib/pet/html/parscom_st.html">parscomp_st</a> is run to compute frequently used (simple) functions of the parameters, called compound-parameter, 
  which do not depend on food level.

<p>
Then temperature correction factors, <code>TC</code>, are computed for all data sets.
All parameters are specified at the reference temperature of 20 C, and character <code>T</code> is added to the name of the variable to indicate that it is temperature-corrected. 
This has to be done for all variables that have time in their dimensions.

<p>
The predictions start with a number of scaled times, scaled lengths and scaled rates that concern the full life cycle for later use, followed by required expectations for 
  zero-variate data following the life-cycle, which are outputted to structure <code>prdData</code>.
Notice that the sequence reflect dimensions of variables. 
This is not essential, but convenient for checking.

<p>
The final step is the specification of all required expectations of uni-variate data-sets; 
notice how the first column is used to modify expectations for the second one.
Auxiliary data can be used for a similar purpose.

<p>
Most entries assume data-specific constant temperatures and/or food levels.
Quite a few entries, however, work with time-varying temperatures and/or food levels.
In that case predictions must be based on specifications in terms of ordinary differential equations (ode's), which must be integrated with one of Matlab's ode-solvers.
Entries that integrate ode's can be located with AmPtool function <a href="https://add-my-pet.github.io/AmPtool/html/select_predict.html" target="_blank">select_predict</a>, 
by searching for the string "ode" with code <code>[species, nm] = select_predict('ode')</code>.
Some entries even reconstruct temperature and/or food level trajectories from other data.
Search the data-base for examples, see the <a href="https://add-my-pet.github.io/AmPtool/docs/index.html" target="_blank">AmPtool manual</a> for doing this search efficiently.

<h5><A NAME="pars_init">pars_init</h5>

Copy-and-edit a pars_init-file from a related species.
The specification of the model-type and the reference temperature are then already correct.
Even the parameter values rarely need modification, unless the ultimate body sizes are very different.
The setting of free determines which parameters will be estimated and which are fixed.
The first block of parameters is obligatory for the chosen model type, the second block is ad-hoc for the current entry, and can be extended.

<h5><A NAME="run">run</h5>

Copy-and-edit a run-file from any species.
The run-file starts with setting a global variable for the species that will be estimated and with checking the entry for consistency.

<p>
Depending on <a href="../lib/pet/html/estim_options.html">option settings</a>, results will be printed to screen and/or a .mat file and/or .html file.
This .mat file can be read with 
<a href="../lib/pet/html/printmat.html"><code>printmat('my_pet')</code></a>.

<p>
First make sure that <code>estim_options('results_output', 3);</code> is selected, to save the .mat file and report the result in your browser.
Then out-comment <code>estim_options('method', 'no');</code> by placing <code>%</code> in front of it. 
You start parameter estimation from  the initial setting as specified in <code>pars_init_my_pet</code> with <code>estim_options('pars_init_method', 2);</code> 
using a rather small number of maximum iteration steps (we frequently use 500).
Then continuate estimation with <code>estim_options('pars_init_method', 1);</code>, in which case the initial parameter values are taken from <code>results_my_pet.mat</code>, 
which was created in the previous run.
Then continuate just by repeating the last comment (arrow-up + enter) till convergence, or lack of further progress.
The significance of this sequence is that during the estimation iteration, the simplex shrinks, and a re-start restores the original size.
In this way you reduce (but not eliminate) the probability of arriving at a local minimum of the loss function that is not global. 

<p>
You can reduce or enhance the effect of particular data sets/points by changing weight coefficients in the mydata-file.
If you are satified by the results use <code>mat2pars_init</code> to copy the results from the .mat file into the pars_init-file.
Then activate the line <code>estim_options('method', 'no');</code> again, and select <code>estim_options('results_output', 4);</code> to see the implied properties in your browser, 
or <code>estim_options('results_output', 5);</code> for comparison with related species.
If all seems fine, your entry is ready for submission.

<H4><A NAME="curators">For curators only</H4>

The core code 
<a href="../lib/pet/html/estim_pars.html"><code>estim_pars</code></a> is a macro around regression function 
<a href="../lib/pet/html/petregr_f.html"><code>petregr_f</code></a> 
(with filters or  
<a href="../lib/pet/html/petregr.html"><code>petregr</code></a> without; 
model-specific filters prevent the estimation process to sample outside the allowed parameter space); 
options can be set with 
<a href="../lib/pet/html/estim_options.html"><code>estim_options</code></a>.
Fix or release settings of parameters and chemical parameters are always taken from 
<a href="../lib/pet/html/pars_init_my_pet.html"><code>pars_init_my_pet</code></a>;
the parameters values might be set by 
<a href="../lib/pet/html/get_pars.html"><code>get_pars</code></a> 
if <code>estim_options('pars_init_method', 0)</code> (and parameters are free, not fixed) or are set by <code>results_my_pet.mat</code> if <code>estim_options('pars_init_method', 1)</code>.
The function
<a href="../lib/pet/html/matisinit.html"><code>matisinit</code></a> can be used to check if the values in <code>results_my_pet.mat</code> equal those in <code>pars_init_my_pet</code>.
If so, the <code>.mat</code> file was not produced via <code>estim_pars</code> and method-option 0 was used in combination with output-option 1 or 2. 

<h5><a NAME="filters">filters</a></h5>
This regression function uses filters for the various
<a href="../manual/DEBtool_animal.html">models</a>, such as
<a href="../lib/pet/html/filter_std.html"><code>filter_std</code></a>, 
while warnings are specified by e.g. 
<a href="../lib/pet/html/warning_std.html"><code>warning_std</code></a>.
Filter holds are reported by 
<a href="../lib/pet/html/print_filterflag.html"><code>print_filterflag</code></a> 
in <code>estim_pars</code>.
Customized filters can be build into the predict-file, directly after unpacking of inputs, by conditionally  emptying output <code>Prd_data</code>, setting <code>info = 0</code> and <code>return</code>.

<h5><a NAME="weights">weights/errors</a></h5>
Weight coefficients are set by  <a href="../lib/pet/html/setweights.html"><code>setweights</code></a>. 
Relative errors are computed by <a href="../lib/pet/html/mre_st.html"><code>mre_st</code></a>;
These means are about the absolute values of the relative errrors.

<h5><a NAME="pseudodata">pseudodata</a></h5>
Pseudodata is data for (simple functions of) parameter values, while data and their predictions still might differ.
They are used to avoid unrealistic values for poorly determined parameters.
Pseudodata is added with <a href="../lib/pet/html/addpseudodata.html"><code>addpseudodata</code></a>, 
removed by <a href="../lib/pet/html/rmpseudodata.html"><code>rmpseudodata</code></a> and 
predicted by <a href="../lib/pet/html/predict_pseudodata.html"><code>predict_pseudodata</code></a>.

<h5><a NAME="automized">automized initial estimates</a></h5>
Automized initial parameters estimates are generated with 
<a href="../lib/pet/html/get_pars.html"><code>get_pars</code></a>, which is a macro around
<a href="../manual/DEBtool_animal.html#pars-data"><code>get_pars_2 till 9</code></a>.
Specific density of biomass is set by
<a href="../lib/pet/html/get_d_V.html"><code>get_d_V</code></a>
on the basis of taxonomic relationship.

<h5><a NAME="several">several species</a></h5>
The code allows for parameter estimation of several species simultaneously. 
The function 
<a href="../lib/pet/html/mydata_pets.html"><code>mydata_pets</code></a> catenates <code>mydata</code> files,
<a href="../lib/pet/html/predict_pets.html"><code>predict_pets</code></a> catenates <code>predict</code> files, and 
<a href="../lib/pet/html/results_pets.html"><code>result_pets</code></a> does the same with <code>results</code> files.


<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/methtest.c<|end_filename|>
/***
   NAME
     methtest
   DESCRIPTION
     This file is only processed by the preprocessor to issue a statement which 
     time integration method is being used. Not compiled into the code.
   NOTES
     
   HISTORY
     AMdR - Nov 08, 1998 : Created.
     AMdR - Nov 15, 2014 : Revised last.
***/
#ifndef METHTEST
#define METHTEST
#endif

#include "escbox.h"

#ifndef TIME_METHOD
#define TIME_METHOD	RKCK
#endif /* TIME_METHOD */
#if    (TIME_METHOD ==  RK2)
#error ==> Using RK2 method for time integration of ODEs....
#elif  (TIME_METHOD ==  RK4)
#error ==> Using RK4 method for time integration of ODEs....
#elif  (TIME_METHOD  == RKF45)
#error ==> Using RKF45 method for time integration of ODEs....
#elif  (TIME_METHOD ==  RKCK)
#error ==> Using RKCK method for time integration of ODEs....
#elif  (TIME_METHOD ==  DOPRI5)
#error ==> Using DOPRI5 method for time integration of ODEs....
#elif  (TIME_METHOD ==  DOPRI8)
#error ==> Using DOPRI8 method for time integration of ODEs....
#elif  (TIME_METHOD ==  RADAU5)
#error ==> Using RADAU5 method for time integration of ODEs....
#elif  (TIME_METHOD ==  CVODE)
#error ==> Using CVODE (ADAMS) method for time integration of ODEs....
#elif  (TIME_METHOD ==  CVBDF)
#error ==> Using CVODE (BDF) method for time integration of ODEs....
#else
#error ==> Internal EBT error: TIME_METHOD not specified!
#endif



/*==========================================================================*/


<|start_filename|>popDyn/EBTtool/fns/DefineIDcard.h<|end_filename|>
/* Copyright (c) 1997 by <NAME>. All Rights Reserved                  */

/***
   NAME
     DefineIDcard
   PURPOSE
     A wrapper header file for DefineIDcard.c
   NOTES
     
   HISTORY
     AMdR - Sep 07, 2007
     AvdM - August, 2005 Added export of i_state_dim
***/

#ifndef I_STATE_DIM
#error You have to define I_STATE_DIM at the beginning of the source file!
#endif
#ifndef NEW_CONST_DIM
#error You have to define NEW_CONST_DIM at the beginning of the source file!
#endif

#ifndef DEFINEIDCARD
#define DEFINEIDCARD
#include  "math.h"
#include  "stdio.h"
#include  "stdlib.h"
#include  "float.h"

// AvdM050801:
#include "ebttune.h" //for definition of EXTERN_C

typedef	double		*population;


/*==========================================================================*/
/* 
 * Defining macro's for global use in all files
 */

#if defined(DBL_MAX)				/* Stub value for missing   */
#define MISSING_VALUE		(DBL_MAX)	/* data point	            */
#elif defined(MAXDOUBLE)
#define MISSING_VALUE		(MAXDOUBLE)
#else
#define MISSING_VALUE		(1.23456789e+307)
#endif

#define max(a, b)       (((a) > (b)) ? (a) : (b))
#define min(a, b)       (((a) < (b)) ? (a) : (b))
#define number		(0)
#define i_state(a)	(min((a)+1,I_STATE_DIM))
#define i_const(a)	((a)+I_STATE_DIM+1)

int			*cohort_no;
double			*parameter;


void			DefineIDcard(double *, population *, population *);

EXTERN_C int		DefIDcardWrapper(double *env, population *pop, population *newIDcard,
					 double *pars, int *coh_nr)

{
  if (newIDcard)
    {
      parameter = pars;
      cohort_no = coh_nr;

      DefineIDcard(env, pop, newIDcard);
    }

  return (NEW_CONST_DIM);
}

#ifdef MODULE
EXTERN_C int		iStateDim()
{
  return (I_STATE_DIM);
}
#endif /* MODULE */

#endif /* DEFINEIDCARD */


<|start_filename|>animal/html/mydata_get_pars_m.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_get_pars_m</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="mydata_get_pars_m.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#1">Demonstrates the use og get_pars_m</a></li><li><a href="#2">conversion coefficients (selected copy-paste from pars_animal)</a></li><li><a href="#3">tune parameters</a></li></ul></div><h2>Demonstrates the use og get_pars_m<a name="1"></a></h2><p>get parameters for Balaenoptera musculus get_pars_m is adapted for placentalia data (foetal development)</p><pre class="codeinput"><span class="keyword">global</span> dwm <span class="comment">% pass d_O, w_O, mu_O directly to get_pars_m</span>

<span class="comment">% first initial estimators of the parameter values</span>
<span class="comment">% copy-paste from pars_animal</span>


T    =   273 + 37; <span class="comment">% K, actual body temperature ADAPT THIS FOR B.musculus</span>
T_ref  = 293;      <span class="comment">% K, temp for which rate pars are given</span>
T_A  =  1.6*8000;  <span class="comment">% K, Arrhenius temp ADAT THIS FOR B.musculus</span>
f = 1.0;           <span class="comment">% scaled functional response</span>
z = 128;           <span class="comment">% zoom factor ADAPT THIS FOR B.musculus</span>
del_M =.16/ 4;     <span class="comment">% -, shape coefficient ADAPT THIS FOR B.musculus</span>
F_m = 6.5;         <span class="comment">% l/d.cm^2, {F_m} max spec searching rate</span>
kap_X = 0.8;       <span class="comment">% -, digestion efficiency of food to reserve</span>
v = 0.02;          <span class="comment">% cm/d, energy conductance</span>
kap = 0.8;         <span class="comment">% -, alloaction fraction to soma = growth + somatic maintenance</span>
kap_R = 0.95;      <span class="comment">% -, reproduction efficiency</span>
p_M = 18;          <span class="comment">% J/d.cm^3, [p_M] vol-specific somatic maintenance</span>
p_T =  0;          <span class="comment">% J/d.cm^2, {p_T} surface-specific som maintenance</span>
k_J = 0.002;       <span class="comment">% 1/d, &lt; k_M = p_M/E_G, maturity maint rate coefficient</span>
E_G = 2800;        <span class="comment">% J/cm^3, [E_G], spec cost for structure</span>
E_Hb = 20 * 1e-3 * 275 * z^3; <span class="comment">% J, E_H^b ADAPT THIS FOR B.musculus</span>
E_Hp = 3 * 50 * z^3;  <span class="comment">% J, E_H^p ADAPT THIS FOR B.musculus</span>
h_a = z * 1e-9;    <span class="comment">% 1/d^2, Weibull aging acceleration</span>
s_G = 0.5;         <span class="comment">% -, Gompertz stress coefficient ADAPT THIS FOR B.musculus</span>

<span class="comment">% pack 18 parameters and fix T, T_ref, f, F_m, kap_X, kap_R, p_T, h_a, s_G</span>
pars_Bm = [T 0; T_ref 0; T_A 1; f 0; z 1; del_M 1;
    F_m 0; kap_X 0; v 1; kap 1; kap_R 0; p_M 1; p_T 0; k_J 1; E_G 1; E_Hb 1; E_Hp 1; h_a 1; s_G 0];

<span class="comment">% 10 data for B.musculus</span>
ab = 336;       <span class="comment">%   1 ab    % d, age at birth</span>
ap = 2555;      <span class="comment">%   2 ap    % d, age at puberty</span>
Lb = 700;       <span class="comment">%   3 Lb    % cm, length at birth</span>
Lp = 2050;      <span class="comment">%   4 Lp    % cm, length at puberty</span>
Li = 2700;      <span class="comment">%   5 Li    % cm, ultimate length</span>
Wb = 275000;    <span class="comment">%   6 Wb    % g, weight at birth</span>
Wp = 6900000;   <span class="comment">%   7 Wp    % g, weight at puberty</span>
Wi = 16000000;  <span class="comment">%   8 Wi    % g, ultimate weight</span>
rB = 5.9178e-4; <span class="comment">%   9 rB    % 1/d, von Bertalanffy growth rate</span>
Ri = .0011;     <span class="comment">%  10 Ri    % #/d, maximum reproduction rate</span>
tm = 29200;     <span class="comment">%  11 tm    % d, life span</span>

<span class="comment">% pack data for B.musculus</span>
<span class="comment">%  append parameters for generalised animal as data</span>
<span class="comment">%   to make sure that those of B.musculus are near, except for z</span>
data_Bm = [ab; ap; Lb; Lp; Li; Wb; Wp; Wi; rB; Ri; tm; pars_Bm(:,1)];
<span class="comment">% nmregr wants to have 3 columns: indpendent var, dependent var, weight coeff</span>
<span class="comment">%   prepend independent variable (not used) and append weight coefficients</span>
<span class="comment">%   weight coeff inverse to squared data</span>
Data_Bm = [zeros(30,1), data_Bm, 1 ./ max(1e-6, data_Bm) .^ 2];
Data_Bm(1:11,3) = 10 * Data_Bm(1:11,3); <span class="comment">% give Bm data more weight</span>
Data_Bm(11,3) = 0; <span class="comment">% no weight to a_m; small value gives numerical problems</span>
<span class="comment">% we should turn to years, rather than days as unit of time to solve this problem</span>
Data_Bm(26,3) = 20 * Data_Bm(26,3); <span class="comment">% more weight to E_G</span>
Data_Bm([14 20],3) = 10 * Data_Bm([14 20],3); <span class="comment">% more weight to v, T_A</span>
Data_Bm([12 13 16 27 28],3) = 0; <span class="comment">% set weight for T, T_ref, z, E_Hb, E_Hp to zero</span>
</pre><h2>conversion coefficients (selected copy-paste from pars_animal)<a name="2"></a></h2><pre class="codeinput">n_O = [1.00, 1.00, 1.00, 1.00;  <span class="comment">% C/C, equals 1 by definition</span>
       1.80, 1.80, 2.00, 1.80;  <span class="comment">% H/C</span>
       0.50, 0.50, 0.75, 0.50;  <span class="comment">% O/C</span>
       0.20, 0.15, 0.20, 0.15]; <span class="comment">% N/C</span>

d_O = [.1; .1; .1; .1];     <span class="comment">% g/cm^3, specific densities for organics</span>
mu_X = 525000;                    <span class="comment">% J/mol, chemical potential of food</span>
mu_V = 500000;                    <span class="comment">% J/mol, chemical potential of structure</span>
mu_E = 550000;                    <span class="comment">% J/mol, chemical potential of reserve</span>
mu_P = 480000;                    <span class="comment">% J/mol, chemical potential of faeces</span>
mu_O = [mu_X; mu_V; mu_E; mu_P];  <span class="comment">% J/mol, chemical potentials of organics</span>
w_O = n_O' * [12; 1; 16; 14];     <span class="comment">% g/mol, mol-weights for org. compounds</span>
dwm = [d_O, w_O, mu_O]; <span class="comment">% g/cm^3, g/mol, kJ/mol spec density, mol weight, chem pot</span>
</pre><h2>tune parameters<a name="3"></a></h2><pre class="codeinput">nmregr_options(<span class="string">'max_step_number'</span>,2e4)
nmregr_options(<span class="string">'max_fun_evals'</span>,2e4)
pars_Bm = nmregr(<span class="string">'get_pars_m'</span>, pars_Bm, Data_Bm);
Edata_Bm = get_pars_m(pars_Bm(:,1), Data_Bm);
format <span class="string">short</span> <span class="string">eng</span>

txt_Bm = {<span class="keyword">...</span>
    <span class="string">'1 ab, d, age at birth '</span>;
    <span class="string">'2 ap, d, age at puberty '</span>;
    <span class="string">'3 Lb, cm, length at birth '</span>;
    <span class="string">'4 Lp, cm, length at puberty '</span>;
    <span class="string">'5 Li, cm, ultimate length '</span>;
    <span class="string">'6 Wb, g, weight at birth '</span>;
    <span class="string">'7 Wp, g, weight at puberty '</span>;
    <span class="string">'8 Wi, g, ultimate weight '</span>;
    <span class="string">'9 rB, 1/d, von Bert growth rate '</span>;
   <span class="string">'10 Ri, #/d, maximum reprod rate '</span>;
   <span class="string">'11 am, d, life span '</span>;
   <span class="string">'12 T,  K, actual body temp '</span>;
   <span class="string">'13 T_ref, K, reference temp '</span>;
   <span class="string">'14 T_A,   K, Arrhenius temp '</span>;
   <span class="string">'15 f, scaled functional response '</span>;
   <span class="string">'16 z, zoom factor '</span>;
   <span class="string">'17 del_M,  -, shape coefficient '</span>;
   <span class="string">'18 F_m, l/d.cm^2, {F_m} max spec search r '</span>;
   <span class="string">'19 kap_X, -, digestion efficiency '</span>;
   <span class="string">'20 v, cm/d, energy conductance '</span>;
   <span class="string">'21 kap, -, allocation fraction to soma '</span>;
   <span class="string">'22 kap_R, -, reproduction efficiency '</span>;
   <span class="string">'23 [p_M], J/d.cm^3, vol-spec som maint '</span>;
   <span class="string">'24 {p_T}, J/d.cm^2, sur-spec som maint '</span>;
   <span class="string">'25 k_J, 1/d, maturity maint rate coefficient '</span>;
   <span class="string">'26 [E_G], J/cm^3, spec cost for structure'</span>;
   <span class="string">'27 E_H^b, J, maturity investm at birth '</span>;
   <span class="string">'28 E_H^p, J, maturity investm at puberty '</span>;
   <span class="string">'29 h_a, 1/d^2, Weibull aging acceleration '</span>;
   <span class="string">'30 s_G, -, Gompertz stress coefficient'</span>};

printpar(txt_Bm, data_Bm, Edata_Bm)
</pre><pre class="codeoutput">step 1 ssq 19832.7208-70530.1385 initial
step 2 ssq 19832.7208-69531.1671 reflect
step 3 ssq 19832.7208-60585.1098 reflect
step 4 ssq 19832.7208-59693.2873 reflect
step 5 ssq 19832.7208-56052.6409 reflect
step 6 ssq 19832.7208-55388.4219 reflect
step 7 ssq 19832.7208-55388.1524 reflect
step 8 ssq 19832.7208-55388.1523 reflect
step 9 ssq 19832.7208-54994.9174 reflect
step 10 ssq 10868.8355-51760.6819 expand
step 11 ssq 10868.8355-50386.9108 reflect
step 12 ssq 10868.8355-38346.788 reflect
step 13 ssq 10868.8355-35780.1831 reflect
step 14 ssq 10868.8355-34195.1696 reflect
step 15 ssq 4906.7927-33075.7304 expand
step 16 ssq 4906.7927-32101.3853 reflect
step 17 ssq 4906.7927-29323.3307 reflect
step 18 ssq 1619.7017-26007.7739 expand
step 19 ssq 1619.7017-22527.9281 reflect
step 20 ssq 1619.7017-19832.7208 reflect
step 21 ssq 1619.7017-15224.695 reflect
step 22 ssq 1619.7017-13198.9318 reflect
step 23 ssq 1619.7017-12279.2741 reflect
step 24 ssq 960.7437-11964.2349 expand
step 25 ssq 960.7437-10868.8355 reflect
step 26 ssq 960.7437-7325.8237 reflect
step 27 ssq 960.7437-5717.6755 reflect
step 28 ssq 960.7437-4906.7927 reflect
step 29 ssq 960.7437-3030.9849 reflect
step 30 ssq 960.7437-2385.7102 contract outside
step 31 ssq 960.7437-2280.7987 contract inside
step 32 ssq 960.7437-1935.7249 contract inside
step 33 ssq 960.7437-1786.9552 contract inside
step 34 ssq 960.7437-1728.7953 contract inside
step 35 ssq 960.7437-1619.7017 reflect
step 36 ssq 960.7437-1532.9554 contract inside
step 37 ssq 960.7437-1507.5445 reflect
step 38 ssq 960.7437-1488.0132 contract inside
step 39 ssq 960.7437-1324.2698 reflect
step 40 ssq 960.7437-1310.7462 reflect
step 41 ssq 960.7437-1273.6657 reflect
step 42 ssq 960.7437-1270.8454 reflect
step 43 ssq 960.7437-1265.6653 reflect
step 44 ssq 960.7437-1195.7749 contract inside
step 45 ssq 960.7437-1160.9141 reflect
step 46 ssq 754.8374-1156.7588 expand
step 47 ssq 735.1606-1154.9123 reflect
step 48 ssq 735.1606-1145.354 reflect
step 49 ssq 735.1606-1104.0152 reflect
step 50 ssq 735.1606-1100.534 reflect
step 51 ssq 735.1606-1079.6675 reflect
step 52 ssq 735.1606-1063.2657 reflect
step 53 ssq 544.7663-1019.0665 expand
step 54 ssq 544.7663-992.4342 reflect
step 55 ssq 429.8465-990.8702 expand
step 56 ssq 429.8465-970.752 reflect
step 57 ssq 429.8465-967.2636 reflect
step 58 ssq 429.8465-966.0104 reflect
step 59 ssq 429.8465-960.7437 contract inside
step 60 ssq 307.8245-833.3238 expand
step 61 ssq 307.8245-790.2657 reflect
step 62 ssq 307.8245-775.2503 reflect
step 63 ssq 307.8245-768.6301 reflect
step 64 ssq 307.8245-754.8374 contract inside
step 65 ssq 307.8245-735.1606 reflect
step 66 ssq 220.8724-680.9665 expand
step 67 ssq 220.8724-663.6318 reflect
step 68 ssq 81.4874-634.7515 expand
step 69 ssq 81.4874-610.6317 reflect
step 70 ssq 81.4874-544.7663 reflect
step 71 ssq 81.4874-509.617 reflect
step 72 ssq 81.4874-493.3338 reflect
step 73 ssq 81.4874-429.8465 reflect
step 74 ssq 81.4874-424.8822 reflect
step 75 ssq 81.4874-399.9102 reflect
step 76 ssq 61.6187-351.4604 reflect
step 77 ssq 61.6187-344.4447 reflect
step 78 ssq 61.6187-341.9056 reflect
step 79 ssq 61.6187-307.8245 reflect
step 80 ssq 53.8558-230.3616 reflect
step 81 ssq 49.9573-220.8724 reflect
step 82 ssq 49.9573-187.8379 reflect
step 83 ssq 49.9573-153.0229 contract inside
step 84 ssq 49.9573-152.9383 contract inside
step 85 ssq 49.9573-144.091 reflect
step 86 ssq 37.0823-102.8826 reflect
step 87 ssq 37.0823-99.5666 reflect
step 88 ssq 37.0823-98.7194 reflect
step 89 ssq 37.0823-97.4034 reflect
step 90 ssq 37.0823-81.8278 reflect
step 91 ssq 33.1624-81.4874 reflect
step 92 ssq 33.1624-76.949 reflect
step 93 ssq 33.1624-75.8488 contract inside
step 94 ssq 33.1624-71.4989 reflect
step 95 ssq 33.1624-67.4521 reflect
step 96 ssq 33.1624-62.5812 reflect
step 97 ssq 33.1624-61.6187 reflect
step 98 ssq 33.1624-60.9345 contract inside
step 99 ssq 33.1624-53.9562 contract inside
step 100 ssq 33.1624-53.8558 contract inside
step 101 ssq 33.1624-49.9573 contract inside
step 102 ssq 33.1624-48.1005 reflect
step 103 ssq 33.1624-44.0305 contract inside
step 104 ssq 33.1624-43.6519 contract inside
step 105 ssq 33.1624-42.9924 reflect
step 106 ssq 30.5073-42.2412 reflect
step 107 ssq 30.5073-41.2477 contract inside
step 108 ssq 30.5073-37.5458 contract inside
step 109 ssq 30.5073-37.4584 reflect
step 110 ssq 30.5073-37.1411 reflect
step 111 ssq 30.5073-37.0823 reflect
step 112 ssq 30.5073-36.8365 contract inside
step 113 ssq 30.5073-36.5355 contract inside
step 114 ssq 28.7656-35.4128 reflect
step 115 ssq 28.7656-34.9575 reflect
step 116 ssq 28.7656-34.0349 reflect
step 117 ssq 28.7656-33.5607 contract inside
step 118 ssq 28.7656-33.4582 contract inside
step 119 ssq 28.7656-33.173 reflect
step 120 ssq 28.7656-33.1624 contract inside
step 121 ssq 28.7656-32.5508 reflect
step 122 ssq 28.3857-32.2057 reflect
step 123 ssq 28.3857-31.8171 contract inside
step 124 ssq 28.3857-31.0645 reflect
step 125 ssq 28.3857-30.806 reflect
step 126 ssq 28.3857-30.5073 reflect
step 127 ssq 27.2411-30.4526 reflect
step 128 ssq 27.2411-30.4006 contract inside
step 129 ssq 27.2411-30.1994 contract inside
step 130 ssq 27.2411-29.9016 reflect
step 131 ssq 27.2411-29.89 contract inside
step 132 ssq 27.2411-29.5584 reflect
step 133 ssq 27.2411-29.5051 reflect
step 134 ssq 26.6253-29.1019 reflect
step 135 ssq 26.3112-29.0866 reflect
step 136 ssq 25.9547-28.9688 reflect
step 137 ssq 25.9547-28.7656 reflect
step 138 ssq 25.9547-28.649 reflect
step 139 ssq 25.9547-28.3857 reflect
step 140 ssq 25.9547-28.2354 reflect
step 141 ssq 25.9547-28.1642 contract inside
step 142 ssq 25.9547-28.1572 contract inside
step 143 ssq 25.7892-28.0675 reflect
step 144 ssq 25.3763-27.9417 reflect
step 145 ssq 25.3763-27.8445 reflect
step 146 ssq 25.3763-27.6356 reflect
step 147 ssq 25.3763-27.2889 contract inside
step 148 ssq 25.3763-27.2411 reflect
step 149 ssq 24.6492-26.9611 expand
step 150 ssq 24.6492-26.9528 contract inside
step 151 ssq 24.5756-26.7046 reflect
step 152 ssq 24.3159-26.6253 reflect
step 153 ssq 23.8741-26.3112 expand
step 154 ssq 23.8741-26.2152 reflect
step 155 ssq 23.8741-26.1175 reflect
step 156 ssq 22.5964-25.9547 expand
step 157 ssq 22.5964-25.8435 reflect
step 158 ssq 22.5964-25.7892 reflect
step 159 ssq 22.5368-25.6425 reflect
step 160 ssq 22.4219-25.3763 reflect
step 161 ssq 21.9817-25.0996 reflect
step 162 ssq 21.725-24.6492 reflect
step 163 ssq 21.725-24.5756 reflect
step 164 ssq 21.725-24.5272 reflect
step 165 ssq 20.4908-24.3159 expand
step 166 ssq 18.639-23.8741 expand
step 167 ssq 18.639-23.7741 reflect
step 168 ssq 18.639-23.4238 reflect
step 169 ssq 18.639-22.9831 contract outside
step 170 ssq 18.639-22.6869 reflect
step 171 ssq 18.639-22.5964 contract outside
step 172 ssq 18.639-22.5368 reflect
step 173 ssq 18.639-22.4219 reflect
step 174 ssq 18.639-21.9817 reflect
step 175 ssq 18.639-21.725 reflect
step 176 ssq 18.639-21.2114 reflect
step 177 ssq 18.4332-20.8813 reflect
step 178 ssq 18.4332-20.8105 reflect
step 179 ssq 18.205-20.4908 reflect
step 180 ssq 18.205-20.4252 reflect
step 181 ssq 18.205-20.3672 contract inside
step 182 ssq 18.205-20.2557 contract outside
step 183 ssq 18.205-20.1958 contract inside
step 184 ssq 18.205-20.0551 reflect
step 185 ssq 18.205-19.7197 reflect
step 186 ssq 18.1139-19.5196 reflect
step 187 ssq 18.1139-19.2617 reflect
step 188 ssq 18.1139-19.19 reflect
step 189 ssq 18.1139-19.1631 reflect
step 190 ssq 18.1139-19.1359 reflect
step 191 ssq 18.1139-19.0345 reflect
step 192 ssq 18.1139-19.0004 reflect
step 193 ssq 18.1139-18.9553 reflect
step 194 ssq 18.1139-18.8852 contract inside
step 195 ssq 18.1139-18.7216 reflect
step 196 ssq 18.1139-18.6432 contract inside
step 197 ssq 18.1139-18.639 contract inside
step 198 ssq 18.1139-18.5546 reflect
step 199 ssq 18.1139-18.5458 reflect
step 200 ssq 18.1139-18.5073 contract inside
step 201 ssq 18.1139-18.4349 reflect
step 202 ssq 17.9415-18.4332 reflect
step 203 ssq 17.9415-18.4327 reflect
step 204 ssq 17.9415-18.3487 reflect
step 205 ssq 17.9415-18.33 reflect
step 206 ssq 17.9415-18.2336 contract outside
step 207 ssq 17.9415-18.2323 reflect
step 208 ssq 17.9415-18.2186 reflect
step 209 ssq 17.9415-18.2127 contract inside
step 210 ssq 17.9415-18.205 contract inside
step 211 ssq 17.9415-18.2044 reflect
step 212 ssq 17.8571-18.1819 reflect
step 213 ssq 17.8571-18.1651 contract inside
step 214 ssq 17.7882-18.1358 reflect
step 215 ssq 17.7882-18.1139 contract inside
step 216 ssq 17.7882-18.1138 reflect
step 217 ssq 17.7882-18.0592 contract inside
step 218 ssq 17.7882-18.046 contract outside
step 219 ssq 17.7882-18.0427 reflect
step 220 ssq 17.7882-18.014 contract inside
step 221 ssq 17.7034-17.997 expand
step 222 ssq 17.7034-17.9734 reflect
step 223 ssq 17.6614-17.9465 expand
step 224 ssq 17.4555-17.9415 expand
step 225 ssq 17.4555-17.9249 reflect
step 226 ssq 17.4555-17.9065 reflect
step 227 ssq 17.4555-17.9011 reflect
step 228 ssq 17.4555-17.8836 reflect
step 229 ssq 17.3867-17.8571 expand
step 230 ssq 17.3757-17.8195 reflect
step 231 ssq 17.3757-17.7982 reflect
step 232 ssq 17.3757-17.7882 reflect
step 233 ssq 16.8964-17.7034 expand
step 234 ssq 16.8964-17.6919 reflect
step 235 ssq 16.8964-17.6614 reflect
step 236 ssq 16.8964-17.5333 reflect
step 237 ssq 16.8964-17.4915 reflect
step 238 ssq 16.8964-17.4871 reflect
step 239 ssq 16.8964-17.4769 reflect
step 240 ssq 16.8964-17.4555 reflect
step 241 ssq 16.8964-17.4119 reflect
step 242 ssq 16.8964-17.3867 reflect
step 243 ssq 16.53-17.3757 expand
step 244 ssq 16.53-17.1665 reflect
step 245 ssq 16.53-17.1358 reflect
step 246 ssq 16.53-17.0717 reflect
step 247 ssq 16.1347-16.9778 expand
step 248 ssq 16.1347-16.9594 reflect
step 249 ssq 16.1347-16.9431 reflect
step 250 ssq 16.1347-16.917 reflect
step 251 ssq 16.1347-16.9141 reflect
step 252 ssq 16.0403-16.9084 expand
step 253 ssq 15.9991-16.8964 reflect
step 254 ssq 15.3609-16.6437 expand
step 255 ssq 15.3609-16.6398 reflect
step 256 ssq 15.3609-16.5679 reflect
step 257 ssq 15.3609-16.533 reflect
step 258 ssq 15.3609-16.53 reflect
step 259 ssq 15.1166-16.435 expand
step 260 ssq 15.1166-16.2347 reflect
step 261 ssq 15.1166-16.1494 reflect
step 262 ssq 15.1166-16.1369 reflect
step 263 ssq 15.1166-16.1347 reflect
step 264 ssq 15.1166-16.0403 reflect
step 265 ssq 15.1166-15.9991 reflect
step 266 ssq 15.1166-15.9394 reflect
step 267 ssq 14.9321-15.8417 reflect
step 268 ssq 14.9321-15.7986 reflect
step 269 ssq 14.9321-15.6498 reflect
step 270 ssq 14.8704-15.5098 reflect
step 271 ssq 14.8704-15.4037 reflect
step 272 ssq 14.8704-15.3913 reflect
step 273 ssq 14.7121-15.3779 reflect
step 274 ssq 14.7121-15.3725 contract inside
step 275 ssq 14.7121-15.3609 contract inside
step 276 ssq 14.7121-15.2688 reflect
step 277 ssq 14.639-15.2089 reflect
step 278 ssq 14.639-15.1967 reflect
step 279 ssq 14.639-15.1166 contract inside
step 280 ssq 14.639-15.0058 reflect
step 281 ssq 14.639-14.9794 reflect
step 282 ssq 14.639-14.9793 reflect
step 283 ssq 14.639-14.9499 reflect
step 284 ssq 14.639-14.9321 reflect
step 285 ssq 14.639-14.9167 reflect
step 286 ssq 14.639-14.8704 reflect
step 287 ssq 14.639-14.8697 reflect
step 288 ssq 14.639-14.849 reflect
step 289 ssq 14.5543-14.7974 reflect
step 290 ssq 14.5543-14.7841 reflect
step 291 ssq 14.5543-14.7596 contract outside
step 292 ssq 14.5543-14.7489 contract inside
step 293 ssq 14.5543-14.7439 reflect
step 294 ssq 14.5543-14.7429 reflect
step 295 ssq 14.5543-14.7252 contract outside
step 296 ssq 14.5543-14.7183 reflect
step 297 ssq 14.5543-14.7121 reflect
step 298 ssq 14.5543-14.709 reflect
step 299 ssq 14.5543-14.6844 contract inside
step 300 ssq 14.5543-14.666 contract inside
step 301 ssq 14.5445-14.642 reflect
step 302 ssq 14.5445-14.639 reflect
step 303 ssq 14.5223-14.6242 reflect
step 304 ssq 14.5223-14.6069 contract inside
step 305 ssq 14.5217-14.5919 reflect
step 306 ssq 14.5076-14.5823 contract inside
step 307 ssq 14.5002-14.5821 contract inside
step 308 ssq 14.5002-14.5808 reflect
step 309 ssq 14.5002-14.5801 contract inside
step 310 ssq 14.5002-14.5615 reflect
step 311 ssq 14.4632-14.558 reflect
step 312 ssq 14.4632-14.5543 reflect
step 313 ssq 14.4632-14.5445 contract outside
step 314 ssq 14.4632-14.5345 contract outside
step 315 ssq 14.4632-14.5334 reflect
step 316 ssq 14.4632-14.5283 reflect
step 317 ssq 14.4632-14.5268 reflect
step 318 ssq 14.4632-14.5223 contract inside
step 319 ssq 14.4609-14.5217 reflect
step 320 ssq 14.4609-14.518 contract inside
step 321 ssq 14.4609-14.5076 contract inside
step 322 ssq 14.4601-14.505 reflect
step 323 ssq 14.438-14.5038 reflect
step 324 ssq 14.438-14.5002 contract inside
step 325 ssq 14.438-14.4903 reflect
step 326 ssq 14.438-14.4878 reflect
step 327 ssq 14.4323-14.4787 reflect
step 328 ssq 14.4012-14.4745 expand
step 329 ssq 14.4012-14.4703 reflect
step 330 ssq 14.4012-14.4677 reflect
step 331 ssq 14.4012-14.4667 reflect
step 332 ssq 14.4012-14.4654 reflect
step 333 ssq 14.4012-14.4632 reflect
step 334 ssq 14.3943-14.4609 reflect
step 335 ssq 14.3943-14.4601 reflect
step 336 ssq 14.3656-14.4537 expand
step 337 ssq 14.3656-14.4531 reflect
step 338 ssq 14.3656-14.4514 reflect
step 339 ssq 14.3656-14.4393 reflect
step 340 ssq 14.3656-14.438 reflect
step 341 ssq 14.3137-14.4348 expand
step 342 ssq 14.3137-14.4336 reflect
step 343 ssq 14.3137-14.4323 reflect
step 344 ssq 14.2712-14.4161 expand
step 345 ssq 14.2712-14.4138 reflect
step 346 ssq 14.2712-14.4115 reflect
step 347 ssq 14.2712-14.4012 reflect
step 348 ssq 14.2569-14.3972 expand
step 349 ssq 14.2569-14.3943 reflect
step 350 ssq 14.1456-14.3691 expand
step 351 ssq 14.1456-14.3666 reflect
step 352 ssq 14.1456-14.3656 reflect
step 353 ssq 14.1456-14.3622 reflect
step 354 ssq 14.1456-14.33 reflect
step 355 ssq 14.1456-14.3285 reflect
step 356 ssq 14.1456-14.3207 reflect
step 357 ssq 14.0767-14.3137 expand
step 358 ssq 14.0767-14.2877 reflect
step 359 ssq 14.0767-14.2712 reflect
step 360 ssq 14.0632-14.2569 expand
step 361 ssq 14.0632-14.2546 reflect
step 362 ssq 14.0264-14.2286 reflect
step 363 ssq 14.0264-14.2191 reflect
step 364 ssq 13.9962-14.2053 expand
step 365 ssq 13.9467-14.2021 expand
step 366 ssq 13.9467-14.1934 reflect
step 367 ssq 13.8029-14.1489 expand
step 368 ssq 13.8029-14.1456 reflect
step 369 ssq 13.8029-14.1159 reflect
step 370 ssq 13.8029-14.1001 reflect
step 371 ssq 13.8029-14.0792 contract outside
step 372 ssq 13.8029-14.0778 reflect
step 373 ssq 13.8029-14.0767 reflect
step 374 ssq 13.8029-14.0632 reflect
step 375 ssq 13.8029-14.0264 reflect
step 376 ssq 13.8029-14.0121 contract inside
step 377 ssq 13.8029-13.9962 reflect
step 378 ssq 13.8029-13.9717 reflect
step 379 ssq 13.7777-13.9605 reflect
step 380 ssq 13.7777-13.9552 reflect
step 381 ssq 13.7342-13.9471 expand
step 382 ssq 13.7059-13.9467 reflect
step 383 ssq 13.6227-13.905 expand
step 384 ssq 13.6227-13.9049 reflect
step 385 ssq 13.6227-13.8828 reflect
step 386 ssq 13.6227-13.8348 reflect
step 387 ssq 13.6227-13.8248 reflect
step 388 ssq 13.58-13.817 expand
step 389 ssq 13.58-13.8167 reflect
step 390 ssq 13.58-13.8088 reflect
step 391 ssq 13.58-13.8029 reflect
step 392 ssq 13.5513-13.7777 reflect
step 393 ssq 13.5368-13.7416 reflect
step 394 ssq 13.5368-13.7342 reflect
step 395 ssq 13.5368-13.7231 reflect
step 396 ssq 13.5368-13.7059 reflect
step 397 ssq 13.5368-13.6944 reflect
step 398 ssq 13.5368-13.6937 reflect
step 399 ssq 13.5368-13.6687 reflect
step 400 ssq 13.5368-13.6389 reflect
step 401 ssq 13.5368-13.631 reflect
step 402 ssq 13.5368-13.6298 contract inside
step 403 ssq 13.5368-13.6227 reflect
step 404 ssq 13.5264-13.6225 reflect
step 405 ssq 13.5264-13.6193 reflect
step 406 ssq 13.5264-13.614 reflect
step 407 ssq 13.524-13.5884 contract outside
step 408 ssq 13.5194-13.5863 contract inside
step 409 ssq 13.5187-13.58 contract inside
step 410 ssq 13.5187-13.5797 contract inside
step 411 ssq 13.5187-13.5708 contract inside
step 412 ssq 13.5125-13.5532 contract inside
step 413 ssq 13.5087-13.5513 contract inside
step 414 ssq 13.4747-13.5513 reflect
step 415 ssq 13.4747-13.5399 contract inside
step 416 ssq 13.4747-13.5368 reflect
step 417 ssq 13.4747-13.5335 contract inside
step 418 ssq 13.4747-13.5264 contract inside
step 419 ssq 13.4747-13.524 contract inside
step 420 ssq 13.4747-13.5194 reflect
step 421 ssq 13.4747-13.5191 reflect
step 422 ssq 13.4747-13.5188 reflect
step 423 ssq 13.4747-13.5187 reflect
step 424 ssq 13.4747-13.5157 reflect
step 425 ssq 13.4747-13.5125 reflect
step 426 ssq 13.4747-13.5119 reflect
step 427 ssq 13.4747-13.5112 contract inside
step 428 ssq 13.4747-13.5087 contract inside
step 429 ssq 13.4747-13.5069 reflect
step 430 ssq 13.4747-13.5063 contract inside
step 431 ssq 13.472-13.5042 expand
step 432 ssq 13.472-13.5026 reflect
step 433 ssq 13.472-13.502 reflect
step 434 ssq 13.472-13.5018 reflect
step 435 ssq 13.472-13.5013 reflect
step 436 ssq 13.472-13.5 reflect
step 437 ssq 13.472-13.4933 reflect
step 438 ssq 13.4515-13.4929 expand
step 439 ssq 13.4501-13.4929 expand
step 440 ssq 13.4444-13.4927 reflect
step 441 ssq 13.4444-13.4907 reflect
step 442 ssq 13.4352-13.4825 reflect
step 443 ssq 13.4329-13.4797 reflect
step 444 ssq 13.4329-13.4773 reflect
step 445 ssq 13.4329-13.4765 reflect
step 446 ssq 13.43-13.4747 reflect
step 447 ssq 13.4277-13.4742 reflect
step 448 ssq 13.3981-13.472 expand
step 449 ssq 13.3981-13.4658 reflect
step 450 ssq 13.3981-13.4515 reflect
step 451 ssq 13.3981-13.4501 reflect
step 452 ssq 13.3879-13.4461 expand
step 453 ssq 13.3879-13.4455 reflect
step 454 ssq 13.3879-13.4444 reflect
step 455 ssq 13.3338-13.4412 expand
step 456 ssq 13.3338-13.4352 reflect
step 457 ssq 13.3338-13.4329 reflect
step 458 ssq 13.3338-13.43 reflect
step 459 ssq 13.3338-13.4277 reflect
step 460 ssq 13.3047-13.424 expand
step 461 ssq 13.3047-13.415 reflect
step 462 ssq 13.3047-13.4066 reflect
step 463 ssq 13.3047-13.3983 reflect
step 464 ssq 13.3047-13.3981 reflect
step 465 ssq 13.2553-13.3884 expand
step 466 ssq 13.2024-13.3879 expand
step 467 ssq 13.2024-13.3523 reflect
step 468 ssq 13.2024-13.3446 reflect
step 469 ssq 13.2024-13.3403 reflect
step 470 ssq 13.2024-13.3338 reflect
step 471 ssq 13.2024-13.3281 reflect
step 472 ssq 13.1859-13.3222 expand
step 473 ssq 13.1092-13.3217 expand
step 474 ssq 13.1092-13.306 reflect
step 475 ssq 13.1092-13.3047 reflect
step 476 ssq 13.018-13.2808 expand
step 477 ssq 13.018-13.2699 reflect
step 478 ssq 13.018-13.2557 reflect
step 479 ssq 13.018-13.2553 reflect
step 480 ssq 13.018-13.2506 reflect
step 481 ssq 12.9597-13.2482 expand
step 482 ssq 12.9597-13.2202 reflect
step 483 ssq 12.9597-13.2133 reflect
step 484 ssq 12.9597-13.2024 reflect
step 485 ssq 12.9597-13.1986 reflect
step 486 ssq 12.9597-13.1859 reflect
step 487 ssq 12.9597-13.1729 reflect
step 488 ssq 12.9086-13.1386 reflect
step 489 ssq 12.9086-13.1337 reflect
step 490 ssq 12.9086-13.1125 reflect
step 491 ssq 12.9056-13.1092 reflect
step 492 ssq 12.8878-13.0693 reflect
step 493 ssq 12.8878-13.0525 reflect
step 494 ssq 12.8878-13.018 reflect
step 495 ssq 12.8604-13.0055 reflect
step 496 ssq 12.8604-12.9968 reflect
step 497 ssq 12.8604-12.9873 contract inside
step 498 ssq 12.8604-12.9832 reflect
step 499 ssq 12.8604-12.9623 reflect
step 500 ssq 12.8604-12.9617 reflect
step 501 ssq 12.8252-12.9597 reflect
step 502 ssq 12.8252-12.9354 reflect
step 503 ssq 12.8252-12.9237 reflect
step 504 ssq 12.8252-12.9132 reflect
step 505 ssq 12.8252-12.912 reflect
step 506 ssq 12.8226-12.9086 reflect
step 507 ssq 12.7862-12.9056 reflect
step 508 ssq 12.7862-12.9023 reflect
step 509 ssq 12.7862-12.8919 contract inside
step 510 ssq 12.7862-12.8878 contract inside
step 511 ssq 12.7862-12.8728 reflect
step 512 ssq 12.7862-12.868 contract inside
step 513 ssq 12.7862-12.8644 contract inside
step 514 ssq 12.7862-12.8617 reflect
step 515 ssq 12.7862-12.8614 contract outside
step 516 ssq 12.7862-12.8604 reflect
step 517 ssq 12.7862-12.8599 contract inside
step 518 ssq 12.7862-12.8293 contract outside
step 519 ssq 12.7862-12.8256 reflect
step 520 ssq 12.7862-12.8252 reflect
step 521 ssq 12.7862-12.8245 reflect
step 522 ssq 12.7862-12.8239 reflect
step 523 ssq 12.7862-12.8226 contract inside
step 524 ssq 12.7862-12.8216 reflect
step 525 ssq 12.7862-12.8201 reflect
step 526 ssq 12.7862-12.8169 reflect
step 527 ssq 12.7862-12.8164 reflect
step 528 ssq 12.7862-12.8163 reflect
step 529 ssq 12.7862-12.8155 reflect
step 530 ssq 12.7862-12.8143 reflect
step 531 ssq 12.7862-12.81 reflect
step 532 ssq 12.7862-12.8074 reflect
step 533 ssq 12.7862-12.8052 contract inside
step 534 ssq 12.7862-12.8045 reflect
step 535 ssq 12.7862-12.8043 reflect
step 536 ssq 12.7862-12.8023 reflect
step 537 ssq 12.7862-12.8019 reflect
step 538 ssq 12.7862-12.8009 contract inside
step 539 ssq 12.7862-12.8005 contract inside
step 540 ssq 12.7862-12.8005 reflect
step 541 ssq 12.7862-12.7998 contract inside
step 542 ssq 12.7862-12.7993 reflect
step 543 ssq 12.7835-12.7988 contract inside
step 544 ssq 12.7835-12.7966 reflect
step 545 ssq 12.7835-12.7964 contract inside
step 546 ssq 12.7835-12.7957 reflect
step 547 ssq 12.7835-12.7944 contract inside
step 548 ssq 12.7835-12.7936 contract inside
step 549 ssq 12.7835-12.7909 contract inside
step 550 ssq 12.7835-12.7902 contract inside
step 551 ssq 12.7793-12.7881 reflect
step 552 ssq 12.7793-12.7879 reflect
step 553 ssq 12.7793-12.7873 reflect
step 554 ssq 12.7772-12.7862 reflect
step 555 ssq 12.7772-12.7858 contract inside
step 556 ssq 12.7772-12.7855 contract inside
step 557 ssq 12.7772-12.7855 reflect
step 558 ssq 12.7772-12.7854 contract inside
step 559 ssq 12.7772-12.7853 reflect
step 560 ssq 12.7759-12.7851 reflect
step 561 ssq 12.7759-12.7849 reflect
step 562 ssq 12.7759-12.7835 reflect
step 563 ssq 12.7759-12.7826 reflect
step 564 ssq 12.7759-12.7814 reflect
step 565 ssq 12.7738-12.7813 reflect
step 566 ssq 12.7725-12.7811 expand
step 567 ssq 12.766-12.7805 expand
step 568 ssq 12.766-12.7803 contract inside
step 569 ssq 12.766-12.7802 reflect
step 570 ssq 12.766-12.7793 reflect
step 571 ssq 12.766-12.7778 reflect
step 572 ssq 12.766-12.7772 reflect
step 573 ssq 12.7625-12.7772 expand
step 574 ssq 12.7625-12.7769 reflect
step 575 ssq 12.7597-12.7766 expand
step 576 ssq 12.7597-12.7759 reflect
step 577 ssq 12.7597-12.7752 reflect
step 578 ssq 12.7562-12.7738 expand
step 579 ssq 12.7399-12.7725 expand
step 580 ssq 12.7399-12.772 reflect
step 581 ssq 12.7399-12.7698 reflect
step 582 ssq 12.7399-12.7675 reflect
step 583 ssq 12.7294-12.7672 expand
step 584 ssq 12.7294-12.7663 reflect
step 585 ssq 12.7294-12.766 reflect
step 586 ssq 12.7096-12.7625 expand
step 587 ssq 12.7096-12.76 reflect
step 588 ssq 12.7096-12.7597 reflect
step 589 ssq 12.7096-12.7562 reflect
step 590 ssq 12.7096-12.7526 reflect
step 591 ssq 12.7096-12.748 reflect
step 592 ssq 12.7096-12.7458 reflect
step 593 ssq 12.6915-12.7439 expand
step 594 ssq 12.6915-12.7399 reflect
step 595 ssq 12.6714-12.7385 expand
step 596 ssq 12.6714-12.7302 reflect
step 597 ssq 12.6714-12.7294 reflect
step 598 ssq 12.6322-12.7253 expand
step 599 ssq 12.6322-12.723 reflect
step 600 ssq 12.6322-12.7151 reflect
step 601 ssq 12.6322-12.7136 reflect
step 602 ssq 12.6322-12.7101 reflect
step 603 ssq 12.6322-12.7096 reflect
step 604 ssq 12.5981-12.6962 expand
step 605 ssq 12.5496-12.6915 expand
step 606 ssq 12.5496-12.6854 reflect
step 607 ssq 12.5496-12.6729 reflect
step 608 ssq 12.5496-12.6714 reflect
step 609 ssq 12.5496-12.6675 reflect
step 610 ssq 12.4683-12.6597 expand
step 611 ssq 12.4683-12.6464 reflect
step 612 ssq 12.4683-12.6441 reflect
step 613 ssq 12.4683-12.6329 reflect
step 614 ssq 12.4683-12.6322 reflect
step 615 ssq 12.4683-12.6067 reflect
step 616 ssq 12.4683-12.6067 reflect
step 617 ssq 12.4683-12.5981 reflect
step 618 ssq 12.3773-12.5866 expand
step 619 ssq 12.3773-12.5607 reflect
step 620 ssq 12.3773-12.5496 reflect
step 621 ssq 12.3773-12.5454 reflect
step 622 ssq 12.2706-12.5207 expand
step 623 ssq 12.2706-12.5026 reflect
step 624 ssq 12.2706-12.5019 reflect
step 625 ssq 12.2706-12.4789 reflect
step 626 ssq 12.2021-12.4763 expand
step 627 ssq 12.2021-12.4689 reflect
step 628 ssq 12.0938-12.4683 expand
step 629 ssq 12.0938-12.3906 reflect
step 630 ssq 12.0938-12.3851 reflect
step 631 ssq 12.0938-12.3827 reflect
step 632 ssq 11.9597-12.3773 expand
step 633 ssq 11.9597-12.3145 reflect
step 634 ssq 11.9597-12.312 reflect
step 635 ssq 11.9597-12.2962 reflect
step 636 ssq 11.9312-12.2706 expand
step 637 ssq 11.761-12.22 expand
step 638 ssq 11.761-12.2021 reflect
step 639 ssq 11.5134-12.1471 expand
step 640 ssq 11.5134-12.1387 reflect
step 641 ssq 11.5134-12.1148 reflect
step 642 ssq 11.5134-12.0938 reflect
step 643 ssq 11.5134-12.006 reflect
step 644 ssq 11.5134-11.999 reflect
step 645 ssq 11.5134-11.9724 reflect
step 646 ssq 11.5134-11.9597 reflect
step 647 ssq 11.5134-11.9581 reflect
step 648 ssq 11.5134-11.9312 reflect
step 649 ssq 11.1542-11.9203 expand
step 650 ssq 11.1542-11.8496 reflect
step 651 ssq 11.1542-11.812 reflect
step 652 ssq 11.1542-11.7763 reflect
step 653 ssq 11.1542-11.761 reflect
step 654 ssq 11.1542-11.7274 reflect
step 655 ssq 11.1542-11.6862 reflect
step 656 ssq 11.1542-11.6826 reflect
step 657 ssq 11.1542-11.6682 contract inside
step 658 ssq 11.1542-11.6646 reflect
step 659 ssq 11.1542-11.6551 reflect
step 660 ssq 10.8827-11.6115 expand
step 661 ssq 10.8827-11.5369 reflect
step 662 ssq 10.8827-11.5347 reflect
step 663 ssq 10.8827-11.5134 contract inside
step 664 ssq 10.8827-11.4064 contract inside
step 665 ssq 10.8827-11.4009 reflect
step 666 ssq 10.8827-11.3836 contract inside
step 667 ssq 10.8827-11.3597 reflect
step 668 ssq 10.8827-11.3055 reflect
step 669 ssq 10.8827-11.2986 reflect
step 670 ssq 10.656-11.2911 expand
step 671 ssq 10.656-11.2343 reflect
step 672 ssq 10.5408-11.1893 expand
step 673 ssq 10.5408-11.1542 reflect
step 674 ssq 10.3955-11.1517 expand
step 675 ssq 10.3955-11.1363 reflect
step 676 ssq 10.3955-10.9481 contract inside
step 677 ssq 10.3955-10.937 reflect
step 678 ssq 10.3955-10.9237 contract inside
step 679 ssq 10.3955-10.8941 contract inside
step 680 ssq 10.3955-10.8827 contract inside
step 681 ssq 10.3955-10.8408 reflect
step 682 ssq 10.3955-10.7754 contract inside
step 683 ssq 10.3955-10.7392 reflect
step 684 ssq 10.327-10.725 expand
step 685 ssq 10.3209-10.7043 reflect
step 686 ssq 10.3209-10.6783 reflect
step 687 ssq 10.3209-10.6747 reflect
step 688 ssq 10.3209-10.6716 contract inside
step 689 ssq 10.3209-10.662 contract inside
step 690 ssq 10.3209-10.656 contract inside
step 691 ssq 10.3209-10.5524 contract outside
step 692 ssq 10.3209-10.542 contract inside
step 693 ssq 10.2755-10.5408 reflect
step 694 ssq 10.2755-10.498 reflect
step 695 ssq 10.2755-10.4866 contract inside
step 696 ssq 10.2755-10.4615 contract inside
step 697 ssq 10.2755-10.4513 contract inside
step 698 ssq 10.2755-10.4464 reflect
step 699 ssq 10.2755-10.4288 contract inside
step 700 ssq 10.2755-10.413 contract inside
step 701 ssq 10.2755-10.3975 contract inside
step 702 ssq 10.2729-10.3955 reflect
step 703 ssq 10.2729-10.3895 reflect
step 704 ssq 10.2729-10.3688 contract inside
step 705 ssq 10.2729-10.3679 contract inside
step 706 ssq 10.2729-10.3557 contract inside
step 707 ssq 10.2729-10.3538 reflect
step 708 ssq 10.2729-10.3493 contract inside
step 709 ssq 10.2729-10.3476 contract inside
step 710 ssq 10.2329-10.3342 expand
step 711 ssq 10.2329-10.334 reflect
step 712 ssq 10.2329-10.327 contract inside
step 713 ssq 10.2329-10.3249 reflect
step 714 ssq 10.2318-10.3209 reflect
step 715 ssq 10.2318-10.3146 reflect
step 716 ssq 10.2298-10.3121 reflect
step 717 ssq 10.2298-10.3078 reflect
step 718 ssq 10.2298-10.3046 contract inside
step 719 ssq 10.2298-10.2987 reflect
step 720 ssq 10.2218-10.2787 reflect
step 721 ssq 10.2218-10.2755 reflect
step 722 ssq 10.2171-10.2737 reflect
step 723 ssq 10.2171-10.2729 reflect
step 724 ssq 10.2171-10.2677 contract inside
step 725 ssq 10.2171-10.2672 reflect
step 726 ssq 10.174-10.2505 reflect
step 727 ssq 10.174-10.2475 reflect
step 728 ssq 10.174-10.2329 reflect
step 729 ssq 10.174-10.2319 contract inside
step 730 ssq 10.174-10.2318 reflect
step 731 ssq 10.174-10.2298 reflect
step 732 ssq 10.1516-10.2282 expand
step 733 ssq 10.1516-10.2257 reflect
step 734 ssq 10.1516-10.2242 reflect
step 735 ssq 10.1516-10.2218 reflect
step 736 ssq 10.1501-10.2171 expand
step 737 ssq 10.1262-10.2123 expand
step 738 ssq 10.1262-10.2106 reflect
step 739 ssq 10.0533-10.1984 expand
step 740 ssq 10.0533-10.1875 reflect
step 741 ssq 10.0533-10.1852 reflect
step 742 ssq 10.0533-10.1841 reflect
step 743 ssq 10.0533-10.1822 reflect
step 744 ssq 10.0533-10.1813 reflect
step 745 ssq 10.0075-10.174 expand
step 746 ssq 10.0075-10.1516 reflect
step 747 ssq 10.0075-10.1501 reflect
step 748 ssq 10.0075-10.1405 reflect
step 749 ssq 10.0075-10.1375 reflect
step 750 ssq 9.9907-10.1349 reflect
step 751 ssq 9.972-10.1262 reflect
step 752 ssq 9.9658-10.0978 reflect
step 753 ssq 9.9658-10.091 reflect
step 754 ssq 9.8707-10.0563 expand
step 755 ssq 9.8707-10.0533 reflect
step 756 ssq 9.8707-10.0414 reflect
step 757 ssq 9.8707-10.031 reflect
step 758 ssq 9.8183-10.0178 expand
step 759 ssq 9.8183-10.0174 reflect
step 760 ssq 9.8183-10.0075 reflect
step 761 ssq 9.777-9.9907 expand
step 762 ssq 9.777-9.972 reflect
step 763 ssq 9.777-9.9696 reflect
step 764 ssq 9.777-9.9669 reflect
step 765 ssq 9.7407-9.9658 reflect
step 766 ssq 9.7407-9.9065 reflect
step 767 ssq 9.7204-9.8954 reflect
step 768 ssq 9.7204-9.8707 reflect
step 769 ssq 9.7204-9.8641 reflect
step 770 ssq 9.7204-9.8545 reflect
step 771 ssq 9.6849-9.8278 reflect
step 772 ssq 9.6849-9.8224 reflect
step 773 ssq 9.6849-9.8183 reflect
step 774 ssq 9.6849-9.7959 reflect
step 775 ssq 9.6849-9.7835 reflect
step 776 ssq 9.6849-9.777 reflect
step 777 ssq 9.6849-9.7627 reflect
step 778 ssq 9.6849-9.7581 contract inside
step 779 ssq 9.6849-9.7422 contract inside
step 780 ssq 9.6849-9.7407 reflect
step 781 ssq 9.6849-9.7401 reflect
step 782 ssq 9.6849-9.7376 contract inside
step 783 ssq 9.6849-9.7334 reflect
step 784 ssq 9.6847-9.7212 reflect
step 785 ssq 9.6788-9.7204 reflect
step 786 ssq 9.6788-9.714 reflect
step 787 ssq 9.6788-9.7074 contract inside
step 788 ssq 9.6788-9.7062 reflect
step 789 ssq 9.6788-9.7054 reflect
step 790 ssq 9.6758-9.7051 reflect
step 791 ssq 9.6758-9.7022 contract inside
step 792 ssq 9.6726-9.6989 reflect
step 793 ssq 9.6683-9.6948 reflect
step 794 ssq 9.6683-9.694 reflect
step 795 ssq 9.6589-9.6913 reflect
step 796 ssq 9.6589-9.6878 reflect
step 797 ssq 9.6589-9.6849 contract inside
step 798 ssq 9.6561-9.6847 reflect
step 799 ssq 9.6561-9.6823 reflect
step 800 ssq 9.6466-9.6812 reflect
step 801 ssq 9.6466-9.6794 reflect
step 802 ssq 9.6466-9.6788 reflect
step 803 ssq 9.6466-9.6774 contract inside
step 804 ssq 9.6367-9.6758 reflect
step 805 ssq 9.6367-9.6726 contract inside
step 806 ssq 9.6367-9.6683 reflect
step 807 ssq 9.6367-9.667 reflect
step 808 ssq 9.6367-9.6665 reflect
step 809 ssq 9.6367-9.6651 contract inside
step 810 ssq 9.6367-9.6634 reflect
step 811 ssq 9.6367-9.6589 contract outside
step 812 ssq 9.6367-9.6589 contract inside
step 813 ssq 9.6367-9.6561 reflect
step 814 ssq 9.6367-9.6556 reflect
step 815 ssq 9.6277-9.6524 reflect
step 816 ssq 9.6277-9.6521 reflect
step 817 ssq 9.6277-9.6508 reflect
step 818 ssq 9.6277-9.6477 reflect
step 819 ssq 9.6273-9.647 reflect
step 820 ssq 9.6273-9.6466 contract inside
step 821 ssq 9.6273-9.6461 reflect
step 822 ssq 9.6273-9.6456 contract inside
step 823 ssq 9.6273-9.6447 reflect
step 824 ssq 9.6273-9.6444 reflect
step 825 ssq 9.6273-9.643 reflect
step 826 ssq 9.6206-9.6407 reflect
step 827 ssq 9.6206-9.6367 reflect
step 828 ssq 9.6161-9.6347 reflect
step 829 ssq 9.6088-9.6335 expand
step 830 ssq 9.5978-9.6332 expand
step 831 ssq 9.5978-9.6329 reflect
step 832 ssq 9.5978-9.6305 contract outside
step 833 ssq 9.5978-9.6303 reflect
step 834 ssq 9.5978-9.629 reflect
step 835 ssq 9.5978-9.6284 reflect
step 836 ssq 9.5978-9.6277 reflect
step 837 ssq 9.5978-9.6277 reflect
step 838 ssq 9.5978-9.6273 reflect
step 839 ssq 9.5803-9.6272 expand
step 840 ssq 9.5803-9.6244 reflect
step 841 ssq 9.5803-9.6221 reflect
step 842 ssq 9.5803-9.6206 reflect
step 843 ssq 9.5803-9.6183 reflect
step 844 ssq 9.5803-9.6167 reflect
step 845 ssq 9.5803-9.6161 reflect
step 846 ssq 9.5422-9.6126 expand
step 847 ssq 9.5422-9.6101 reflect
step 848 ssq 9.5422-9.6088 reflect
step 849 ssq 9.5422-9.5993 reflect
step 850 ssq 9.5422-9.5978 reflect
step 851 ssq 9.5422-9.5966 reflect
step 852 ssq 9.5422-9.5948 reflect
step 853 ssq 9.5422-9.5925 reflect
step 854 ssq 9.5306-9.5899 expand
step 855 ssq 9.5108-9.5849 expand
step 856 ssq 9.5108-9.5829 reflect
step 857 ssq 9.496-9.5803 expand
step 858 ssq 9.496-9.5689 reflect
step 859 ssq 9.496-9.5613 reflect
step 860 ssq 9.4516-9.5595 expand
step 861 ssq 9.4516-9.5588 reflect
step 862 ssq 9.4516-9.5587 reflect
step 863 ssq 9.4516-9.5559 reflect
step 864 ssq 9.451-9.5422 reflect
step 865 ssq 9.4206-9.5306 expand
step 866 ssq 9.3983-9.5281 expand
step 867 ssq 9.3983-9.5108 reflect
step 868 ssq 9.3983-9.5011 reflect
step 869 ssq 9.346-9.5002 expand
step 870 ssq 9.346-9.496 reflect
step 871 ssq 9.346-9.4761 reflect
step 872 ssq 9.3333-9.4603 expand
step 873 ssq 9.2816-9.4519 expand
step 874 ssq 9.2816-9.4516 reflect
step 875 ssq 9.2583-9.451 expand
step 876 ssq 9.2583-9.4206 reflect
step 877 ssq 9.2583-9.4135 reflect
step 878 ssq 9.2583-9.4026 reflect
step 879 ssq 9.2583-9.3983 reflect
step 880 ssq 9.2583-9.3806 reflect
step 881 ssq 9.2395-9.3572 reflect
step 882 ssq 9.2395-9.3466 reflect
step 883 ssq 9.238-9.346 reflect
step 884 ssq 9.238-9.3375 reflect
step 885 ssq 9.238-9.3333 contract outside
step 886 ssq 9.238-9.32 reflect
step 887 ssq 9.238-9.3127 reflect
step 888 ssq 9.2313-9.2988 reflect
step 889 ssq 9.2313-9.2844 contract inside
step 890 ssq 9.2313-9.2816 contract inside
step 891 ssq 9.2313-9.2811 reflect
step 892 ssq 9.2313-9.2803 reflect
step 893 ssq 9.2241-9.2738 reflect
step 894 ssq 9.2241-9.2733 reflect
step 895 ssq 9.2241-9.2621 contract outside
step 896 ssq 9.2241-9.2592 contract inside
step 897 ssq 9.2241-9.2583 contract inside
step 898 ssq 9.2241-9.2574 reflect
step 899 ssq 9.2241-9.2532 reflect
step 900 ssq 9.2241-9.2527 contract inside
step 901 ssq 9.2241-9.2472 reflect
step 902 ssq 9.2241-9.2455 reflect
step 903 ssq 9.2174-9.2438 reflect
step 904 ssq 9.2174-9.2395 contract inside
step 905 ssq 9.2174-9.238 reflect
step 906 ssq 9.2174-9.2379 reflect
step 907 ssq 9.2174-9.2353 reflect
step 908 ssq 9.2174-9.2342 contract inside
step 909 ssq 9.2174-9.233 reflect
step 910 ssq 9.2174-9.2316 reflect
step 911 ssq 9.2174-9.2313 reflect
step 912 ssq 9.2174-9.2297 reflect
step 913 ssq 9.2174-9.2296 reflect
step 914 ssq 9.2174-9.2291 contract inside
step 915 ssq 9.2174-9.2291 reflect
step 916 ssq 9.2174-9.2282 contract outside
step 917 ssq 9.2164-9.2265 contract inside
step 918 ssq 9.2164-9.2264 reflect
step 919 ssq 9.2164-9.2255 contract inside
step 920 ssq 9.2164-9.2241 contract inside
step 921 ssq 9.2162-9.2219 contract outside
step 922 ssq 9.2158-9.2217 contract inside
step 923 ssq 9.2158-9.2217 reflect
step 924 ssq 9.2155-9.2207 contract inside
step 925 ssq 9.215-9.2205 contract inside
step 926 ssq 9.215-9.2185 contract inside
step 927 ssq 9.215-9.2178 reflect
step 928 ssq 9.2145-9.2174 contract outside
step 929 ssq 9.2145-9.2171 reflect
step 930 ssq 9.2143-9.2171 contract inside
step 931 ssq 9.2141-9.2171 contract inside
step 932 ssq 9.2141-9.2168 contract inside
step 933 ssq 9.214-9.2166 contract inside
step 934 ssq 9.214-9.2164 contract inside
step 935 ssq 9.214-9.2162 contract inside
step 936 ssq 9.214-9.2158 reflect
step 937 ssq 9.214-9.2155 contract inside
step 938 ssq 9.214-9.2153 reflect
step 939 ssq 9.2138-9.2152 contract inside
step 940 ssq 9.2138-9.215 contract inside
step 941 ssq 9.2138-9.2145 reflect
step 942 ssq 9.2136-9.2143 contract inside
step 943 ssq 9.2135-9.2143 contract inside
step 944 ssq 9.2135-9.2142 reflect
step 945 ssq 9.2135-9.2142 contract inside
step 946 ssq 9.2135-9.2141 contract inside
step 947 ssq 9.2135-9.2141 contract inside
step 948 ssq 9.2135-9.2141 reflect
step 949 ssq 9.2135-9.214 reflect
step 950 ssq 9.2135-9.214 contract inside
step 951 ssq 9.2135-9.214 reflect
step 952 ssq 9.2135-9.214 reflect
step 953 ssq 9.2135-9.214 reflect
step 954 ssq 9.2135-9.2139 reflect
step 955 ssq 9.2134-9.2139 contract inside
step 956 ssq 9.2134-9.2138 contract inside
step 957 ssq 9.2134-9.2138 contract inside
step 958 ssq 9.2134-9.2138 reflect
step 959 ssq 9.2134-9.2137 contract inside
step 960 ssq 9.2133-9.2136 contract inside
step 961 ssq 9.2133-9.2135 contract inside
step 962 ssq 9.2133-9.2135 contract inside
step 963 ssq 9.2133-9.2135 reflect
step 964 ssq 9.2131-9.2135 reflect
step 965 ssq 9.2131-9.2135 reflect
step 966 ssq 9.2131-9.2135 reflect
step 967 ssq 9.2131-9.2134 contract inside
step 968 ssq 9.2131-9.2134 contract inside
step 969 ssq 9.2131-9.2134 reflect
step 970 ssq 9.2131-9.2134 contract inside
step 971 ssq 9.2131-9.2134 reflect
step 972 ssq 9.2131-9.2134 contract inside
step 973 ssq 9.2131-9.2133 reflect
step 974 ssq 9.2131-9.2133 contract inside
step 975 ssq 9.213-9.2133 expand
step 976 ssq 9.213-9.2133 reflect
step 977 ssq 9.213-9.2132 contract outside
step 978 ssq 9.213-9.2132 reflect
step 979 ssq 9.213-9.2132 reflect
step 980 ssq 9.213-9.2132 reflect
step 981 ssq 9.213-9.2132 reflect
step 982 ssq 9.213-9.2132 reflect
step 983 ssq 9.213-9.2132 reflect
step 984 ssq 9.2129-9.2132 expand
step 985 ssq 9.2129-9.2131 reflect
step 986 ssq 9.2129-9.2131 reflect
step 987 ssq 9.2129-9.2131 reflect
step 988 ssq 9.2128-9.2131 expand
step 989 ssq 9.2128-9.2131 reflect
step 990 ssq 9.2128-9.2131 reflect
step 991 ssq 9.2128-9.2131 reflect
step 992 ssq 9.2127-9.2131 reflect
step 993 ssq 9.2126-9.213 expand
step 994 ssq 9.2126-9.213 reflect
step 995 ssq 9.2126-9.213 reflect
step 996 ssq 9.2126-9.213 reflect
step 997 ssq 9.2126-9.213 reflect
step 998 ssq 9.2126-9.2129 reflect
step 999 ssq 9.2126-9.2129 reflect
step 1000 ssq 9.2126-9.2129 reflect
step 1001 ssq 9.2125-9.2129 expand
step 1002 ssq 9.2125-9.2129 reflect
step 1003 ssq 9.2125-9.2129 contract inside
step 1004 ssq 9.2125-9.2128 reflect
step 1005 ssq 9.2125-9.2128 reflect
step 1006 ssq 9.2125-9.2128 reflect
step 1007 ssq 9.2125-9.2128 contract outside
step 1008 ssq 9.2125-9.2128 reflect
step 1009 ssq 9.2125-9.2128 reflect
step 1010 ssq 9.2125-9.2128 reflect
step 1011 ssq 9.2125-9.2128 reflect
step 1012 ssq 9.2125-9.2127 reflect
step 1013 ssq 9.2121-9.2127 expand
step 1014 ssq 9.2121-9.2126 reflect
step 1015 ssq 9.2121-9.2126 reflect
step 1016 ssq 9.2121-9.2126 reflect
step 1017 ssq 9.2121-9.2126 reflect
step 1018 ssq 9.2121-9.2126 reflect
step 1019 ssq 9.2121-9.2126 reflect
step 1020 ssq 9.2121-9.2125 reflect
step 1021 ssq 9.2121-9.2125 reflect
step 1022 ssq 9.2121-9.2125 reflect
step 1023 ssq 9.2119-9.2125 expand
step 1024 ssq 9.2119-9.2125 reflect
step 1025 ssq 9.2119-9.2124 reflect
step 1026 ssq 9.2119-9.2124 reflect
step 1027 ssq 9.2119-9.2123 reflect
step 1028 ssq 9.2117-9.2123 expand
step 1029 ssq 9.2117-9.2123 reflect
step 1030 ssq 9.2117-9.2123 reflect
step 1031 ssq 9.2117-9.2122 reflect
step 1032 ssq 9.2117-9.2122 reflect
step 1033 ssq 9.2117-9.2122 reflect
step 1034 ssq 9.2115-9.2121 expand
step 1035 ssq 9.2115-9.2121 reflect
step 1036 ssq 9.2114-9.2121 expand
step 1037 ssq 9.2114-9.2121 reflect
step 1038 ssq 9.2114-9.2119 reflect
step 1039 ssq 9.2114-9.2119 reflect
step 1040 ssq 9.2112-9.2118 expand
step 1041 ssq 9.2112-9.2118 reflect
step 1042 ssq 9.2112-9.2118 reflect
step 1043 ssq 9.2111-9.2118 reflect
step 1044 ssq 9.2111-9.2117 reflect
step 1045 ssq 9.2111-9.2117 reflect
step 1046 ssq 9.2111-9.2115 reflect
step 1047 ssq 9.2111-9.2115 reflect
step 1048 ssq 9.2111-9.2115 reflect
step 1049 ssq 9.211-9.2114 reflect
step 1050 ssq 9.211-9.2114 reflect
step 1051 ssq 9.211-9.2114 reflect
step 1052 ssq 9.2109-9.2114 reflect
step 1053 ssq 9.2109-9.2113 reflect
step 1054 ssq 9.2109-9.2113 contract outside
step 1055 ssq 9.2109-9.2112 reflect
step 1056 ssq 9.2109-9.2112 reflect
step 1057 ssq 9.2109-9.2112 reflect
step 1058 ssq 9.2109-9.2112 reflect
step 1059 ssq 9.2109-9.2112 contract inside
step 1060 ssq 9.2109-9.2111 contract inside
step 1061 ssq 9.2109-9.2111 contract inside
step 1062 ssq 9.2109-9.2111 reflect
step 1063 ssq 9.2109-9.2111 contract inside
step 1064 ssq 9.2109-9.2111 reflect
step 1065 ssq 9.2109-9.211 reflect
step 1066 ssq 9.2109-9.211 reflect
step 1067 ssq 9.2109-9.211 contract inside
step 1068 ssq 9.2109-9.211 reflect
step 1069 ssq 9.2109-9.211 reflect
step 1070 ssq 9.2109-9.211 reflect
step 1071 ssq 9.2109-9.211 contract inside
step 1072 ssq 9.2109-9.211 reflect
step 1073 ssq 9.2109-9.211 contract inside
step 1074 ssq 9.2109-9.211 reflect
step 1075 ssq 9.2109-9.211 reflect
step 1076 ssq 9.2109-9.2109 reflect
step 1077 ssq 9.2109-9.2109 reflect
step 1078 ssq 9.2109-9.2109 reflect
step 1079 ssq 9.2109-9.2109 contract inside
step 1080 ssq 9.2109-9.2109 contract inside
step 1081 ssq 9.2109-9.2109 contract inside
step 1082 ssq 9.2109-9.2109 contract inside
step 1083 ssq 9.2109-9.2109 contract inside
step 1084 ssq 9.2108-9.2109 reflect
step 1085 ssq 9.2108-9.2109 contract inside
step 1086 ssq 9.2108-9.2109 reflect
step 1087 ssq 9.2108-9.2109 contract outside
step 1088 ssq 9.2108-9.2109 reflect
step 1089 ssq 9.2108-9.2109 contract inside
step 1090 ssq 9.2108-9.2109 reflect
step 1091 ssq 9.2108-9.2109 reflect
step 1092 ssq 9.2108-9.2109 reflect
step 1093 ssq 9.2108-9.2109 reflect
step 1094 ssq 9.2108-9.2109 reflect
step 1095 ssq 9.2108-9.2109 reflect
step 1096 ssq 9.2108-9.2109 reflect
step 1097 ssq 9.2108-9.2109 reflect
step 1098 ssq 9.2108-9.2108 reflect
step 1099 ssq 9.2108-9.2108 reflect
step 1100 ssq 9.2108-9.2108 reflect
step 1101 ssq 9.2108-9.2108 reflect
step 1102 ssq 9.2108-9.2108 contract inside
step 1103 ssq 9.2108-9.2108 reflect
step 1104 ssq 9.2108-9.2108 reflect
step 1105 ssq 9.2108-9.2108 reflect
step 1106 ssq 9.2108-9.2108 reflect
step 1107 ssq 9.2108-9.2108 reflect
step 1108 ssq 9.2108-9.2108 reflect
step 1109 ssq 9.2108-9.2108 reflect
step 1110 ssq 9.2108-9.2108 contract outside
step 1111 ssq 9.2108-9.2108 reflect
step 1112 ssq 9.2108-9.2108 reflect
step 1113 ssq 9.2108-9.2108 contract inside
step 1114 ssq 9.2108-9.2108 reflect
step 1115 ssq 9.2108-9.2108 reflect
step 1116 ssq 9.2108-9.2108 reflect
step 1117 ssq 9.2108-9.2108 reflect
step 1118 ssq 9.2108-9.2108 contract outside
step 1119 ssq 9.2108-9.2108 reflect
step 1120 ssq 9.2108-9.2108 reflect
step 1121 ssq 9.2108-9.2108 reflect
step 1122 ssq 9.2107-9.2108 expand
step 1123 ssq 9.2107-9.2108 reflect
step 1124 ssq 9.2107-9.2108 reflect
step 1125 ssq 9.2107-9.2108 reflect
step 1126 ssq 9.2107-9.2108 reflect
step 1127 ssq 9.2107-9.2108 contract inside
step 1128 ssq 9.2107-9.2108 reflect
step 1129 ssq 9.2107-9.2108 reflect
step 1130 ssq 9.2107-9.2108 reflect
step 1131 ssq 9.2107-9.2108 reflect
step 1132 ssq 9.2107-9.2108 reflect
step 1133 ssq 9.2107-9.2108 reflect
step 1134 ssq 9.2107-9.2108 reflect
step 1135 ssq 9.2107-9.2108 reflect
step 1136 ssq 9.2107-9.2108 reflect
step 1137 ssq 9.2107-9.2108 reflect
step 1138 ssq 9.2107-9.2108 reflect
step 1139 ssq 9.2107-9.2108 reflect
step 1140 ssq 9.2107-9.2107 reflect
step 1141 ssq 9.2107-9.2107 reflect
step 1142 ssq 9.2107-9.2107 expand
step 1143 ssq 9.2107-9.2107 reflect
step 1144 ssq 9.2107-9.2107 reflect
step 1145 ssq 9.2107-9.2107 reflect
step 1146 ssq 9.2107-9.2107 reflect
step 1147 ssq 9.2107-9.2107 expand
step 1148 ssq 9.2107-9.2107 reflect
step 1149 ssq 9.2107-9.2107 reflect
step 1150 ssq 9.2107-9.2107 reflect
step 1151 ssq 9.2107-9.2107 reflect
step 1152 ssq 9.2107-9.2107 reflect
step 1153 ssq 9.2106-9.2107 expand
step 1154 ssq 9.2106-9.2107 reflect
step 1155 ssq 9.2106-9.2107 reflect
step 1156 ssq 9.2106-9.2107 expand
step 1157 ssq 9.2106-9.2107 reflect
step 1158 ssq 9.2106-9.2107 reflect
step 1159 ssq 9.2106-9.2107 reflect
step 1160 ssq 9.2106-9.2107 reflect
step 1161 ssq 9.2105-9.2107 expand
step 1162 ssq 9.2105-9.2107 reflect
step 1163 ssq 9.2105-9.2107 reflect
step 1164 ssq 9.2105-9.2107 reflect
step 1165 ssq 9.2105-9.2106 reflect
step 1166 ssq 9.2105-9.2106 reflect
step 1167 ssq 9.2105-9.2106 expand
step 1168 ssq 9.2105-9.2106 reflect
step 1169 ssq 9.2105-9.2106 reflect
step 1170 ssq 9.2104-9.2106 expand
step 1171 ssq 9.2104-9.2106 reflect
step 1172 ssq 9.2104-9.2105 expand
step 1173 ssq 9.2104-9.2105 reflect
step 1174 ssq 9.2104-9.2105 reflect
step 1175 ssq 9.2104-9.2105 reflect
step 1176 ssq 9.2102-9.2105 expand
step 1177 ssq 9.2102-9.2105 reflect
step 1178 ssq 9.2101-9.2105 expand
step 1179 ssq 9.2101-9.2105 reflect
step 1180 ssq 9.2101-9.2105 reflect
step 1181 ssq 9.2101-9.2104 reflect
step 1182 ssq 9.2101-9.2104 reflect
step 1183 ssq 9.2101-9.2104 reflect
step 1184 ssq 9.2101-9.2104 reflect
step 1185 ssq 9.2101-9.2104 reflect
step 1186 ssq 9.2101-9.2104 reflect
step 1187 ssq 9.21-9.2103 expand
step 1188 ssq 9.21-9.2103 reflect
step 1189 ssq 9.2098-9.2102 expand
step 1190 ssq 9.2098-9.2102 reflect
step 1191 ssq 9.2098-9.2102 reflect
step 1192 ssq 9.2098-9.2102 reflect
step 1193 ssq 9.2098-9.2102 reflect
step 1194 ssq 9.2098-9.2102 reflect
step 1195 ssq 9.2098-9.2102 reflect
step 1196 ssq 9.2097-9.2101 expand
step 1197 ssq 9.2097-9.2101 reflect
step 1198 ssq 9.2097-9.2101 reflect
step 1199 ssq 9.2097-9.2101 reflect
step 1200 ssq 9.2094-9.21 expand
step 1201 ssq 9.2094-9.21 reflect
step 1202 ssq 9.2094-9.21 reflect
step 1203 ssq 9.2094-9.21 reflect
step 1204 ssq 9.2092-9.2099 expand
step 1205 ssq 9.2092-9.2099 reflect
step 1206 ssq 9.2092-9.2099 reflect
step 1207 ssq 9.2092-9.2098 reflect
step 1208 ssq 9.2092-9.2098 reflect
step 1209 ssq 9.2088-9.2097 expand
step 1210 ssq 9.2088-9.2097 reflect
step 1211 ssq 9.2088-9.2096 reflect
step 1212 ssq 9.2088-9.2095 reflect
step 1213 ssq 9.2085-9.2095 expand
step 1214 ssq 9.2085-9.2094 reflect
step 1215 ssq 9.2085-9.2094 reflect
step 1216 ssq 9.2085-9.2094 reflect
step 1217 ssq 9.2082-9.2093 expand
step 1218 ssq 9.2076-9.2093 expand
step 1219 ssq 9.2076-9.2092 reflect
step 1220 ssq 9.2076-9.2089 reflect
step 1221 ssq 9.2076-9.2089 reflect
step 1222 ssq 9.2076-9.2088 reflect
step 1223 ssq 9.2072-9.2088 expand
step 1224 ssq 9.2072-9.2087 reflect
step 1225 ssq 9.2072-9.2087 reflect
step 1226 ssq 9.2068-9.2086 expand
step 1227 ssq 9.2055-9.2085 expand
step 1228 ssq 9.2055-9.2082 reflect
step 1229 ssq 9.2055-9.2078 reflect
step 1230 ssq 9.2055-9.2078 reflect
step 1231 ssq 9.2055-9.2078 reflect
step 1232 ssq 9.2055-9.2076 reflect
step 1233 ssq 9.2047-9.2076 expand
step 1234 ssq 9.2047-9.2076 reflect
step 1235 ssq 9.2047-9.2073 reflect
step 1236 ssq 9.2047-9.2072 reflect
step 1237 ssq 9.2045-9.2068 expand
step 1238 ssq 9.2044-9.2064 reflect
step 1239 ssq 9.2044-9.2062 reflect
step 1240 ssq 9.2038-9.2062 expand
step 1241 ssq 9.2038-9.2061 reflect
step 1242 ssq 9.202-9.2061 expand
step 1243 ssq 9.202-9.2055 reflect
step 1244 ssq 9.202-9.205 reflect
step 1245 ssq 9.202-9.205 reflect
step 1246 ssq 9.202-9.2048 reflect
step 1247 ssq 9.202-9.2047 reflect
step 1248 ssq 9.202-9.2046 reflect
step 1249 ssq 9.202-9.2045 reflect
step 1250 ssq 9.202-9.2044 reflect
step 1251 ssq 9.202-9.2039 contract inside
step 1252 ssq 9.202-9.2038 reflect
step 1253 ssq 9.2013-9.2038 expand
step 1254 ssq 9.1993-9.2033 expand
step 1255 ssq 9.1993-9.2031 reflect
step 1256 ssq 9.1993-9.2029 reflect
step 1257 ssq 9.1993-9.2027 reflect
step 1258 ssq 9.1993-9.2026 reflect
step 1259 ssq 9.1993-9.2025 reflect
step 1260 ssq 9.1993-9.2022 reflect
step 1261 ssq 9.1985-9.2021 expand
step 1262 ssq 9.1985-9.202 reflect
step 1263 ssq 9.1985-9.202 reflect
step 1264 ssq 9.1984-9.2018 reflect
step 1265 ssq 9.1978-9.2013 reflect
step 1266 ssq 9.1978-9.201 reflect
step 1267 ssq 9.1948-9.2001 expand
step 1268 ssq 9.1948-9.1998 reflect
step 1269 ssq 9.1948-9.1997 reflect
step 1270 ssq 9.1948-9.1996 reflect
step 1271 ssq 9.1948-9.1994 reflect
step 1272 ssq 9.1948-9.1993 reflect
step 1273 ssq 9.1948-9.1986 reflect
step 1274 ssq 9.1948-9.1985 reflect
step 1275 ssq 9.1933-9.1984 expand
step 1276 ssq 9.1933-9.1981 reflect
step 1277 ssq 9.1933-9.198 reflect
step 1278 ssq 9.1933-9.1978 reflect
step 1279 ssq 9.1933-9.1974 reflect
step 1280 ssq 9.1926-9.197 expand
step 1281 ssq 9.1914-9.1966 expand
step 1282 ssq 9.1889-9.1961 expand
step 1283 ssq 9.1889-9.1957 reflect
step 1284 ssq 9.1889-9.1952 reflect
step 1285 ssq 9.1866-9.1952 expand
step 1286 ssq 9.1866-9.1948 reflect
step 1287 ssq 9.1866-9.1942 reflect
step 1288 ssq 9.1866-9.194 reflect
step 1289 ssq 9.1839-9.1933 expand
step 1290 ssq 9.1839-9.1933 reflect
step 1291 ssq 9.1799-9.1926 expand
step 1292 ssq 9.1799-9.1914 reflect
step 1293 ssq 9.1799-9.1906 reflect
step 1294 ssq 9.1799-9.1904 reflect
step 1295 ssq 9.1799-9.189 reflect
step 1296 ssq 9.1799-9.1889 reflect
step 1297 ssq 9.1799-9.1871 reflect
step 1298 ssq 9.1799-9.1867 reflect
step 1299 ssq 9.1799-9.1867 reflect
step 1300 ssq 9.1795-9.1866 reflect
step 1301 ssq 9.1788-9.1863 reflect
step 1302 ssq 9.178-9.1848 reflect
step 1303 ssq 9.1762-9.1845 expand
step 1304 ssq 9.1762-9.1839 reflect
step 1305 ssq 9.176-9.1814 reflect
step 1306 ssq 9.176-9.1812 contract inside
step 1307 ssq 9.1717-9.1806 expand
step 1308 ssq 9.1717-9.1803 reflect
step 1309 ssq 9.1717-9.1802 reflect
step 1310 ssq 9.1717-9.1801 reflect
step 1311 ssq 9.1688-9.1799 expand
step 1312 ssq 9.1688-9.1795 reflect
step 1313 ssq 9.1688-9.1788 reflect
step 1314 ssq 9.162-9.1783 expand
step 1315 ssq 9.162-9.178 reflect
step 1316 ssq 9.162-9.1762 reflect
step 1317 ssq 9.162-9.176 reflect
step 1318 ssq 9.162-9.1751 reflect
step 1319 ssq 9.162-9.175 reflect
step 1320 ssq 9.1542-9.1738 expand
step 1321 ssq 9.1542-9.1731 reflect
step 1322 ssq 9.1542-9.1717 reflect
step 1323 ssq 9.1542-9.17 reflect
step 1324 ssq 9.1542-9.1694 reflect
step 1325 ssq 9.1542-9.169 reflect
step 1326 ssq 9.1542-9.1688 contract inside
step 1327 ssq 9.1448-9.1674 expand
step 1328 ssq 9.1448-9.1661 reflect
step 1329 ssq 9.1448-9.1632 reflect
step 1330 ssq 9.1448-9.1628 reflect
step 1331 ssq 9.1448-9.162 contract inside
step 1332 ssq 9.1448-9.1611 reflect
step 1333 ssq 9.1448-9.1606 reflect
step 1334 ssq 9.1444-9.1576 reflect
step 1335 ssq 9.1414-9.1576 expand
step 1336 ssq 9.1414-9.1574 reflect
step 1337 ssq 9.1349-9.1546 reflect
step 1338 ssq 9.1349-9.1542 reflect
step 1339 ssq 9.1349-9.153 reflect
step 1340 ssq 9.1294-9.1481 expand
step 1341 ssq 9.1294-9.148 contract inside
step 1342 ssq 9.1294-9.1473 reflect
step 1343 ssq 9.1294-9.1457 reflect
step 1344 ssq 9.1294-9.1448 reflect
step 1345 ssq 9.1294-9.1444 reflect
step 1346 ssq 9.1294-9.144 contract inside
step 1347 ssq 9.1294-9.1429 reflect
step 1348 ssq 9.1293-9.1414 reflect
step 1349 ssq 9.1293-9.1405 reflect
step 1350 ssq 9.1282-9.1387 reflect
step 1351 ssq 9.1268-9.138 reflect
step 1352 ssq 9.1266-9.1377 reflect
step 1353 ssq 9.1266-9.1363 reflect
step 1354 ssq 9.1247-9.1357 reflect
step 1355 ssq 9.1211-9.1349 reflect
step 1356 ssq 9.1211-9.1344 reflect
step 1357 ssq 9.1211-9.1337 reflect
step 1358 ssq 9.1211-9.1327 reflect
step 1359 ssq 9.1211-9.1313 reflect
step 1360 ssq 9.1211-9.1294 reflect
step 1361 ssq 9.1211-9.1294 contract inside
step 1362 ssq 9.1211-9.1293 contract inside
step 1363 ssq 9.117-9.1282 expand
step 1364 ssq 9.1162-9.1278 reflect
step 1365 ssq 9.1162-9.1268 reflect
step 1366 ssq 9.1162-9.1266 reflect
step 1367 ssq 9.1162-9.1264 reflect
step 1368 ssq 9.1162-9.1261 reflect
step 1369 ssq 9.113-9.126 reflect
step 1370 ssq 9.113-9.1255 reflect
step 1371 ssq 9.113-9.1255 reflect
step 1372 ssq 9.1103-9.1247 reflect
step 1373 ssq 9.1103-9.1237 reflect
step 1374 ssq 9.1103-9.1211 reflect
step 1375 ssq 9.1103-9.1201 reflect
step 1376 ssq 9.1103-9.1194 reflect
step 1377 ssq 9.1098-9.1187 reflect
step 1378 ssq 9.1098-9.1179 reflect
step 1379 ssq 9.1098-9.1178 reflect
step 1380 ssq 9.1098-9.117 contract inside
step 1381 ssq 9.1098-9.1162 contract inside
step 1382 ssq 9.1074-9.115 reflect
step 1383 ssq 9.1074-9.1139 contract inside
step 1384 ssq 9.1074-9.1133 reflect
step 1385 ssq 9.1074-9.1132 reflect
step 1386 ssq 9.106-9.1131 expand
step 1387 ssq 9.1006-9.113 expand
step 1388 ssq 9.1006-9.1112 reflect
step 1389 ssq 9.1006-9.1107 contract inside
step 1390 ssq 9.1006-9.1107 contract inside
step 1391 ssq 9.1006-9.1106 reflect
step 1392 ssq 9.1006-9.1103 reflect
step 1393 ssq 9.1006-9.1101 reflect
step 1394 ssq 9.1006-9.11 reflect
step 1395 ssq 9.1006-9.1098 reflect
step 1396 ssq 9.1006-9.1079 reflect
step 1397 ssq 9.0976-9.1074 reflect
step 1398 ssq 9.0976-9.1074 contract inside
step 1399 ssq 9.0976-9.1074 contract inside
step 1400 ssq 9.0976-9.1065 reflect
step 1401 ssq 9.0976-9.106 reflect
step 1402 ssq 9.0976-9.1048 reflect
step 1403 ssq 9.0976-9.104 reflect
step 1404 ssq 9.0918-9.1039 expand
step 1405 ssq 9.0918-9.1037 reflect
step 1406 ssq 9.0918-9.1034 reflect
step 1407 ssq 9.0918-9.1033 reflect
step 1408 ssq 9.0918-9.1027 reflect
step 1409 ssq 9.0918-9.1019 reflect
step 1410 ssq 9.0918-9.1015 reflect
step 1411 ssq 9.0918-9.1009 reflect
step 1412 ssq 9.0918-9.1006 reflect
step 1413 ssq 9.0918-9.1 reflect
step 1414 ssq 9.0918-9.0995 reflect
step 1415 ssq 9.0918-9.0985 reflect
step 1416 ssq 9.0862-9.0983 expand
step 1417 ssq 9.0862-9.0978 contract inside
step 1418 ssq 9.0862-9.0976 contract inside
step 1419 ssq 9.0862-9.0965 reflect
step 1420 ssq 9.0862-9.0949 reflect
step 1421 ssq 9.0862-9.0944 reflect
step 1422 ssq 9.0862-9.0944 reflect
step 1423 ssq 9.0862-9.0942 reflect
step 1424 ssq 9.0862-9.094 contract inside
step 1425 ssq 9.0843-9.0937 expand
step 1426 ssq 9.0843-9.0935 contract inside
step 1427 ssq 9.0843-9.0926 reflect
step 1428 ssq 9.0822-9.0924 expand
step 1429 ssq 9.0822-9.0924 reflect
step 1430 ssq 9.0822-9.092 reflect
step 1431 ssq 9.0822-9.0918 reflect
step 1432 ssq 9.0783-9.0906 expand
step 1433 ssq 9.0783-9.0902 reflect
step 1434 ssq 9.0783-9.0886 reflect
step 1435 ssq 9.0783-9.0879 contract inside
step 1436 ssq 9.0783-9.0878 reflect
step 1437 ssq 9.0783-9.0872 reflect
step 1438 ssq 9.0765-9.0862 expand
step 1439 ssq 9.0765-9.0845 reflect
step 1440 ssq 9.0765-9.0845 contract inside
step 1441 ssq 9.0765-9.0844 reflect
step 1442 ssq 9.0751-9.0843 reflect
step 1443 ssq 9.0748-9.0822 reflect
step 1444 ssq 9.0744-9.0817 reflect
step 1445 ssq 9.0744-9.0808 reflect
step 1446 ssq 9.0744-9.0803 reflect
step 1447 ssq 9.0695-9.0797 expand
step 1448 ssq 9.0695-9.0791 reflect
step 1449 ssq 9.0695-9.0788 reflect
step 1450 ssq 9.0695-9.0788 reflect
step 1451 ssq 9.0695-9.0783 reflect
step 1452 ssq 9.0693-9.0773 reflect
step 1453 ssq 9.0693-9.0765 contract inside
step 1454 ssq 9.0693-9.0764 reflect
step 1455 ssq 9.0693-9.0753 reflect
step 1456 ssq 9.0693-9.0751 contract inside
step 1457 ssq 9.0693-9.0748 reflect
step 1458 ssq 9.068-9.0745 reflect
step 1459 ssq 9.0678-9.0744 reflect
step 1460 ssq 9.0654-9.0728 reflect
step 1461 ssq 9.0654-9.072 reflect
step 1462 ssq 9.0654-9.0719 reflect
step 1463 ssq 9.0646-9.0714 reflect
step 1464 ssq 9.0646-9.0712 contract inside
step 1465 ssq 9.0646-9.0709 reflect
step 1466 ssq 9.0646-9.0703 contract inside
step 1467 ssq 9.0646-9.0695 contract inside
step 1468 ssq 9.0646-9.0693 reflect
step 1469 ssq 9.0646-9.0693 contract inside
step 1470 ssq 9.0646-9.0692 reflect
step 1471 ssq 9.0646-9.0688 contract inside
step 1472 ssq 9.0623-9.0684 expand
step 1473 ssq 9.0623-9.0683 reflect
step 1474 ssq 9.0623-9.0683 reflect
step 1475 ssq 9.0623-9.0682 reflect
step 1476 ssq 9.0623-9.068 contract inside
step 1477 ssq 9.0623-9.0679 reflect
step 1478 ssq 9.0623-9.0678 reflect
step 1479 ssq 9.0623-9.0674 contract inside
step 1480 ssq 9.0623-9.0672 reflect
step 1481 ssq 9.0623-9.0667 reflect
step 1482 ssq 9.0623-9.0666 reflect
step 1483 ssq 9.0623-9.0663 contract inside
step 1484 ssq 9.0623-9.0662 reflect
step 1485 ssq 9.0623-9.0662 contract inside
step 1486 ssq 9.0623-9.0658 contract inside
step 1487 ssq 9.0623-9.0656 reflect
step 1488 ssq 9.0623-9.0654 reflect
step 1489 ssq 9.0623-9.0654 contract inside
step 1490 ssq 9.0623-9.0649 reflect
step 1491 ssq 9.0623-9.0649 reflect
step 1492 ssq 9.0619-9.0649 expand
step 1493 ssq 9.06-9.0648 expand
step 1494 ssq 9.06-9.0647 reflect
step 1495 ssq 9.06-9.0646 reflect
step 1496 ssq 9.06-9.0641 reflect
step 1497 ssq 9.06-9.064 contract inside
step 1498 ssq 9.0595-9.0633 reflect
step 1499 ssq 9.0595-9.0631 contract inside
step 1500 ssq 9.0595-9.0629 contract inside
step 1501 ssq 9.0595-9.0625 reflect
step 1502 ssq 9.0595-9.0625 contract inside
step 1503 ssq 9.0595-9.0623 reflect
step 1504 ssq 9.0595-9.0621 reflect
step 1505 ssq 9.0595-9.0619 contract inside
step 1506 ssq 9.0595-9.0619 reflect
step 1507 ssq 9.0579-9.0616 expand
step 1508 ssq 9.0579-9.0614 reflect
step 1509 ssq 9.0579-9.0612 reflect
step 1510 ssq 9.0579-9.0612 reflect
step 1511 ssq 9.0575-9.061 reflect
step 1512 ssq 9.0575-9.0608 reflect
step 1513 ssq 9.0573-9.0603 expand
step 1514 ssq 9.0573-9.0601 contract inside
step 1515 ssq 9.0573-9.06 contract inside
step 1516 ssq 9.0573-9.0598 reflect
step 1517 ssq 9.0573-9.0598 reflect
step 1518 ssq 9.0572-9.0595 reflect
step 1519 ssq 9.0559-9.0591 expand
step 1520 ssq 9.0558-9.0591 reflect
step 1521 ssq 9.0552-9.059 reflect
step 1522 ssq 9.0542-9.0583 reflect
step 1523 ssq 9.0542-9.0582 reflect
step 1524 ssq 9.0542-9.0579 reflect
step 1525 ssq 9.0534-9.0579 expand
step 1526 ssq 9.0534-9.0575 reflect
step 1527 ssq 9.0534-9.0575 reflect
step 1528 ssq 9.0529-9.0573 expand
step 1529 ssq 9.0529-9.0572 reflect
step 1530 ssq 9.0486-9.0559 expand
step 1531 ssq 9.0486-9.0558 reflect
step 1532 ssq 9.0486-9.0553 reflect
step 1533 ssq 9.0486-9.0552 reflect
step 1534 ssq 9.0486-9.0551 reflect
step 1535 ssq 9.0486-9.0543 reflect
step 1536 ssq 9.0486-9.0542 reflect
step 1537 ssq 9.0486-9.0537 reflect
step 1538 ssq 9.0471-9.0534 reflect
step 1539 ssq 9.0471-9.0534 contract inside
step 1540 ssq 9.0471-9.053 reflect
step 1541 ssq 9.0471-9.0529 reflect
step 1542 ssq 9.0471-9.0515 reflect
step 1543 ssq 9.0471-9.0514 contract inside
step 1544 ssq 9.0451-9.0511 expand
step 1545 ssq 9.0451-9.0498 reflect
step 1546 ssq 9.0451-9.0497 reflect
step 1547 ssq 9.0451-9.0497 reflect
step 1548 ssq 9.0442-9.0493 expand
step 1549 ssq 9.0442-9.0492 reflect
step 1550 ssq 9.0442-9.0487 reflect
step 1551 ssq 9.0442-9.0486 reflect
step 1552 ssq 9.0433-9.0486 reflect
step 1553 ssq 9.0433-9.0484 reflect
step 1554 ssq 9.0433-9.0484 reflect
step 1555 ssq 9.0433-9.0471 reflect
step 1556 ssq 9.0424-9.0467 reflect
step 1557 ssq 9.0424-9.0461 reflect
step 1558 ssq 9.0424-9.0459 reflect
step 1559 ssq 9.0412-9.0453 reflect
step 1560 ssq 9.0412-9.0451 reflect
step 1561 ssq 9.0412-9.0444 reflect
step 1562 ssq 9.0412-9.0444 reflect
step 1563 ssq 9.0412-9.0443 reflect
step 1564 ssq 9.0412-9.0442 contract inside
step 1565 ssq 9.0412-9.0442 reflect
step 1566 ssq 9.0412-9.044 reflect
step 1567 ssq 9.0412-9.0438 contract inside
step 1568 ssq 9.0412-9.0433 contract inside
step 1569 ssq 9.0412-9.0433 contract inside
step 1570 ssq 9.0412-9.0433 reflect
step 1571 ssq 9.0412-9.043 contract outside
step 1572 ssq 9.0407-9.0429 expand
step 1573 ssq 9.0407-9.0427 reflect
step 1574 ssq 9.0407-9.0426 reflect
step 1575 ssq 9.0407-9.0425 reflect
step 1576 ssq 9.0407-9.0424 reflect
step 1577 ssq 9.0407-9.0424 reflect
step 1578 ssq 9.0407-9.0422 contract inside
step 1579 ssq 9.0403-9.0421 reflect
step 1580 ssq 9.0395-9.042 expand
step 1581 ssq 9.0395-9.042 reflect
step 1582 ssq 9.039-9.0416 reflect
step 1583 ssq 9.039-9.0414 contract inside
step 1584 ssq 9.039-9.0412 reflect
step 1585 ssq 9.0383-9.0412 expand
step 1586 ssq 9.0383-9.0412 reflect
step 1587 ssq 9.0383-9.041 reflect
step 1588 ssq 9.0383-9.041 reflect
step 1589 ssq 9.0383-9.0409 reflect
step 1590 ssq 9.0383-9.0407 reflect
step 1591 ssq 9.0383-9.0406 reflect
step 1592 ssq 9.0383-9.0404 reflect
step 1593 ssq 9.0382-9.0403 reflect
step 1594 ssq 9.0382-9.0399 reflect
step 1595 ssq 9.0382-9.0397 reflect
step 1596 ssq 9.0378-9.0395 reflect
step 1597 ssq 9.0378-9.0391 contract inside
step 1598 ssq 9.0378-9.0391 reflect
step 1599 ssq 9.0378-9.039 reflect
step 1600 ssq 9.0378-9.039 reflect
step 1601 ssq 9.0378-9.0388 contract inside
step 1602 ssq 9.0378-9.0387 contract inside
step 1603 ssq 9.0371-9.0385 expand
step 1604 ssq 9.0371-9.0385 reflect
step 1605 ssq 9.0371-9.0384 reflect
step 1606 ssq 9.0371-9.0384 reflect
step 1607 ssq 9.0371-9.0383 contract inside
step 1608 ssq 9.037-9.0383 expand
step 1609 ssq 9.037-9.0382 reflect
step 1610 ssq 9.037-9.0381 reflect
step 1611 ssq 9.037-9.038 reflect
step 1612 ssq 9.037-9.038 reflect
step 1613 ssq 9.0367-9.0379 reflect
step 1614 ssq 9.0367-9.0379 reflect
step 1615 ssq 9.0367-9.0378 reflect
step 1616 ssq 9.0367-9.0378 reflect
step 1617 ssq 9.0367-9.0377 reflect
step 1618 ssq 9.0365-9.0377 reflect
step 1619 ssq 9.0365-9.0377 reflect
step 1620 ssq 9.0365-9.0375 reflect
step 1621 ssq 9.0365-9.0374 reflect
step 1622 ssq 9.0365-9.0373 contract inside
step 1623 ssq 9.0365-9.0372 reflect
step 1624 ssq 9.0362-9.0371 reflect
step 1625 ssq 9.0362-9.0371 contract inside
step 1626 ssq 9.0362-9.0371 contract inside
step 1627 ssq 9.036-9.037 reflect
step 1628 ssq 9.036-9.037 reflect
step 1629 ssq 9.036-9.0368 reflect
step 1630 ssq 9.036-9.0367 reflect
step 1631 ssq 9.036-9.0367 reflect
step 1632 ssq 9.036-9.0367 contract inside
step 1633 ssq 9.0357-9.0366 reflect
step 1634 ssq 9.0357-9.0366 reflect
step 1635 ssq 9.0357-9.0366 reflect
step 1636 ssq 9.0357-9.0365 reflect
step 1637 ssq 9.0357-9.0365 reflect
step 1638 ssq 9.0357-9.0365 contract inside
step 1639 ssq 9.0356-9.0365 reflect
step 1640 ssq 9.0354-9.0365 reflect
step 1641 ssq 9.0354-9.0364 reflect
step 1642 ssq 9.0354-9.0363 reflect
step 1643 ssq 9.0354-9.0363 reflect
step 1644 ssq 9.0354-9.0362 contract inside
step 1645 ssq 9.0354-9.0362 reflect
step 1646 ssq 9.0354-9.0361 reflect
step 1647 ssq 9.0354-9.0361 reflect
step 1648 ssq 9.0354-9.0361 reflect
step 1649 ssq 9.0354-9.036 reflect
step 1650 ssq 9.0354-9.036 reflect
step 1651 ssq 9.0353-9.036 reflect
step 1652 ssq 9.0353-9.0359 reflect
step 1653 ssq 9.0348-9.0359 reflect
step 1654 ssq 9.0348-9.0357 contract inside
step 1655 ssq 9.0348-9.0357 contract inside
step 1656 ssq 9.0348-9.0357 contract inside
step 1657 ssq 9.0348-9.0356 reflect
step 1658 ssq 9.0348-9.0356 reflect
step 1659 ssq 9.0348-9.0355 reflect
step 1660 ssq 9.0348-9.0355 reflect
step 1661 ssq 9.0348-9.0355 reflect
step 1662 ssq 9.0348-9.0354 contract inside
step 1663 ssq 9.0348-9.0354 reflect
step 1664 ssq 9.0348-9.0354 reflect
step 1665 ssq 9.0348-9.0354 reflect
step 1666 ssq 9.0348-9.0354 contract inside
step 1667 ssq 9.0348-9.0354 reflect
step 1668 ssq 9.0348-9.0354 reflect
step 1669 ssq 9.0348-9.0353 reflect
step 1670 ssq 9.0348-9.0353 contract inside
step 1671 ssq 9.0348-9.0353 reflect
step 1672 ssq 9.0348-9.0353 reflect
step 1673 ssq 9.0345-9.0352 reflect
step 1674 ssq 9.0345-9.0351 reflect
step 1675 ssq 9.0345-9.0351 contract inside
step 1676 ssq 9.0345-9.0351 contract inside
step 1677 ssq 9.0345-9.0351 contract inside
step 1678 ssq 9.0345-9.0351 reflect
step 1679 ssq 9.0345-9.035 reflect
step 1680 ssq 9.0345-9.035 contract outside
step 1681 ssq 9.0345-9.035 reflect
step 1682 ssq 9.0345-9.035 reflect
step 1683 ssq 9.0345-9.0349 contract inside
step 1684 ssq 9.0345-9.0349 reflect
step 1685 ssq 9.0345-9.0349 reflect
step 1686 ssq 9.0345-9.0348 reflect
step 1687 ssq 9.0345-9.0348 contract inside
step 1688 ssq 9.0345-9.0348 reflect
step 1689 ssq 9.0345-9.0348 contract inside
step 1690 ssq 9.0343-9.0348 expand
step 1691 ssq 9.0343-9.0347 contract inside
step 1692 ssq 9.0342-9.0347 expand
step 1693 ssq 9.0342-9.0347 reflect
step 1694 ssq 9.0342-9.0346 reflect
step 1695 ssq 9.0342-9.0346 reflect
step 1696 ssq 9.0341-9.0346 reflect
step 1697 ssq 9.0341-9.0346 reflect
step 1698 ssq 9.0341-9.0345 reflect
step 1699 ssq 9.0341-9.0345 reflect
step 1700 ssq 9.0341-9.0345 reflect
step 1701 ssq 9.0341-9.0345 reflect
step 1702 ssq 9.0337-9.0345 expand
step 1703 ssq 9.0337-9.0344 reflect
step 1704 ssq 9.0337-9.0343 reflect
step 1705 ssq 9.0337-9.0342 contract inside
step 1706 ssq 9.0337-9.0342 reflect
step 1707 ssq 9.0337-9.0342 reflect
step 1708 ssq 9.0337-9.0342 reflect
step 1709 ssq 9.0337-9.0342 reflect
step 1710 ssq 9.0337-9.0341 reflect
step 1711 ssq 9.0337-9.0341 contract inside
step 1712 ssq 9.0335-9.0341 expand
step 1713 ssq 9.0335-9.0341 reflect
step 1714 ssq 9.0335-9.034 reflect
step 1715 ssq 9.0332-9.0339 expand
step 1716 ssq 9.0332-9.0339 reflect
step 1717 ssq 9.0332-9.0339 reflect
step 1718 ssq 9.0332-9.0339 reflect
step 1719 ssq 9.0332-9.0339 reflect
step 1720 ssq 9.0332-9.0338 reflect
step 1721 ssq 9.0331-9.0337 expand
step 1722 ssq 9.0331-9.0337 reflect
step 1723 ssq 9.0331-9.0337 reflect
step 1724 ssq 9.0327-9.0337 expand
step 1725 ssq 9.0327-9.0335 reflect
step 1726 ssq 9.0327-9.0335 reflect
step 1727 ssq 9.0327-9.0335 reflect
step 1728 ssq 9.0327-9.0335 reflect
step 1729 ssq 9.0326-9.0335 expand
step 1730 ssq 9.0323-9.0333 expand
step 1731 ssq 9.0323-9.0333 reflect
step 1732 ssq 9.0319-9.0332 expand
step 1733 ssq 9.0319-9.0332 reflect
step 1734 ssq 9.0319-9.0331 reflect
step 1735 ssq 9.0319-9.033 reflect
step 1736 ssq 9.0319-9.033 reflect
step 1737 ssq 9.0319-9.0329 reflect
step 1738 ssq 9.0319-9.0329 contract inside
step 1739 ssq 9.0318-9.0328 reflect
step 1740 ssq 9.0318-9.0327 contract inside
step 1741 ssq 9.0318-9.0326 reflect
step 1742 ssq 9.0317-9.0325 reflect
step 1743 ssq 9.0317-9.0323 contract inside
step 1744 ssq 9.0316-9.0323 reflect
step 1745 ssq 9.0316-9.0323 reflect
step 1746 ssq 9.0314-9.0322 expand
step 1747 ssq 9.0314-9.0322 reflect
step 1748 ssq 9.0314-9.0322 contract inside
step 1749 ssq 9.0314-9.0321 contract inside
step 1750 ssq 9.0314-9.0321 reflect
step 1751 ssq 9.0314-9.032 contract outside
step 1752 ssq 9.0314-9.0319 reflect
step 1753 ssq 9.0314-9.0319 reflect
step 1754 ssq 9.0312-9.0319 reflect
step 1755 ssq 9.0312-9.0319 contract inside
step 1756 ssq 9.0312-9.0319 reflect
step 1757 ssq 9.0312-9.0318 reflect
step 1758 ssq 9.0312-9.0317 reflect
step 1759 ssq 9.0312-9.0317 reflect
step 1760 ssq 9.0312-9.0317 reflect
step 1761 ssq 9.0309-9.0316 reflect
step 1762 ssq 9.0309-9.0316 reflect
step 1763 ssq 9.0309-9.0314 reflect
step 1764 ssq 9.0309-9.0314 reflect
step 1765 ssq 9.0309-9.0314 contract inside
step 1766 ssq 9.0309-9.0314 reflect
step 1767 ssq 9.0309-9.0314 contract inside
step 1768 ssq 9.0308-9.0312 reflect
step 1769 ssq 9.0308-9.0312 reflect
step 1770 ssq 9.0308-9.0312 reflect
step 1771 ssq 9.0308-9.0312 reflect
step 1772 ssq 9.0306-9.0312 expand
step 1773 ssq 9.0304-9.0311 expand
step 1774 ssq 9.0304-9.0311 reflect
step 1775 ssq 9.0304-9.0311 contract inside
step 1776 ssq 9.0304-9.031 reflect
step 1777 ssq 9.0304-9.0309 reflect
step 1778 ssq 9.0304-9.0309 reflect
step 1779 ssq 9.0303-9.0309 expand
step 1780 ssq 9.0303-9.0309 expand
step 1781 ssq 9.03-9.0308 expand
step 1782 ssq 9.03-9.0308 reflect
step 1783 ssq 9.0299-9.0308 expand
step 1784 ssq 9.0299-9.0307 reflect
step 1785 ssq 9.0299-9.0306 reflect
step 1786 ssq 9.0299-9.0306 reflect
step 1787 ssq 9.0299-9.0305 reflect
step 1788 ssq 9.0299-9.0305 reflect
step 1789 ssq 9.0299-9.0304 reflect
step 1790 ssq 9.0299-9.0303 reflect
step 1791 ssq 9.0298-9.0303 reflect
step 1792 ssq 9.0296-9.0303 expand
step 1793 ssq 9.0296-9.0302 reflect
step 1794 ssq 9.0296-9.0302 reflect
step 1795 ssq 9.0296-9.0301 reflect
step 1796 ssq 9.0295-9.03 reflect
step 1797 ssq 9.0295-9.03 reflect
step 1798 ssq 9.0295-9.03 contract inside
step 1799 ssq 9.0295-9.03 reflect
step 1800 ssq 9.0295-9.0299 reflect
step 1801 ssq 9.0289-9.0299 expand
step 1802 ssq 9.0289-9.0298 reflect
step 1803 ssq 9.0289-9.0297 reflect
step 1804 ssq 9.0289-9.0297 reflect
step 1805 ssq 9.0289-9.0297 reflect
step 1806 ssq 9.0289-9.0297 reflect
step 1807 ssq 9.0289-9.0296 contract outside
step 1808 ssq 9.0289-9.0296 reflect
step 1809 ssq 9.0289-9.0296 reflect
step 1810 ssq 9.0285-9.0295 expand
step 1811 ssq 9.0285-9.0295 reflect
step 1812 ssq 9.0285-9.0295 reflect
step 1813 ssq 9.0284-9.0294 expand
step 1814 ssq 9.0284-9.0294 reflect
step 1815 ssq 9.0284-9.0293 reflect
step 1816 ssq 9.0284-9.0293 reflect
step 1817 ssq 9.0279-9.0291 expand
step 1818 ssq 9.0279-9.029 reflect
step 1819 ssq 9.0279-9.029 reflect
step 1820 ssq 9.0278-9.029 expand
step 1821 ssq 9.0278-9.0289 reflect
step 1822 ssq 9.0276-9.0289 reflect
step 1823 ssq 9.0276-9.0286 reflect
step 1824 ssq 9.0276-9.0285 reflect
step 1825 ssq 9.0276-9.0285 reflect
step 1826 ssq 9.0276-9.0285 reflect
step 1827 ssq 9.0275-9.0284 reflect
step 1828 ssq 9.0275-9.0284 reflect
step 1829 ssq 9.0274-9.0282 reflect
step 1830 ssq 9.0274-9.0282 reflect
step 1831 ssq 9.0274-9.0281 reflect
step 1832 ssq 9.0271-9.028 reflect
step 1833 ssq 9.0271-9.0279 reflect
step 1834 ssq 9.027-9.0279 reflect
step 1835 ssq 9.027-9.0278 reflect
step 1836 ssq 9.027-9.0277 reflect
step 1837 ssq 9.027-9.0277 reflect
step 1838 ssq 9.027-9.0276 reflect
step 1839 ssq 9.027-9.0276 reflect
step 1840 ssq 9.027-9.0275 reflect
step 1841 ssq 9.027-9.0275 reflect
step 1842 ssq 9.0267-9.0274 reflect
step 1843 ssq 9.0265-9.0273 reflect
step 1844 ssq 9.0265-9.0273 reflect
step 1845 ssq 9.0265-9.0272 contract inside
step 1846 ssq 9.0265-9.0271 reflect
step 1847 ssq 9.0265-9.0271 reflect
step 1848 ssq 9.0265-9.027 contract outside
step 1849 ssq 9.0265-9.027 contract inside
step 1850 ssq 9.0263-9.027 reflect
step 1851 ssq 9.0263-9.027 reflect
step 1852 ssq 9.0263-9.027 reflect
step 1853 ssq 9.0263-9.0268 reflect
step 1854 ssq 9.0263-9.0268 reflect
step 1855 ssq 9.0259-9.0268 expand
step 1856 ssq 9.0259-9.0268 reflect
step 1857 ssq 9.0259-9.0267 reflect
step 1858 ssq 9.0259-9.0267 contract inside
step 1859 ssq 9.0259-9.0267 contract inside
step 1860 ssq 9.0259-9.0267 reflect
step 1861 ssq 9.0258-9.0267 expand
step 1862 ssq 9.0258-9.0266 reflect
step 1863 ssq 9.0258-9.0265 reflect
step 1864 ssq 9.0258-9.0265 reflect
step 1865 ssq 9.0258-9.0265 reflect
step 1866 ssq 9.0257-9.0264 reflect
step 1867 ssq 9.0256-9.0264 expand
step 1868 ssq 9.0251-9.0263 expand
step 1869 ssq 9.0251-9.0263 reflect
step 1870 ssq 9.0251-9.0263 reflect
step 1871 ssq 9.0251-9.0262 reflect
step 1872 ssq 9.0251-9.0261 reflect
step 1873 ssq 9.0249-9.026 reflect
step 1874 ssq 9.0249-9.0259 reflect
step 1875 ssq 9.0249-9.0259 reflect
step 1876 ssq 9.0249-9.0258 reflect
step 1877 ssq 9.0247-9.0257 reflect
step 1878 ssq 9.0245-9.0256 reflect
step 1879 ssq 9.0245-9.0254 reflect
step 1880 ssq 9.0245-9.0252 reflect
step 1881 ssq 9.0245-9.0252 reflect
step 1882 ssq 9.0245-9.0251 reflect
step 1883 ssq 9.0245-9.0251 reflect
step 1884 ssq 9.0245-9.0251 reflect
step 1885 ssq 9.0243-9.025 reflect
step 1886 ssq 9.0243-9.025 reflect
step 1887 ssq 9.0242-9.0249 reflect
step 1888 ssq 9.0242-9.0249 reflect
step 1889 ssq 9.0242-9.0248 reflect
step 1890 ssq 9.0242-9.0248 reflect
step 1891 ssq 9.0242-9.0248 contract inside
step 1892 ssq 9.0242-9.0247 reflect
step 1893 ssq 9.0242-9.0247 reflect
step 1894 ssq 9.0242-9.0247 reflect
step 1895 ssq 9.0241-9.0246 reflect
step 1896 ssq 9.0241-9.0246 contract inside
step 1897 ssq 9.0241-9.0246 reflect
step 1898 ssq 9.0241-9.0245 reflect
step 1899 ssq 9.0241-9.0245 contract inside
step 1900 ssq 9.0241-9.0245 contract inside
step 1901 ssq 9.0241-9.0245 reflect
step 1902 ssq 9.0241-9.0245 contract inside
step 1903 ssq 9.0241-9.0244 reflect
step 1904 ssq 9.024-9.0244 reflect
step 1905 ssq 9.024-9.0243 contract outside
step 1906 ssq 9.024-9.0243 reflect
step 1907 ssq 9.024-9.0243 reflect
step 1908 ssq 9.024-9.0243 reflect
step 1909 ssq 9.024-9.0243 reflect
step 1910 ssq 9.024-9.0243 reflect
step 1911 ssq 9.024-9.0242 contract inside
step 1912 ssq 9.0239-9.0242 reflect
step 1913 ssq 9.0239-9.0242 reflect
step 1914 ssq 9.0239-9.0242 reflect
step 1915 ssq 9.0239-9.0242 reflect
step 1916 ssq 9.0239-9.0241 reflect
step 1917 ssq 9.0239-9.0241 contract inside
step 1918 ssq 9.0239-9.0241 reflect
step 1919 ssq 9.0239-9.0241 contract inside
step 1920 ssq 9.0239-9.0241 reflect
step 1921 ssq 9.0239-9.024 reflect
step 1922 ssq 9.0238-9.024 reflect
step 1923 ssq 9.0238-9.024 reflect
step 1924 ssq 9.0238-9.024 reflect
step 1925 ssq 9.0238-9.024 reflect
step 1926 ssq 9.0238-9.0239 reflect
step 1927 ssq 9.0236-9.0239 expand
step 1928 ssq 9.0236-9.0239 reflect
step 1929 ssq 9.0236-9.0239 reflect
step 1930 ssq 9.0236-9.0239 reflect
step 1931 ssq 9.0236-9.0239 reflect
step 1932 ssq 9.0236-9.0239 reflect
step 1933 ssq 9.0236-9.0239 reflect
step 1934 ssq 9.0236-9.0239 reflect
step 1935 ssq 9.0236-9.0238 reflect
step 1936 ssq 9.0236-9.0238 reflect
step 1937 ssq 9.0236-9.0238 reflect
step 1938 ssq 9.0236-9.0238 reflect
step 1939 ssq 9.0236-9.0238 reflect
step 1940 ssq 9.0235-9.0238 expand
step 1941 ssq 9.0235-9.0238 reflect
step 1942 ssq 9.0235-9.0237 reflect
step 1943 ssq 9.0235-9.0237 reflect
step 1944 ssq 9.0235-9.0237 contract outside
step 1945 ssq 9.0235-9.0237 reflect
step 1946 ssq 9.0235-9.0237 reflect
step 1947 ssq 9.0235-9.0237 reflect
step 1948 ssq 9.0235-9.0237 reflect
step 1949 ssq 9.0234-9.0236 reflect
step 1950 ssq 9.0234-9.0236 reflect
step 1951 ssq 9.0234-9.0236 reflect
step 1952 ssq 9.0234-9.0236 reflect
step 1953 ssq 9.0234-9.0236 reflect
step 1954 ssq 9.0234-9.0236 reflect
step 1955 ssq 9.0234-9.0236 reflect
step 1956 ssq 9.0234-9.0235 reflect
step 1957 ssq 9.0234-9.0235 reflect
step 1958 ssq 9.0234-9.0235 reflect
step 1959 ssq 9.0234-9.0235 reflect
step 1960 ssq 9.0234-9.0235 reflect
step 1961 ssq 9.0234-9.0235 contract inside
step 1962 ssq 9.0234-9.0235 reflect
step 1963 ssq 9.0234-9.0235 reflect
step 1964 ssq 9.0234-9.0235 contract inside
step 1965 ssq 9.0234-9.0235 reflect
step 1966 ssq 9.0234-9.0235 contract inside
step 1967 ssq 9.0234-9.0235 contract inside
step 1968 ssq 9.0234-9.0235 contract inside
step 1969 ssq 9.0234-9.0235 reflect
step 1970 ssq 9.0234-9.0234 contract inside
step 1971 ssq 9.0234-9.0234 contract inside
step 1972 ssq 9.0234-9.0234 reflect
step 1973 ssq 9.0234-9.0234 contract inside
step 1974 ssq 9.0234-9.0234 reflect
step 1975 ssq 9.0234-9.0234 reflect
step 1976 ssq 9.0234-9.0234 reflect
step 1977 ssq 9.0234-9.0234 reflect
step 1978 ssq 9.0233-9.0234 reflect
step 1979 ssq 9.0233-9.0234 contract inside
step 1980 ssq 9.0233-9.0234 reflect
step 1981 ssq 9.0233-9.0234 reflect
step 1982 ssq 9.0233-9.0234 reflect
step 1983 ssq 9.0233-9.0234 reflect
step 1984 ssq 9.0233-9.0234 reflect
step 1985 ssq 9.0233-9.0234 reflect
step 1986 ssq 9.0233-9.0234 reflect
step 1987 ssq 9.0233-9.0234 contract inside
step 1988 ssq 9.0233-9.0234 contract inside
step 1989 ssq 9.0233-9.0234 contract outside
step 1990 ssq 9.0233-9.0234 reflect
step 1991 ssq 9.0233-9.0234 reflect
step 1992 ssq 9.0233-9.0234 reflect
step 1993 ssq 9.0233-9.0233 reflect
step 1994 ssq 9.0233-9.0233 expand
step 1995 ssq 9.0233-9.0233 reflect
step 1996 ssq 9.0233-9.0233 reflect
step 1997 ssq 9.0233-9.0233 expand
step 1998 ssq 9.0233-9.0233 reflect
step 1999 ssq 9.0233-9.0233 reflect
step 2000 ssq 9.0232-9.0233 expand
step 2001 ssq 9.0232-9.0233 reflect
step 2002 ssq 9.0232-9.0233 reflect
step 2003 ssq 9.0232-9.0233 reflect
step 2004 ssq 9.0232-9.0233 reflect
step 2005 ssq 9.0232-9.0233 reflect
step 2006 ssq 9.0232-9.0233 reflect
step 2007 ssq 9.0232-9.0233 reflect
step 2008 ssq 9.0232-9.0233 reflect
step 2009 ssq 9.0232-9.0233 expand
step 2010 ssq 9.0232-9.0233 reflect
step 2011 ssq 9.0232-9.0233 reflect
step 2012 ssq 9.0232-9.0233 reflect
step 2013 ssq 9.0232-9.0233 reflect
step 2014 ssq 9.0232-9.0233 reflect
step 2015 ssq 9.0232-9.0233 reflect
step 2016 ssq 9.0232-9.0233 reflect
step 2017 ssq 9.0232-9.0232 reflect
step 2018 ssq 9.0232-9.0232 reflect
step 2019 ssq 9.0232-9.0232 reflect
step 2020 ssq 9.0231-9.0232 reflect
step 2021 ssq 9.0231-9.0232 expand
step 2022 ssq 9.0231-9.0232 reflect
step 2023 ssq 9.0231-9.0232 reflect
step 2024 ssq 9.0231-9.0232 reflect
step 2025 ssq 9.0231-9.0232 expand
step 2026 ssq 9.0231-9.0232 reflect
step 2027 ssq 9.0231-9.0232 reflect
step 2028 ssq 9.0231-9.0232 reflect
step 2029 ssq 9.023-9.0232 expand
step 2030 ssq 9.023-9.0232 reflect
step 2031 ssq 9.023-9.0232 reflect
step 2032 ssq 9.023-9.0231 reflect
step 2033 ssq 9.023-9.0231 reflect
step 2034 ssq 9.023-9.0231 reflect
step 2035 ssq 9.023-9.0231 reflect
step 2036 ssq 9.023-9.0231 reflect
step 2037 ssq 9.023-9.0231 reflect
step 2038 ssq 9.023-9.0231 reflect
step 2039 ssq 9.0229-9.0231 expand
step 2040 ssq 9.0229-9.0231 reflect
step 2041 ssq 9.0229-9.023 reflect
step 2042 ssq 9.0229-9.023 reflect
step 2043 ssq 9.0229-9.023 reflect
step 2044 ssq 9.0229-9.023 reflect
step 2045 ssq 9.0229-9.023 expand
step 2046 ssq 9.0229-9.023 reflect
step 2047 ssq 9.0228-9.023 reflect
step 2048 ssq 9.0228-9.023 contract inside
step 2049 ssq 9.0228-9.023 contract inside
step 2050 ssq 9.0228-9.023 contract inside
step 2051 ssq 9.0228-9.023 reflect
step 2052 ssq 9.0228-9.023 reflect
step 2053 ssq 9.0228-9.0229 reflect
step 2054 ssq 9.0228-9.0229 contract inside
step 2055 ssq 9.0228-9.0229 reflect
step 2056 ssq 9.0228-9.0229 reflect
step 2057 ssq 9.0228-9.0229 reflect
step 2058 ssq 9.0228-9.0229 contract inside
step 2059 ssq 9.0228-9.0229 reflect
step 2060 ssq 9.0228-9.0229 contract outside
step 2061 ssq 9.0228-9.0229 reflect
step 2062 ssq 9.0228-9.0229 contract inside
step 2063 ssq 9.0228-9.0229 expand
step 2064 ssq 9.0228-9.0229 reflect
step 2065 ssq 9.0228-9.0229 contract inside
step 2066 ssq 9.0228-9.0229 contract inside
step 2067 ssq 9.0228-9.0229 contract inside
step 2068 ssq 9.0228-9.0229 contract inside
step 2069 ssq 9.0228-9.0229 contract inside
step 2070 ssq 9.0228-9.0229 reflect
step 2071 ssq 9.0228-9.0229 contract inside
step 2072 ssq 9.0228-9.0229 reflect
step 2073 ssq 9.0228-9.0229 reflect
step 2074 ssq 9.0228-9.0229 contract inside
step 2075 ssq 9.0228-9.0229 contract inside
step 2076 ssq 9.0228-9.0229 reflect
step 2077 ssq 9.0228-9.0228 reflect
step 2078 ssq 9.0228-9.0228 contract inside
step 2079 ssq 9.0228-9.0228 reflect
step 2080 ssq 9.0228-9.0228 reflect
step 2081 ssq 9.0228-9.0228 reflect
step 2082 ssq 9.0228-9.0228 contract inside
step 2083 ssq 9.0228-9.0228 reflect
step 2084 ssq 9.0228-9.0228 reflect
step 2085 ssq 9.0228-9.0228 reflect
step 2086 ssq 9.0228-9.0228 reflect
step 2087 ssq 9.0228-9.0228 reflect
step 2088 ssq 9.0228-9.0228 reflect
step 2089 ssq 9.0228-9.0228 contract inside
step 2090 ssq 9.0228-9.0228 reflect
step 2091 ssq 9.0228-9.0228 contract inside
step 2092 ssq 9.0228-9.0228 reflect
step 2093 ssq 9.0227-9.0228 reflect
step 2094 ssq 9.0227-9.0228 reflect
step 2095 ssq 9.0227-9.0228 reflect
step 2096 ssq 9.0227-9.0228 reflect
step 2097 ssq 9.0227-9.0228 contract inside
step 2098 ssq 9.0227-9.0228 reflect
step 2099 ssq 9.0227-9.0228 reflect
step 2100 ssq 9.0227-9.0228 contract inside
step 2101 ssq 9.0227-9.0228 expand
step 2102 ssq 9.0227-9.0228 contract inside
step 2103 ssq 9.0227-9.0228 contract inside
step 2104 ssq 9.0227-9.0228 reflect
step 2105 ssq 9.0227-9.0228 reflect
step 2106 ssq 9.0227-9.0228 reflect
step 2107 ssq 9.0227-9.0228 reflect
step 2108 ssq 9.0227-9.0227 reflect
step 2109 ssq 9.0227-9.0227 reflect
step 2110 ssq 9.0227-9.0227 reflect
step 2111 ssq 9.0227-9.0227 reflect
step 2112 ssq 9.0227-9.0227 reflect
step 2113 ssq 9.0227-9.0227 contract inside
step 2114 ssq 9.0227-9.0227 contract inside
step 2115 ssq 9.0227-9.0227 reflect
step 2116 ssq 9.0227-9.0227 reflect
step 2117 ssq 9.0227-9.0227 reflect
step 2118 ssq 9.0227-9.0227 contract inside
step 2119 ssq 9.0227-9.0227 expand
step 2120 ssq 9.0227-9.0227 contract inside
step 2121 ssq 9.0227-9.0227 reflect
step 2122 ssq 9.0227-9.0227 reflect
step 2123 ssq 9.0227-9.0227 contract inside
step 2124 ssq 9.0227-9.0227 contract inside
step 2125 ssq 9.0227-9.0227 reflect
step 2126 ssq 9.0227-9.0227 reflect
step 2127 ssq 9.0227-9.0227 contract inside
step 2128 ssq 9.0227-9.0227 reflect
step 2129 ssq 9.0227-9.0227 reflect
step 2130 ssq 9.0227-9.0227 reflect
step 2131 ssq 9.0227-9.0227 contract inside
step 2132 ssq 9.0227-9.0227 reflect
step 2133 ssq 9.0227-9.0227 contract inside
step 2134 ssq 9.0227-9.0227 contract inside
step 2135 ssq 9.0227-9.0227 reflect
step 2136 ssq 9.0227-9.0227 reflect
step 2137 ssq 9.0227-9.0227 reflect
step 2138 ssq 9.0227-9.0227 reflect
step 2139 ssq 9.0227-9.0227 contract inside
step 2140 ssq 9.0227-9.0227 contract inside
step 2141 ssq 9.0227-9.0227 reflect
step 2142 ssq 9.0227-9.0227 reflect
step 2143 ssq 9.0227-9.0227 contract inside
step 2144 ssq 9.0227-9.0227 reflect
step 2145 ssq 9.0227-9.0227 reflect
step 2146 ssq 9.0227-9.0227 contract inside
step 2147 ssq 9.0227-9.0227 reflect
step 2148 ssq 9.0227-9.0227 contract inside
step 2149 ssq 9.0227-9.0227 contract outside
step 2150 ssq 9.0227-9.0227 contract inside
step 2151 ssq 9.0227-9.0227 contract inside
step 2152 ssq 9.0227-9.0227 reflect
step 2153 ssq 9.0227-9.0227 reflect
step 2154 ssq 9.0227-9.0227 reflect
step 2155 ssq 9.0227-9.0227 reflect
step 2156 ssq 9.0227-9.0227 reflect
step 2157 ssq 9.0227-9.0227 contract inside
step 2158 ssq 9.0227-9.0227 reflect
step 2159 ssq 9.0227-9.0227 contract inside
step 2160 ssq 9.0227-9.0227 contract inside
step 2161 ssq 9.0227-9.0227 expand
step 2162 ssq 9.0227-9.0227 contract inside
step 2163 ssq 9.0227-9.0227 reflect
step 2164 ssq 9.0227-9.0227 reflect
step 2165 ssq 9.0227-9.0227 contract inside
step 2166 ssq 9.0227-9.0227 contract inside
step 2167 ssq 9.0227-9.0227 reflect
step 2168 ssq 9.0227-9.0227 reflect
step 2169 ssq 9.0227-9.0227 reflect
step 2170 ssq 9.0227-9.0227 reflect
step 2171 ssq 9.0227-9.0227 reflect
step 2172 ssq 9.0227-9.0227 contract inside
step 2173 ssq 9.0227-9.0227 reflect
step 2174 ssq 9.0227-9.0227 reflect
step 2175 ssq 9.0227-9.0227 reflect
step 2176 ssq 9.0227-9.0227 reflect
step 2177 ssq 9.0227-9.0227 reflect
step 2178 ssq 9.0227-9.0227 expand
step 2179 ssq 9.0227-9.0227 reflect
step 2180 ssq 9.0227-9.0227 expand
step 2181 ssq 9.0227-9.0227 reflect
step 2182 ssq 9.0227-9.0227 reflect
step 2183 ssq 9.0227-9.0227 contract inside
step 2184 ssq 9.0227-9.0227 contract inside
step 2185 ssq 9.0227-9.0227 reflect
step 2186 ssq 9.0227-9.0227 reflect
step 2187 ssq 9.0227-9.0227 reflect
step 2188 ssq 9.0226-9.0227 expand
step 2189 ssq 9.0226-9.0227 expand
step 2190 ssq 9.0226-9.0227 reflect
step 2191 ssq 9.0226-9.0227 reflect
step 2192 ssq 9.0226-9.0227 reflect
step 2193 ssq 9.0226-9.0227 expand
step 2194 ssq 9.0226-9.0227 reflect
step 2195 ssq 9.0226-9.0227 contract inside
step 2196 ssq 9.0226-9.0227 reflect
step 2197 ssq 9.0226-9.0227 reflect
step 2198 ssq 9.0226-9.0227 reflect
step 2199 ssq 9.0226-9.0227 reflect
step 2200 ssq 9.0226-9.0226 reflect
step 2201 ssq 9.0226-9.0226 reflect
step 2202 ssq 9.0226-9.0226 reflect
step 2203 ssq 9.0226-9.0226 contract inside
step 2204 ssq 9.0226-9.0226 reflect
step 2205 ssq 9.0226-9.0226 reflect
step 2206 ssq 9.0226-9.0226 reflect
step 2207 ssq 9.0226-9.0226 contract inside
step 2208 ssq 9.0226-9.0226 contract outside
step 2209 ssq 9.0226-9.0226 expand
step 2210 ssq 9.0226-9.0226 reflect
step 2211 ssq 9.0226-9.0226 reflect
step 2212 ssq 9.0226-9.0226 reflect
step 2213 ssq 9.0226-9.0226 contract inside
step 2214 ssq 9.0226-9.0226 reflect
step 2215 ssq 9.0226-9.0226 reflect
step 2216 ssq 9.0226-9.0226 expand
step 2217 ssq 9.0226-9.0226 reflect
step 2218 ssq 9.0226-9.0226 reflect
step 2219 ssq 9.0226-9.0226 expand
step 2220 ssq 9.0226-9.0226 reflect
step 2221 ssq 9.0226-9.0226 reflect
step 2222 ssq 9.0226-9.0226 reflect
step 2223 ssq 9.0226-9.0226 reflect
step 2224 ssq 9.0226-9.0226 expand
step 2225 ssq 9.0226-9.0226 reflect
step 2226 ssq 9.0226-9.0226 reflect
step 2227 ssq 9.0226-9.0226 reflect
step 2228 ssq 9.0226-9.0226 reflect
step 2229 ssq 9.0226-9.0226 reflect
step 2230 ssq 9.0226-9.0226 reflect
step 2231 ssq 9.0226-9.0226 reflect
step 2232 ssq 9.0226-9.0226 contract inside
step 2233 ssq 9.0226-9.0226 reflect
step 2234 ssq 9.0226-9.0226 reflect
step 2235 ssq 9.0226-9.0226 reflect
step 2236 ssq 9.0226-9.0226 reflect
step 2237 ssq 9.0226-9.0226 reflect
step 2238 ssq 9.0226-9.0226 reflect
step 2239 ssq 9.0226-9.0226 reflect
step 2240 ssq 9.0226-9.0226 reflect
step 2241 ssq 9.0226-9.0226 expand
step 2242 ssq 9.0226-9.0226 contract inside
step 2243 ssq 9.0226-9.0226 reflect
step 2244 ssq 9.0226-9.0226 contract inside
step 2245 ssq 9.0226-9.0226 reflect
step 2246 ssq 9.0226-9.0226 reflect
step 2247 ssq 9.0226-9.0226 reflect
step 2248 ssq 9.0226-9.0226 reflect
step 2249 ssq 9.0226-9.0226 reflect
step 2250 ssq 9.0226-9.0226 reflect
step 2251 ssq 9.0226-9.0226 contract inside
step 2252 ssq 9.0226-9.0226 reflect
step 2253 ssq 9.0226-9.0226 reflect
step 2254 ssq 9.0226-9.0226 contract inside
step 2255 ssq 9.0226-9.0226 reflect
step 2256 ssq 9.0226-9.0226 reflect
step 2257 ssq 9.0226-9.0226 reflect
step 2258 ssq 9.0226-9.0226 reflect
step 2259 ssq 9.0226-9.0226 contract inside
step 2260 ssq 9.0226-9.0226 reflect
step 2261 ssq 9.0226-9.0226 contract inside
step 2262 ssq 9.0226-9.0226 reflect
step 2263 ssq 9.0226-9.0226 reflect
step 2264 ssq 9.0226-9.0226 reflect
step 2265 ssq 9.0226-9.0226 expand
step 2266 ssq 9.0226-9.0226 reflect
step 2267 ssq 9.0226-9.0226 reflect
step 2268 ssq 9.0226-9.0226 expand
step 2269 ssq 9.0226-9.0226 reflect
step 2270 ssq 9.0226-9.0226 reflect
step 2271 ssq 9.0226-9.0226 reflect
step 2272 ssq 9.0226-9.0226 reflect
step 2273 ssq 9.0226-9.0226 reflect
step 2274 ssq 9.0226-9.0226 contract inside
step 2275 ssq 9.0226-9.0226 reflect
step 2276 ssq 9.0226-9.0226 contract inside
step 2277 ssq 9.0226-9.0226 reflect
step 2278 ssq 9.0226-9.0226 reflect
step 2279 ssq 9.0226-9.0226 contract inside
step 2280 ssq 9.0226-9.0226 reflect
step 2281 ssq 9.0226-9.0226 expand
step 2282 ssq 9.0226-9.0226 expand
step 2283 ssq 9.0226-9.0226 reflect
step 2284 ssq 9.0226-9.0226 reflect
step 2285 ssq 9.0226-9.0226 reflect
step 2286 ssq 9.0226-9.0226 reflect
step 2287 ssq 9.0226-9.0226 reflect
step 2288 ssq 9.0226-9.0226 contract inside
step 2289 ssq 9.0226-9.0226 reflect
step 2290 ssq 9.0226-9.0226 contract inside
step 2291 ssq 9.0226-9.0226 reflect
step 2292 ssq 9.0226-9.0226 contract inside
step 2293 ssq 9.0226-9.0226 reflect
step 2294 ssq 9.0226-9.0226 reflect
step 2295 ssq 9.0226-9.0226 contract inside
step 2296 ssq 9.0226-9.0226 contract inside
step 2297 ssq 9.0226-9.0226 reflect
step 2298 ssq 9.0226-9.0226 contract inside
step 2299 ssq 9.0226-9.0226 reflect
step 2300 ssq 9.0226-9.0226 contract outside
step 2301 ssq 9.0226-9.0226 reflect
step 2302 ssq 9.0226-9.0226 contract inside
step 2303 ssq 9.0226-9.0226 reflect
step 2304 ssq 9.0226-9.0226 contract inside
step 2305 ssq 9.0226-9.0226 reflect
step 2306 ssq 9.0226-9.0226 reflect
step 2307 ssq 9.0226-9.0226 contract inside
step 2308 ssq 9.0226-9.0226 reflect
step 2309 ssq 9.0226-9.0226 reflect
step 2310 ssq 9.0226-9.0226 contract inside
step 2311 ssq 9.0226-9.0226 contract inside
step 2312 ssq 9.0226-9.0226 reflect
step 2313 ssq 9.0226-9.0226 contract outside
step 2314 ssq 9.0226-9.0226 reflect
step 2315 ssq 9.0226-9.0226 reflect
step 2316 ssq 9.0226-9.0226 contract inside
step 2317 ssq 9.0226-9.0226 reflect
step 2318 ssq 9.0226-9.0226 contract inside
step 2319 ssq 9.0226-9.0226 contract inside
step 2320 ssq 9.0226-9.0226 contract inside
step 2321 ssq 9.0226-9.0226 contract inside
step 2322 ssq 9.0226-9.0226 reflect
step 2323 ssq 9.0226-9.0226 reflect
step 2324 ssq 9.0226-9.0226 contract inside
step 2325 ssq 9.0226-9.0226 reflect
step 2326 ssq 9.0226-9.0226 reflect
step 2327 ssq 9.0226-9.0226 reflect
step 2328 ssq 9.0226-9.0226 reflect
step 2329 ssq 9.0226-9.0226 contract inside
step 2330 ssq 9.0226-9.0226 reflect
step 2331 ssq 9.0226-9.0226 contract inside
step 2332 ssq 9.0226-9.0226 reflect
step 2333 ssq 9.0226-9.0226 contract inside
step 2334 ssq 9.0226-9.0226 reflect
step 2335 ssq 9.0226-9.0226 contract inside
step 2336 ssq 9.0226-9.0226 contract inside
step 2337 ssq 9.0226-9.0226 contract inside
step 2338 ssq 9.0226-9.0226 reflect
step 2339 ssq 9.0226-9.0226 reflect
step 2340 ssq 9.0226-9.0226 contract inside
step 2341 ssq 9.0226-9.0226 reflect
step 2342 ssq 9.0226-9.0226 reflect
step 2343 ssq 9.0226-9.0226 reflect
step 2344 ssq 9.0226-9.0226 reflect
step 2345 ssq 9.0226-9.0226 reflect
step 2346 ssq 9.0226-9.0226 contract inside
step 2347 ssq 9.0226-9.0226 reflect
step 2348 ssq 9.0226-9.0226 reflect
step 2349 ssq 9.0226-9.0226 reflect
step 2350 ssq 9.0226-9.0226 contract inside
step 2351 ssq 9.0226-9.0226 contract inside
step 2352 ssq 9.0226-9.0226 reflect
step 2353 ssq 9.0226-9.0226 reflect
step 2354 ssq 9.0226-9.0226 contract inside
step 2355 ssq 9.0226-9.0226 reflect
step 2356 ssq 9.0226-9.0226 reflect
step 2357 ssq 9.0226-9.0226 reflect
step 2358 ssq 9.0226-9.0226 reflect
step 2359 ssq 9.0226-9.0226 reflect
step 2360 ssq 9.0226-9.0226 reflect
step 2361 ssq 9.0226-9.0226 reflect
step 2362 ssq 9.0226-9.0226 contract inside
step 2363 ssq 9.0226-9.0226 reflect
step 2364 ssq 9.0226-9.0226 reflect
step 2365 ssq 9.0226-9.0226 reflect
step 2366 ssq 9.0226-9.0226 contract outside
step 2367 ssq 9.0226-9.0226 reflect
step 2368 ssq 9.0226-9.0226 reflect
step 2369 ssq 9.0226-9.0226 reflect
step 2370 ssq 9.0226-9.0226 reflect
step 2371 ssq 9.0226-9.0226 reflect
step 2372 ssq 9.0226-9.0226 contract inside
step 2373 ssq 9.0226-9.0226 reflect
step 2374 ssq 9.0226-9.0226 reflect
step 2375 ssq 9.0226-9.0226 contract inside
step 2376 ssq 9.0226-9.0226 expand
step 2377 ssq 9.0226-9.0226 reflect
step 2378 ssq 9.0226-9.0226 reflect
step 2379 ssq 9.0226-9.0226 contract inside
step 2380 ssq 9.0226-9.0226 reflect
step 2381 ssq 9.0226-9.0226 reflect
step 2382 ssq 9.0226-9.0226 expand
step 2383 ssq 9.0226-9.0226 reflect
step 2384 ssq 9.0226-9.0226 reflect
step 2385 ssq 9.0226-9.0226 expand
step 2386 ssq 9.0226-9.0226 reflect
step 2387 ssq 9.0226-9.0226 reflect
step 2388 ssq 9.0226-9.0226 reflect
step 2389 ssq 9.0226-9.0226 reflect
step 2390 ssq 9.0226-9.0226 reflect
step 2391 ssq 9.0226-9.0226 reflect
step 2392 ssq 9.0226-9.0226 expand
step 2393 ssq 9.0226-9.0226 reflect
step 2394 ssq 9.0226-9.0226 reflect
step 2395 ssq 9.0226-9.0226 reflect
step 2396 ssq 9.0226-9.0226 reflect
step 2397 ssq 9.0226-9.0226 expand
step 2398 ssq 9.0226-9.0226 contract inside
step 2399 ssq 9.0226-9.0226 reflect
step 2400 ssq 9.0226-9.0226 reflect
step 2401 ssq 9.0226-9.0226 reflect
step 2402 ssq 9.0226-9.0226 reflect
step 2403 ssq 9.0226-9.0226 reflect
step 2404 ssq 9.0226-9.0226 expand
step 2405 ssq 9.0226-9.0226 contract inside
step 2406 ssq 9.0226-9.0226 reflect
step 2407 ssq 9.0226-9.0226 reflect
step 2408 ssq 9.0226-9.0226 reflect
step 2409 ssq 9.0226-9.0226 reflect
step 2410 ssq 9.0226-9.0226 reflect
step 2411 ssq 9.0226-9.0226 reflect
step 2412 ssq 9.0226-9.0226 expand
step 2413 ssq 9.0226-9.0226 contract inside
step 2414 ssq 9.0226-9.0226 reflect
step 2415 ssq 9.0226-9.0226 reflect
step 2416 ssq 9.0226-9.0226 reflect
step 2417 ssq 9.0226-9.0226 reflect
step 2418 ssq 9.0226-9.0226 reflect
step 2419 ssq 9.0226-9.0226 reflect
step 2420 ssq 9.0226-9.0226 reflect
step 2421 ssq 9.0226-9.0226 reflect
step 2422 ssq 9.0226-9.0226 reflect
step 2423 ssq 9.0226-9.0226 reflect
step 2424 ssq 9.0226-9.0226 reflect
step 2425 ssq 9.0226-9.0226 reflect
step 2426 ssq 9.0226-9.0226 reflect
step 2427 ssq 9.0226-9.0226 reflect
step 2428 ssq 9.0226-9.0226 reflect
step 2429 ssq 9.0226-9.0226 expand
step 2430 ssq 9.0226-9.0226 contract inside
step 2431 ssq 9.0226-9.0226 reflect
step 2432 ssq 9.0226-9.0226 reflect
step 2433 ssq 9.0226-9.0226 reflect
step 2434 ssq 9.0226-9.0226 contract outside
step 2435 ssq 9.0226-9.0226 reflect
step 2436 ssq 9.0226-9.0226 contract inside
step 2437 ssq 9.0226-9.0226 contract inside
step 2438 ssq 9.0226-9.0226 reflect
step 2439 ssq 9.0226-9.0226 reflect
step 2440 ssq 9.0226-9.0226 reflect
step 2441 ssq 9.0226-9.0226 contract inside
step 2442 ssq 9.0226-9.0226 reflect
step 2443 ssq 9.0226-9.0226 expand
step 2444 ssq 9.0226-9.0226 contract inside
step 2445 ssq 9.0226-9.0226 reflect
step 2446 ssq 9.0226-9.0226 reflect
step 2447 ssq 9.0226-9.0226 reflect
step 2448 ssq 9.0226-9.0226 reflect
step 2449 ssq 9.0226-9.0226 reflect
step 2450 ssq 9.0226-9.0226 reflect
step 2451 ssq 9.0226-9.0226 expand
step 2452 ssq 9.0226-9.0226 reflect
step 2453 ssq 9.0226-9.0226 reflect
step 2454 ssq 9.0226-9.0226 reflect
step 2455 ssq 9.0226-9.0226 contract inside
step 2456 ssq 9.0226-9.0226 contract inside
step 2457 ssq 9.0226-9.0226 reflect
step 2458 ssq 9.0226-9.0226 reflect
step 2459 ssq 9.0226-9.0226 reflect
step 2460 ssq 9.0226-9.0226 reflect
step 2461 ssq 9.0226-9.0226 reflect
step 2462 ssq 9.0226-9.0226 contract inside
step 2463 ssq 9.0226-9.0226 reflect
step 2464 ssq 9.0226-9.0226 contract inside
step 2465 ssq 9.0226-9.0226 contract outside
step 2466 ssq 9.0226-9.0226 expand
step 2467 ssq 9.0226-9.0226 contract inside
step 2468 ssq 9.0226-9.0226 contract inside
step 2469 ssq 9.0226-9.0226 contract inside
step 2470 ssq 9.0226-9.0226 reflect
step 2471 ssq 9.0226-9.0226 reflect
step 2472 ssq 9.0226-9.0226 reflect
step 2473 ssq 9.0226-9.0226 reflect
step 2474 ssq 9.0226-9.0226 contract inside
step 2475 ssq 9.0226-9.0226 reflect
step 2476 ssq 9.0226-9.0226 contract inside
step 2477 ssq 9.0226-9.0226 expand
step 2478 ssq 9.0226-9.0226 reflect
step 2479 ssq 9.0226-9.0226 reflect
step 2480 ssq 9.0226-9.0226 reflect
step 2481 ssq 9.0226-9.0226 reflect
step 2482 ssq 9.0226-9.0226 contract inside
step 2483 ssq 9.0226-9.0226 expand
step 2484 ssq 9.0226-9.0226 reflect
step 2485 ssq 9.0226-9.0226 reflect
step 2486 ssq 9.0226-9.0226 reflect
step 2487 ssq 9.0226-9.0226 reflect
step 2488 ssq 9.0226-9.0226 reflect
step 2489 ssq 9.0226-9.0226 reflect
step 2490 ssq 9.0226-9.0226 contract inside
step 2491 ssq 9.0226-9.0226 reflect
step 2492 ssq 9.0226-9.0226 contract inside
step 2493 ssq 9.0226-9.0226 expand
step 2494 ssq 9.0226-9.0226 reflect
step 2495 ssq 9.0226-9.0226 expand
step 2496 ssq 9.0226-9.0226 reflect
step 2497 ssq 9.0226-9.0226 reflect
step 2498 ssq 9.0226-9.0226 expand
step 2499 ssq 9.0226-9.0226 reflect
step 2500 ssq 9.0226-9.0226 reflect
step 2501 ssq 9.0226-9.0226 reflect
step 2502 ssq 9.0226-9.0226 reflect
step 2503 ssq 9.0226-9.0226 expand
step 2504 ssq 9.0226-9.0226 reflect
step 2505 ssq 9.0226-9.0226 reflect
step 2506 ssq 9.0226-9.0226 contract inside
step 2507 ssq 9.0226-9.0226 reflect
step 2508 ssq 9.0226-9.0226 reflect
step 2509 ssq 9.0226-9.0226 reflect
step 2510 ssq 9.0226-9.0226 reflect
step 2511 ssq 9.0226-9.0226 expand
step 2512 ssq 9.0226-9.0226 reflect
step 2513 ssq 9.0226-9.0226 reflect
step 2514 ssq 9.0226-9.0226 expand
step 2515 ssq 9.0226-9.0226 reflect
step 2516 ssq 9.0226-9.0226 reflect
step 2517 ssq 9.0226-9.0226 contract inside
step 2518 ssq 9.0226-9.0226 reflect
step 2519 ssq 9.0226-9.0226 reflect
step 2520 ssq 9.0226-9.0226 reflect
step 2521 ssq 9.0226-9.0226 reflect
step 2522 ssq 9.0226-9.0226 reflect
step 2523 ssq 9.0226-9.0226 reflect
step 2524 ssq 9.0226-9.0226 reflect
step 2525 ssq 9.0226-9.0226 reflect
step 2526 ssq 9.0226-9.0226 reflect
step 2527 ssq 9.0226-9.0226 reflect
step 2528 ssq 9.0226-9.0226 reflect
step 2529 ssq 9.0226-9.0226 contract inside
step 2530 ssq 9.0226-9.0226 reflect
step 2531 ssq 9.0226-9.0226 reflect
step 2532 ssq 9.0226-9.0226 reflect
step 2533 ssq 9.0226-9.0226 contract inside
step 2534 ssq 9.0226-9.0226 expand
step 2535 ssq 9.0226-9.0226 reflect
step 2536 ssq 9.0226-9.0226 reflect
step 2537 ssq 9.0226-9.0226 reflect
step 2538 ssq 9.0226-9.0226 reflect
step 2539 ssq 9.0226-9.0226 reflect
step 2540 ssq 9.0226-9.0226 expand
step 2541 ssq 9.0226-9.0226 reflect
step 2542 ssq 9.0226-9.0226 contract inside
step 2543 ssq 9.0226-9.0226 reflect
step 2544 ssq 9.0226-9.0226 reflect
step 2545 ssq 9.0226-9.0226 reflect
step 2546 ssq 9.0226-9.0226 reflect
step 2547 ssq 9.0226-9.0226 reflect
step 2548 ssq 9.0226-9.0226 expand
step 2549 ssq 9.0226-9.0226 reflect
step 2550 ssq 9.0226-9.0226 reflect
step 2551 ssq 9.0226-9.0226 reflect
step 2552 ssq 9.0226-9.0226 expand
step 2553 ssq 9.0226-9.0226 reflect
step 2554 ssq 9.0226-9.0226 expand
step 2555 ssq 9.0226-9.0226 expand
step 2556 ssq 9.0226-9.0226 reflect
step 2557 ssq 9.0226-9.0226 reflect
step 2558 ssq 9.0226-9.0226 reflect
step 2559 ssq 9.0226-9.0226 reflect
step 2560 ssq 9.0226-9.0226 expand
step 2561 ssq 9.0226-9.0226 reflect
step 2562 ssq 9.0226-9.0226 reflect
step 2563 ssq 9.0226-9.0226 expand
step 2564 ssq 9.0226-9.0226 reflect
step 2565 ssq 9.0226-9.0226 reflect
step 2566 ssq 9.0226-9.0226 reflect
step 2567 ssq 9.0226-9.0226 reflect
step 2568 ssq 9.0226-9.0226 expand
step 2569 ssq 9.0226-9.0226 expand
step 2570 ssq 9.0226-9.0226 reflect
step 2571 ssq 9.0226-9.0226 reflect
step 2572 ssq 9.0226-9.0226 reflect
step 2573 ssq 9.0226-9.0226 expand
step 2574 ssq 9.0226-9.0226 expand
step 2575 ssq 9.0226-9.0226 reflect
step 2576 ssq 9.0226-9.0226 reflect
step 2577 ssq 9.0226-9.0226 reflect
step 2578 ssq 9.0226-9.0226 reflect
step 2579 ssq 9.0226-9.0226 reflect
step 2580 ssq 9.0226-9.0226 reflect
step 2581 ssq 9.0226-9.0226 reflect
step 2582 ssq 9.0226-9.0226 reflect
step 2583 ssq 9.0226-9.0226 contract inside
step 2584 ssq 9.0226-9.0226 reflect
step 2585 ssq 9.0226-9.0226 reflect
step 2586 ssq 9.0226-9.0226 reflect
step 2587 ssq 9.0226-9.0226 reflect
step 2588 ssq 9.0226-9.0226 reflect
step 2589 ssq 9.0226-9.0226 contract inside
step 2590 ssq 9.0226-9.0226 reflect
step 2591 ssq 9.0226-9.0226 reflect
step 2592 ssq 9.0226-9.0226 reflect
step 2593 ssq 9.0226-9.0226 reflect
step 2594 ssq 9.0226-9.0226 reflect
step 2595 ssq 9.0226-9.0226 contract inside
step 2596 ssq 9.0226-9.0226 reflect
step 2597 ssq 9.0226-9.0226 contract inside
step 2598 ssq 9.0226-9.0226 reflect
step 2599 ssq 9.0226-9.0226 contract inside
step 2600 ssq 9.0226-9.0226 contract inside
step 2601 ssq 9.0226-9.0226 reflect
step 2602 ssq 9.0226-9.0226 reflect
step 2603 ssq 9.0226-9.0226 contract inside
step 2604 ssq 9.0226-9.0226 reflect
step 2605 ssq 9.0226-9.0226 contract inside
step 2606 ssq 9.0226-9.0226 reflect
step 2607 ssq 9.0226-9.0226 expand
step 2608 ssq 9.0226-9.0226 reflect
step 2609 ssq 9.0226-9.0226 contract inside
step 2610 ssq 9.0226-9.0226 reflect
step 2611 ssq 9.0226-9.0226 reflect
step 2612 ssq 9.0226-9.0226 reflect
step 2613 ssq 9.0226-9.0226 reflect
step 2614 ssq 9.0226-9.0226 reflect
step 2615 ssq 9.0226-9.0226 reflect
step 2616 ssq 9.0226-9.0226 reflect
step 2617 ssq 9.0226-9.0226 expand
step 2618 ssq 9.0226-9.0226 reflect
step 2619 ssq 9.0226-9.0226 reflect
step 2620 ssq 9.0226-9.0226 reflect
step 2621 ssq 9.0226-9.0226 expand
step 2622 ssq 9.0226-9.0226 reflect
step 2623 ssq 9.0226-9.0226 reflect
step 2624 ssq 9.0226-9.0226 reflect
step 2625 ssq 9.0226-9.0226 contract inside
step 2626 ssq 9.0226-9.0226 contract inside
step 2627 ssq 9.0226-9.0226 contract outside
step 2628 ssq 9.0226-9.0226 reflect
step 2629 ssq 9.0226-9.0226 contract inside
step 2630 ssq 9.0226-9.0226 expand
step 2631 ssq 9.0226-9.0226 reflect
step 2632 ssq 9.0226-9.0226 reflect
step 2633 ssq 9.0226-9.0226 reflect
step 2634 ssq 9.0226-9.0226 reflect
step 2635 ssq 9.0226-9.0226 reflect
step 2636 ssq 9.0226-9.0226 reflect
step 2637 ssq 9.0226-9.0226 reflect
step 2638 ssq 9.0226-9.0226 expand
step 2639 ssq 9.0226-9.0226 reflect
step 2640 ssq 9.0226-9.0226 reflect
step 2641 ssq 9.0226-9.0226 reflect
step 2642 ssq 9.0226-9.0226 reflect
step 2643 ssq 9.0226-9.0226 reflect
step 2644 ssq 9.0226-9.0226 expand
step 2645 ssq 9.0226-9.0226 contract inside
step 2646 ssq 9.0226-9.0226 expand
step 2647 ssq 9.0226-9.0226 reflect
step 2648 ssq 9.0226-9.0226 reflect
step 2649 ssq 9.0226-9.0226 reflect
step 2650 ssq 9.0226-9.0226 expand
step 2651 ssq 9.0226-9.0226 reflect
step 2652 ssq 9.0226-9.0226 reflect
step 2653 ssq 9.0226-9.0226 reflect
step 2654 ssq 9.0226-9.0226 reflect
step 2655 ssq 9.0226-9.0226 expand
step 2656 ssq 9.0226-9.0226 reflect
step 2657 ssq 9.0226-9.0226 reflect
step 2658 ssq 9.0226-9.0226 expand
step 2659 ssq 9.0226-9.0226 reflect
step 2660 ssq 9.0226-9.0226 reflect
step 2661 ssq 9.0226-9.0226 expand
step 2662 ssq 9.0226-9.0226 reflect
step 2663 ssq 9.0226-9.0226 reflect
step 2664 ssq 9.0226-9.0226 reflect
step 2665 ssq 9.0226-9.0226 reflect
step 2666 ssq 9.0226-9.0226 reflect
step 2667 ssq 9.0226-9.0226 expand
step 2668 ssq 9.0226-9.0226 reflect
step 2669 ssq 9.0226-9.0226 reflect
step 2670 ssq 9.0226-9.0226 reflect
step 2671 ssq 9.0226-9.0226 reflect
step 2672 ssq 9.0226-9.0226 expand
step 2673 ssq 9.0226-9.0226 reflect
step 2674 ssq 9.0226-9.0226 reflect
step 2675 ssq 9.0226-9.0226 reflect
step 2676 ssq 9.0226-9.0226 reflect
step 2677 ssq 9.0226-9.0226 contract outside
step 2678 ssq 9.0226-9.0226 reflect
step 2679 ssq 9.0226-9.0226 reflect
step 2680 ssq 9.0226-9.0226 expand
step 2681 ssq 9.0226-9.0226 reflect
step 2682 ssq 9.0226-9.0226 reflect
step 2683 ssq 9.0226-9.0226 reflect
step 2684 ssq 9.0226-9.0226 reflect
step 2685 ssq 9.0226-9.0226 expand
step 2686 ssq 9.0226-9.0226 reflect
step 2687 ssq 9.0226-9.0226 reflect
step 2688 ssq 9.0226-9.0226 reflect
step 2689 ssq 9.0226-9.0226 reflect
step 2690 ssq 9.0226-9.0226 contract inside
step 2691 ssq 9.0226-9.0226 reflect
step 2692 ssq 9.0226-9.0226 reflect
step 2693 ssq 9.0226-9.0226 reflect
step 2694 ssq 9.0226-9.0226 expand
step 2695 ssq 9.0226-9.0226 reflect
step 2696 ssq 9.0226-9.0226 reflect
step 2697 ssq 9.0226-9.0226 expand
step 2698 ssq 9.0226-9.0226 reflect
step 2699 ssq 9.0226-9.0226 reflect
step 2700 ssq 9.0226-9.0226 reflect
step 2701 ssq 9.0226-9.0226 expand
step 2702 ssq 9.0226-9.0226 reflect
step 2703 ssq 9.0226-9.0226 reflect
step 2704 ssq 9.0226-9.0226 reflect
step 2705 ssq 9.0226-9.0226 reflect
step 2706 ssq 9.0226-9.0226 reflect
step 2707 ssq 9.0226-9.0226 reflect
step 2708 ssq 9.0226-9.0226 reflect
step 2709 ssq 9.0226-9.0226 reflect
step 2710 ssq 9.0226-9.0226 reflect
step 2711 ssq 9.0226-9.0226 reflect
step 2712 ssq 9.0226-9.0226 reflect
step 2713 ssq 9.0226-9.0226 reflect
step 2714 ssq 9.0226-9.0226 reflect
step 2715 ssq 9.0226-9.0226 expand
step 2716 ssq 9.0226-9.0226 reflect
step 2717 ssq 9.0226-9.0226 reflect
step 2718 ssq 9.0226-9.0226 reflect
step 2719 ssq 9.0226-9.0226 expand
step 2720 ssq 9.0226-9.0226 reflect
step 2721 ssq 9.0226-9.0226 reflect
step 2722 ssq 9.0226-9.0226 reflect
step 2723 ssq 9.0226-9.0226 reflect
step 2724 ssq 9.0226-9.0226 reflect
step 2725 ssq 9.0226-9.0226 reflect
step 2726 ssq 9.0226-9.0226 reflect
step 2727 ssq 9.0226-9.0226 reflect
step 2728 ssq 9.0226-9.0226 reflect
step 2729 ssq 9.0226-9.0226 reflect
step 2730 ssq 9.0226-9.0226 reflect
step 2731 ssq 9.0226-9.0226 reflect
step 2732 ssq 9.0226-9.0226 reflect
step 2733 ssq 9.0226-9.0226 reflect
step 2734 ssq 9.0226-9.0226 reflect
step 2735 ssq 9.0226-9.0226 reflect
step 2736 ssq 9.0226-9.0226 reflect
step 2737 ssq 9.0226-9.0226 reflect
step 2738 ssq 9.0226-9.0226 reflect
step 2739 ssq 9.0226-9.0226 reflect
step 2740 ssq 9.0226-9.0226 reflect
step 2741 ssq 9.0226-9.0226 reflect
step 2742 ssq 9.0226-9.0226 reflect
step 2743 ssq 9.0226-9.0226 reflect
step 2744 ssq 9.0226-9.0226 reflect
step 2745 ssq 9.0226-9.0226 contract inside
step 2746 ssq 9.0226-9.0226 contract inside
step 2747 ssq 9.0226-9.0226 expand
step 2748 ssq 9.0226-9.0226 reflect
step 2749 ssq 9.0226-9.0226 reflect
step 2750 ssq 9.0226-9.0226 reflect
step 2751 ssq 9.0226-9.0226 reflect
step 2752 ssq 9.0226-9.0226 reflect
step 2753 ssq 9.0226-9.0226 contract inside
step 2754 ssq 9.0226-9.0226 reflect
step 2755 ssq 9.0226-9.0226 contract outside
step 2756 ssq 9.0226-9.0226 reflect
step 2757 ssq 9.0226-9.0226 reflect
step 2758 ssq 9.0226-9.0226 reflect
step 2759 ssq 9.0226-9.0226 reflect
step 2760 ssq 9.0226-9.0226 contract inside
step 2761 ssq 9.0226-9.0226 contract inside
step 2762 ssq 9.0226-9.0226 reflect
step 2763 ssq 9.0226-9.0226 reflect
step 2764 ssq 9.0226-9.0226 reflect
step 2765 ssq 9.0226-9.0226 reflect
step 2766 ssq 9.0226-9.0226 reflect
step 2767 ssq 9.0226-9.0226 contract inside
step 2768 ssq 9.0226-9.0226 contract inside
step 2769 ssq 9.0226-9.0226 contract inside
step 2770 ssq 9.0226-9.0226 reflect
step 2771 ssq 9.0226-9.0226 contract inside
step 2772 ssq 9.0226-9.0226 reflect
step 2773 ssq 9.0226-9.0226 contract inside
step 2774 ssq 9.0226-9.0226 contract inside
step 2775 ssq 9.0226-9.0226 reflect
step 2776 ssq 9.0226-9.0226 reflect
step 2777 ssq 9.0226-9.0226 reflect
step 2778 ssq 9.0226-9.0226 reflect
step 2779 ssq 9.0226-9.0226 reflect
step 2780 ssq 9.0226-9.0226 reflect
step 2781 ssq 9.0226-9.0226 contract inside
step 2782 ssq 9.0226-9.0226 reflect
step 2783 ssq 9.0226-9.0226 contract inside
step 2784 ssq 9.0226-9.0226 reflect
step 2785 ssq 9.0226-9.0226 reflect
step 2786 ssq 9.0226-9.0226 reflect
step 2787 ssq 9.0226-9.0226 reflect
step 2788 ssq 9.0226-9.0226 contract inside
step 2789 ssq 9.0226-9.0226 reflect
step 2790 ssq 9.0226-9.0226 contract inside
step 2791 ssq 9.0226-9.0226 reflect
step 2792 ssq 9.0226-9.0226 reflect
step 2793 ssq 9.0226-9.0226 reflect
step 2794 ssq 9.0226-9.0226 contract inside
step 2795 ssq 9.0226-9.0226 reflect
step 2796 ssq 9.0226-9.0226 reflect
step 2797 ssq 9.0226-9.0226 reflect
step 2798 ssq 9.0226-9.0226 reflect
step 2799 ssq 9.0226-9.0226 contract inside
step 2800 ssq 9.0226-9.0226 reflect
step 2801 ssq 9.0226-9.0226 reflect
step 2802 ssq 9.0226-9.0226 contract inside
step 2803 ssq 9.0226-9.0226 reflect
step 2804 ssq 9.0226-9.0226 reflect
step 2805 ssq 9.0226-9.0226 contract inside
step 2806 ssq 9.0226-9.0226 contract inside
step 2807 ssq 9.0226-9.0226 contract inside
step 2808 ssq 9.0226-9.0226 contract inside
step 2809 ssq 9.0226-9.0226 contract inside
step 2810 ssq 9.0226-9.0226 reflect
step 2811 ssq 9.0226-9.0226 reflect
step 2812 ssq 9.0226-9.0226 contract inside
step 2813 ssq 9.0226-9.0226 reflect
step 2814 ssq 9.0226-9.0226 reflect
step 2815 ssq 9.0226-9.0226 contract inside
step 2816 ssq 9.0226-9.0226 contract inside
step 2817 ssq 9.0226-9.0226 contract inside
step 2818 ssq 9.0226-9.0226 reflect
step 2819 ssq 9.0226-9.0226 reflect
step 2820 ssq 9.0226-9.0226 reflect
step 2821 ssq 9.0226-9.0226 contract inside
step 2822 ssq 9.0226-9.0226 contract inside
step 2823 ssq 9.0226-9.0226 contract inside
step 2824 ssq 9.0226-9.0226 contract inside
step 2825 ssq 9.0226-9.0226 reflect
step 2826 ssq 9.0226-9.0226 contract inside
step 2827 ssq 9.0226-9.0226 contract inside
step 2828 ssq 9.0226-9.0226 contract inside
step 2829 ssq 9.0226-9.0226 contract inside
step 2830 ssq 9.0226-9.0226 contract inside
step 2831 ssq 9.0226-9.0226 reflect
step 2832 ssq 9.0226-9.0226 contract outside
step 2833 ssq 9.0226-9.0226 contract inside
step 2834 ssq 9.0226-9.0226 reflect
step 2835 ssq 9.0226-9.0226 reflect
step 2836 ssq 9.0226-9.0226 reflect
step 2837 ssq 9.0226-9.0226 reflect
step 2838 ssq 9.0226-9.0226 reflect
step 2839 ssq 9.0226-9.0226 reflect
step 2840 ssq 9.0226-9.0226 reflect
step 2841 ssq 9.0226-9.0226 reflect
step 2842 ssq 9.0226-9.0226 reflect
step 2843 ssq 9.0226-9.0226 reflect
step 2844 ssq 9.0226-9.0226 expand
step 2845 ssq 9.0226-9.0226 reflect
step 2846 ssq 9.0226-9.0226 reflect
step 2847 ssq 9.0226-9.0226 expand
step 2848 ssq 9.0226-9.0226 reflect
step 2849 ssq 9.0226-9.0226 reflect
step 2850 ssq 9.0226-9.0226 reflect
step 2851 ssq 9.0226-9.0226 reflect
step 2852 ssq 9.0226-9.0226 reflect
step 2853 ssq 9.0226-9.0226 reflect
step 2854 ssq 9.0226-9.0226 reflect
step 2855 ssq 9.0226-9.0226 reflect
step 2856 ssq 9.0226-9.0226 contract inside
step 2857 ssq 9.0226-9.0226 reflect
step 2858 ssq 9.0226-9.0226 reflect
step 2859 ssq 9.0226-9.0226 reflect
step 2860 ssq 9.0226-9.0226 reflect
step 2861 ssq 9.0226-9.0226 reflect
step 2862 ssq 9.0226-9.0226 expand
step 2863 ssq 9.0226-9.0226 expand
step 2864 ssq 9.0226-9.0226 reflect
step 2865 ssq 9.0226-9.0226 reflect
step 2866 ssq 9.0226-9.0226 reflect
step 2867 ssq 9.0226-9.0226 reflect
step 2868 ssq 9.0226-9.0226 reflect
step 2869 ssq 9.0226-9.0226 reflect
step 2870 ssq 9.0226-9.0226 expand
step 2871 ssq 9.0226-9.0226 expand
step 2872 ssq 9.0226-9.0226 reflect
step 2873 ssq 9.0226-9.0226 reflect
step 2874 ssq 9.0226-9.0226 reflect
step 2875 ssq 9.0226-9.0226 reflect
step 2876 ssq 9.0226-9.0226 reflect
step 2877 ssq 9.0226-9.0226 expand
step 2878 ssq 9.0226-9.0226 reflect
step 2879 ssq 9.0226-9.0226 reflect
step 2880 ssq 9.0226-9.0226 reflect
step 2881 ssq 9.0226-9.0226 expand
step 2882 ssq 9.0226-9.0226 expand
step 2883 ssq 9.0226-9.0226 reflect
step 2884 ssq 9.0226-9.0226 reflect
step 2885 ssq 9.0226-9.0226 reflect
step 2886 ssq 9.0226-9.0226 reflect
step 2887 ssq 9.0226-9.0226 reflect
step 2888 ssq 9.0226-9.0226 expand
step 2889 ssq 9.0226-9.0226 reflect
step 2890 ssq 9.0226-9.0226 expand
step 2891 ssq 9.0226-9.0226 reflect
step 2892 ssq 9.0226-9.0226 reflect
step 2893 ssq 9.0226-9.0226 reflect
step 2894 ssq 9.0226-9.0226 reflect
step 2895 ssq 9.0226-9.0226 reflect
step 2896 ssq 9.0226-9.0226 expand
step 2897 ssq 9.0226-9.0226 reflect
step 2898 ssq 9.0226-9.0226 reflect
step 2899 ssq 9.0226-9.0226 expand
step 2900 ssq 9.0226-9.0226 reflect
step 2901 ssq 9.0226-9.0226 reflect
step 2902 ssq 9.0226-9.0226 reflect
step 2903 ssq 9.0226-9.0226 expand
step 2904 ssq 9.0226-9.0226 reflect
step 2905 ssq 9.0226-9.0226 reflect
step 2906 ssq 9.0226-9.0226 expand
step 2907 ssq 9.0226-9.0226 reflect
step 2908 ssq 9.0226-9.0226 expand
step 2909 ssq 9.0226-9.0226 expand
step 2910 ssq 9.0226-9.0226 reflect
step 2911 ssq 9.0226-9.0226 reflect
step 2912 ssq 9.0226-9.0226 reflect
step 2913 ssq 9.0226-9.0226 expand
step 2914 ssq 9.0226-9.0226 reflect
step 2915 ssq 9.0226-9.0226 reflect
step 2916 ssq 9.0226-9.0226 reflect
step 2917 ssq 9.0226-9.0226 reflect
step 2918 ssq 9.0226-9.0226 reflect
step 2919 ssq 9.0226-9.0226 reflect
step 2920 ssq 9.0226-9.0226 reflect
step 2921 ssq 9.0226-9.0226 reflect
step 2922 ssq 9.0226-9.0226 reflect
step 2923 ssq 9.0226-9.0226 reflect
step 2924 ssq 9.0226-9.0226 contract inside
step 2925 ssq 9.0226-9.0226 contract inside
step 2926 ssq 9.0226-9.0226 reflect
step 2927 ssq 9.0226-9.0226 reflect
step 2928 ssq 9.0226-9.0226 expand
step 2929 ssq 9.0226-9.0226 reflect
step 2930 ssq 9.0226-9.0226 reflect
step 2931 ssq 9.0226-9.0226 expand
step 2932 ssq 9.0226-9.0226 reflect
step 2933 ssq 9.0226-9.0226 reflect
step 2934 ssq 9.0226-9.0226 reflect
step 2935 ssq 9.0226-9.0226 expand
step 2936 ssq 9.0226-9.0226 reflect
step 2937 ssq 9.0226-9.0226 reflect
step 2938 ssq 9.0226-9.0226 reflect
step 2939 ssq 9.0226-9.0226 reflect
step 2940 ssq 9.0226-9.0226 reflect
step 2941 ssq 9.0226-9.0226 reflect
step 2942 ssq 9.0226-9.0226 reflect
step 2943 ssq 9.0226-9.0226 reflect
step 2944 ssq 9.0226-9.0226 reflect
step 2945 ssq 9.0226-9.0226 reflect
step 2946 ssq 9.0226-9.0226 expand
step 2947 ssq 9.0226-9.0226 expand
step 2948 ssq 9.0226-9.0226 reflect
step 2949 ssq 9.0226-9.0226 reflect
step 2950 ssq 9.0226-9.0226 reflect
step 2951 ssq 9.0226-9.0226 expand
step 2952 ssq 9.0226-9.0226 reflect
step 2953 ssq 9.0226-9.0226 expand
step 2954 ssq 9.0226-9.0226 reflect
step 2955 ssq 9.0226-9.0226 reflect
step 2956 ssq 9.0226-9.0226 contract inside
step 2957 ssq 9.0226-9.0226 reflect
step 2958 ssq 9.0226-9.0226 reflect
step 2959 ssq 9.0226-9.0226 reflect
step 2960 ssq 9.0226-9.0226 contract inside
step 2961 ssq 9.0226-9.0226 reflect
step 2962 ssq 9.0226-9.0226 reflect
step 2963 ssq 9.0226-9.0226 contract inside
step 2964 ssq 9.0226-9.0226 reflect
step 2965 ssq 9.0226-9.0226 reflect
step 2966 ssq 9.0226-9.0226 expand
step 2967 ssq 9.0226-9.0226 reflect
step 2968 ssq 9.0226-9.0226 reflect
step 2969 ssq 9.0226-9.0226 reflect
step 2970 ssq 9.0226-9.0226 reflect
step 2971 ssq 9.0226-9.0226 reflect
step 2972 ssq 9.0226-9.0226 expand
step 2973 ssq 9.0226-9.0226 reflect
step 2974 ssq 9.0226-9.0226 contract inside
step 2975 ssq 9.0226-9.0226 contract inside
step 2976 ssq 9.0226-9.0226 reflect
step 2977 ssq 9.0226-9.0226 reflect
step 2978 ssq 9.0226-9.0226 reflect
step 2979 ssq 9.0226-9.0226 reflect
step 2980 ssq 9.0226-9.0226 reflect
step 2981 ssq 9.0226-9.0226 reflect
step 2982 ssq 9.0226-9.0226 reflect
step 2983 ssq 9.0226-9.0226 expand
step 2984 ssq 9.0226-9.0226 reflect
step 2985 ssq 9.0226-9.0226 reflect
step 2986 ssq 9.0226-9.0226 reflect
step 2987 ssq 9.0226-9.0226 reflect
step 2988 ssq 9.0226-9.0226 reflect
step 2989 ssq 9.0226-9.0226 reflect
step 2990 ssq 9.0226-9.0226 reflect
step 2991 ssq 9.0226-9.0226 contract inside
step 2992 ssq 9.0226-9.0226 reflect
step 2993 ssq 9.0226-9.0226 reflect
step 2994 ssq 9.0226-9.0226 reflect
step 2995 ssq 9.0226-9.0226 expand
step 2996 ssq 9.0226-9.0226 reflect
step 2997 ssq 9.0226-9.0226 reflect
step 2998 ssq 9.0226-9.0226 reflect
step 2999 ssq 9.0226-9.0226 contract inside
step 3000 ssq 9.0226-9.0226 reflect
step 3001 ssq 9.0226-9.0226 reflect
step 3002 ssq 9.0226-9.0226 reflect
step 3003 ssq 9.0226-9.0226 reflect
step 3004 ssq 9.0226-9.0226 reflect
step 3005 ssq 9.0226-9.0226 reflect
step 3006 ssq 9.0226-9.0226 reflect
step 3007 ssq 9.0226-9.0226 reflect
step 3008 ssq 9.0226-9.0226 reflect
step 3009 ssq 9.0226-9.0226 reflect
step 3010 ssq 9.0226-9.0226 reflect
step 3011 ssq 9.0226-9.0226 reflect
step 3012 ssq 9.0226-9.0226 reflect
step 3013 ssq 9.0226-9.0226 reflect
step 3014 ssq 9.0226-9.0226 contract inside
step 3015 ssq 9.0226-9.0226 reflect
step 3016 ssq 9.0226-9.0226 reflect
step 3017 ssq 9.0226-9.0226 contract inside
step 3018 ssq 9.0226-9.0226 contract inside
step 3019 ssq 9.0226-9.0226 reflect
step 3020 ssq 9.0226-9.0226 reflect
step 3021 ssq 9.0226-9.0226 contract inside
step 3022 ssq 9.0226-9.0226 contract inside
step 3023 ssq 9.0226-9.0226 contract inside
step 3024 ssq 9.0226-9.0226 contract inside
step 3025 ssq 9.0226-9.0226 reflect
step 3026 ssq 9.0226-9.0226 reflect
step 3027 ssq 9.0226-9.0226 contract inside
step 3028 ssq 9.0226-9.0226 reflect
step 3029 ssq 9.0226-9.0226 contract inside
step 3030 ssq 9.0226-9.0226 reflect
step 3031 ssq 9.0226-9.0226 reflect
step 3032 ssq 9.0226-9.0226 reflect
step 3033 ssq 9.0226-9.0226 reflect
step 3034 ssq 9.0226-9.0226 reflect
step 3035 ssq 9.0226-9.0226 reflect
step 3036 ssq 9.0226-9.0226 expand
step 3037 ssq 9.0226-9.0226 contract inside
step 3038 ssq 9.0226-9.0226 reflect
step 3039 ssq 9.0226-9.0226 contract inside
step 3040 ssq 9.0226-9.0226 reflect
step 3041 ssq 9.0226-9.0226 reflect
step 3042 ssq 9.0226-9.0226 reflect
step 3043 ssq 9.0226-9.0226 reflect
step 3044 ssq 9.0226-9.0226 reflect
step 3045 ssq 9.0226-9.0226 reflect
step 3046 ssq 9.0226-9.0226 reflect
step 3047 ssq 9.0226-9.0226 reflect
step 3048 ssq 9.0226-9.0226 contract inside
step 3049 ssq 9.0226-9.0226 reflect
step 3050 ssq 9.0226-9.0226 reflect
step 3051 ssq 9.0226-9.0226 contract inside
step 3052 ssq 9.0226-9.0226 contract inside
step 3053 ssq 9.0226-9.0226 contract inside
step 3054 ssq 9.0226-9.0226 contract inside
step 3055 ssq 9.0226-9.0226 reflect
step 3056 ssq 9.0226-9.0226 reflect
step 3057 ssq 9.0226-9.0226 reflect
step 3058 ssq 9.0226-9.0226 contract inside
step 3059 ssq 9.0226-9.0226 contract inside
step 3060 ssq 9.0226-9.0226 reflect
step 3061 ssq 9.0226-9.0226 contract outside
step 3062 ssq 9.0226-9.0226 contract inside
step 3063 ssq 9.0226-9.0226 reflect
step 3064 ssq 9.0226-9.0226 reflect
step 3065 ssq 9.0226-9.0226 reflect
step 3066 ssq 9.0226-9.0226 reflect
step 3067 ssq 9.0226-9.0226 expand
step 3068 ssq 9.0226-9.0226 reflect
step 3069 ssq 9.0226-9.0226 contract inside
step 3070 ssq 9.0226-9.0226 contract inside
step 3071 ssq 9.0226-9.0226 reflect
step 3072 ssq 9.0226-9.0226 reflect
step 3073 ssq 9.0226-9.0226 reflect
step 3074 ssq 9.0226-9.0226 contract inside
step 3075 ssq 9.0226-9.0226 reflect
step 3076 ssq 9.0226-9.0226 reflect
step 3077 ssq 9.0226-9.0226 reflect
step 3078 ssq 9.0226-9.0226 contract inside
step 3079 ssq 9.0226-9.0226 reflect
step 3080 ssq 9.0226-9.0226 reflect
step 3081 ssq 9.0226-9.0226 contract inside
step 3082 ssq 9.0226-9.0226 contract inside
step 3083 ssq 9.0226-9.0226 reflect
step 3084 ssq 9.0226-9.0226 reflect
step 3085 ssq 9.0226-9.0226 reflect
step 3086 ssq 9.0226-9.0226 contract inside
step 3087 ssq 9.0226-9.0226 reflect
step 3088 ssq 9.0226-9.0226 reflect
step 3089 ssq 9.0226-9.0226 contract inside
step 3090 ssq 9.0226-9.0226 expand
step 3091 ssq 9.0226-9.0226 reflect
step 3092 ssq 9.0226-9.0226 contract inside
step 3093 ssq 9.0226-9.0226 reflect
step 3094 ssq 9.0226-9.0226 reflect
step 3095 ssq 9.0226-9.0226 reflect
step 3096 ssq 9.0226-9.0226 reflect
step 3097 ssq 9.0226-9.0226 reflect
step 3098 ssq 9.0226-9.0226 reflect
step 3099 ssq 9.0226-9.0226 contract inside
step 3100 ssq 9.0226-9.0226 reflect
step 3101 ssq 9.0226-9.0226 reflect
step 3102 ssq 9.0226-9.0226 expand
step 3103 ssq 9.0226-9.0226 contract inside
step 3104 ssq 9.0226-9.0226 reflect
step 3105 ssq 9.0226-9.0226 reflect
step 3106 ssq 9.0226-9.0226 reflect
step 3107 ssq 9.0226-9.0226 contract outside
step 3108 ssq 9.0226-9.0226 reflect
step 3109 ssq 9.0226-9.0226 contract inside
step 3110 ssq 9.0226-9.0226 reflect
step 3111 ssq 9.0226-9.0226 reflect
step 3112 ssq 9.0226-9.0226 reflect
step 3113 ssq 9.0226-9.0226 reflect
step 3114 ssq 9.0226-9.0226 reflect
step 3115 ssq 9.0226-9.0226 expand
step 3116 ssq 9.0226-9.0226 reflect
step 3117 ssq 9.0226-9.0226 reflect
step 3118 ssq 9.0226-9.0226 reflect
step 3119 ssq 9.0226-9.0226 reflect
step 3120 ssq 9.0226-9.0226 reflect
step 3121 ssq 9.0226-9.0226 contract inside
step 3122 ssq 9.0226-9.0226 reflect
step 3123 ssq 9.0226-9.0226 reflect
step 3124 ssq 9.0226-9.0226 reflect
step 3125 ssq 9.0226-9.0226 reflect
step 3126 ssq 9.0226-9.0226 expand
step 3127 ssq 9.0226-9.0226 contract inside
step 3128 ssq 9.0226-9.0226 reflect
step 3129 ssq 9.0226-9.0226 reflect
step 3130 ssq 9.0226-9.0226 reflect
step 3131 ssq 9.0226-9.0226 reflect
step 3132 ssq 9.0226-9.0226 reflect
step 3133 ssq 9.0226-9.0226 reflect
step 3134 ssq 9.0226-9.0226 contract inside
step 3135 ssq 9.0226-9.0226 reflect
step 3136 ssq 9.0226-9.0226 reflect
step 3137 ssq 9.0226-9.0226 contract inside
step 3138 ssq 9.0226-9.0226 contract inside
step 3139 ssq 9.0226-9.0226 contract inside
step 3140 ssq 9.0226-9.0226 contract inside
step 3141 ssq 9.0226-9.0226 contract inside
step 3142 ssq 9.0226-9.0226 reflect
step 3143 ssq 9.0226-9.0226 contract outside
step 3144 ssq 9.0226-9.0226 contract inside
step 3145 ssq 9.0226-9.0226 reflect
step 3146 ssq 9.0226-9.0226 expand
step 3147 ssq 9.0226-9.0226 reflect
step 3148 ssq 9.0226-9.0226 contract inside
step 3149 ssq 9.0226-9.0226 reflect
step 3150 ssq 9.0226-9.0226 reflect
step 3151 ssq 9.0226-9.0226 reflect
step 3152 ssq 9.0226-9.0226 reflect
step 3153 ssq 9.0226-9.0226 reflect
step 3154 ssq 9.0226-9.0226 contract inside
step 3155 ssq 9.0226-9.0226 reflect
step 3156 ssq 9.0226-9.0226 contract inside
step 3157 ssq 9.0226-9.0226 reflect
step 3158 ssq 9.0226-9.0226 contract inside
step 3159 ssq 9.0226-9.0226 reflect
step 3160 ssq 9.0226-9.0226 contract inside
step 3161 ssq 9.0226-9.0226 contract inside
step 3162 ssq 9.0226-9.0226 reflect
step 3163 ssq 9.0226-9.0226 contract inside
step 3164 ssq 9.0226-9.0226 reflect
step 3165 ssq 9.0226-9.0226 reflect
step 3166 ssq 9.0226-9.0226 contract inside
step 3167 ssq 9.0226-9.0226 reflect
step 3168 ssq 9.0226-9.0226 reflect
step 3169 ssq 9.0226-9.0226 contract inside
step 3170 ssq 9.0226-9.0226 contract inside
step 3171 ssq 9.0226-9.0226 contract inside
step 3172 ssq 9.0226-9.0226 reflect
step 3173 ssq 9.0226-9.0226 contract inside
step 3174 ssq 9.0226-9.0226 contract inside
step 3175 ssq 9.0226-9.0226 contract inside
step 3176 ssq 9.0226-9.0226 contract inside
step 3177 ssq 9.0226-9.0226 contract inside
step 3178 ssq 9.0226-9.0226 reflect
step 3179 ssq 9.0226-9.0226 reflect
step 3180 ssq 9.0226-9.0226 contract inside
step 3181 ssq 9.0226-9.0226 contract inside
step 3182 ssq 9.0226-9.0226 contract inside
step 3183 ssq 9.0226-9.0226 reflect
step 3184 ssq 9.0226-9.0226 contract inside
step 3185 ssq 9.0226-9.0226 reflect
step 3186 ssq 9.0226-9.0226 reflect
step 3187 ssq 9.0226-9.0226 reflect
step 3188 ssq 9.0226-9.0226 reflect
step 3189 ssq 9.0226-9.0226 reflect
step 3190 ssq 9.0226-9.0226 reflect
step 3191 ssq 9.0226-9.0226 reflect
step 3192 ssq 9.0226-9.0226 reflect
step 3193 ssq 9.0226-9.0226 reflect
step 3194 ssq 9.0226-9.0226 reflect
step 3195 ssq 9.0226-9.0226 reflect
step 3196 ssq 9.0226-9.0226 reflect
step 3197 ssq 9.0226-9.0226 contract inside
step 3198 ssq 9.0226-9.0226 contract inside
step 3199 ssq 9.0226-9.0226 reflect
step 3200 ssq 9.0226-9.0226 contract inside
step 3201 ssq 9.0226-9.0226 contract inside
step 3202 ssq 9.0226-9.0226 contract inside
step 3203 ssq 9.0226-9.0226 contract inside
step 3204 ssq 9.0226-9.0226 reflect
step 3205 ssq 9.0226-9.0226 reflect
step 3206 ssq 9.0226-9.0226 reflect
step 3207 ssq 9.0226-9.0226 contract inside
step 3208 ssq 9.0226-9.0226 expand
step 3209 ssq 9.0226-9.0226 contract inside
step 3210 ssq 9.0226-9.0226 reflect
step 3211 ssq 9.0226-9.0226 contract inside
step 3212 ssq 9.0226-9.0226 reflect
step 3213 ssq 9.0226-9.0226 reflect
step 3214 ssq 9.0226-9.0226 reflect
step 3215 ssq 9.0226-9.0226 contract inside
step 3216 ssq 9.0226-9.0226 contract inside
step 3217 ssq 9.0226-9.0226 reflect
step 3218 ssq 9.0226-9.0226 reflect
step 3219 ssq 9.0226-9.0226 contract inside
step 3220 ssq 9.0226-9.0226 reflect
step 3221 ssq 9.0226-9.0226 reflect
step 3222 ssq 9.0226-9.0226 reflect
step 3223 ssq 9.0226-9.0226 reflect
step 3224 ssq 9.0226-9.0226 reflect
step 3225 ssq 9.0226-9.0226 reflect
step 3226 ssq 9.0226-9.0226 reflect
step 3227 ssq 9.0226-9.0226 reflect
step 3228 ssq 9.0226-9.0226 contract inside
step 3229 ssq 9.0226-9.0226 expand
step 3230 ssq 9.0226-9.0226 reflect
step 3231 ssq 9.0226-9.0226 expand
step 3232 ssq 9.0226-9.0226 reflect
step 3233 ssq 9.0226-9.0226 contract inside
step 3234 ssq 9.0226-9.0226 reflect
step 3235 ssq 9.0226-9.0226 reflect
step 3236 ssq 9.0226-9.0226 expand
step 3237 ssq 9.0226-9.0226 reflect
step 3238 ssq 9.0226-9.0226 reflect
step 3239 ssq 9.0226-9.0226 reflect
step 3240 ssq 9.0226-9.0226 reflect
step 3241 ssq 9.0226-9.0226 expand
step 3242 ssq 9.0226-9.0226 reflect
step 3243 ssq 9.0226-9.0226 reflect
step 3244 ssq 9.0226-9.0226 reflect
step 3245 ssq 9.0226-9.0226 reflect
step 3246 ssq 9.0226-9.0226 expand
step 3247 ssq 9.0226-9.0226 reflect
step 3248 ssq 9.0226-9.0226 reflect
step 3249 ssq 9.0226-9.0226 expand
step 3250 ssq 9.0226-9.0226 reflect
step 3251 ssq 9.0226-9.0226 reflect
step 3252 ssq 9.0226-9.0226 reflect
step 3253 ssq 9.0226-9.0226 reflect
step 3254 ssq 9.0226-9.0226 reflect
step 3255 ssq 9.0226-9.0226 reflect
step 3256 ssq 9.0226-9.0226 reflect
step 3257 ssq 9.0226-9.0226 reflect
step 3258 ssq 9.0226-9.0226 reflect
step 3259 ssq 9.0226-9.0226 reflect
step 3260 ssq 9.0226-9.0226 reflect
step 3261 ssq 9.0226-9.0226 reflect
step 3262 ssq 9.0226-9.0226 contract inside
step 3263 ssq 9.0226-9.0226 contract inside
step 3264 ssq 9.0226-9.0226 reflect
step 3265 ssq 9.0226-9.0226 reflect
step 3266 ssq 9.0226-9.0226 reflect
step 3267 ssq 9.0226-9.0226 reflect
step 3268 ssq 9.0226-9.0226 reflect
step 3269 ssq 9.0226-9.0226 reflect
step 3270 ssq 9.0226-9.0226 reflect
step 3271 ssq 9.0226-9.0226 reflect
step 3272 ssq 9.0226-9.0226 reflect
step 3273 ssq 9.0226-9.0226 contract outside
step 3274 ssq 9.0226-9.0226 contract inside
step 3275 ssq 9.0226-9.0226 contract outside
step 3276 ssq 9.0226-9.0226 reflect
step 3277 ssq 9.0226-9.0226 reflect
step 3278 ssq 9.0226-9.0226 reflect
step 3279 ssq 9.0226-9.0226 reflect
step 3280 ssq 9.0226-9.0226 reflect
step 3281 ssq 9.0226-9.0226 contract inside
step 3282 ssq 9.0226-9.0226 expand
step 3283 ssq 9.0226-9.0226 reflect
step 3284 ssq 9.0226-9.0226 contract inside
step 3285 ssq 9.0226-9.0226 reflect
step 3286 ssq 9.0226-9.0226 contract inside
step 3287 ssq 9.0226-9.0226 reflect
step 3288 ssq 9.0226-9.0226 reflect
step 3289 ssq 9.0226-9.0226 contract inside
step 3290 ssq 9.0226-9.0226 contract inside
step 3291 ssq 9.0226-9.0226 reflect
step 3292 ssq 9.0226-9.0226 contract outside
step 3293 ssq 9.0226-9.0226 reflect
step 3294 ssq 9.0226-9.0226 expand
step 3295 ssq 9.0226-9.0226 reflect
step 3296 ssq 9.0226-9.0226 reflect
step 3297 ssq 9.0226-9.0226 reflect
step 3298 ssq 9.0226-9.0226 reflect
step 3299 ssq 9.0226-9.0226 reflect
step 3300 ssq 9.0226-9.0226 reflect
step 3301 ssq 9.0226-9.0226 contract outside
step 3302 ssq 9.0226-9.0226 reflect
step 3303 ssq 9.0226-9.0226 expand
step 3304 ssq 9.0226-9.0226 reflect
step 3305 ssq 9.0226-9.0226 contract inside
step 3306 ssq 9.0226-9.0226 reflect
step 3307 ssq 9.0226-9.0226 reflect
step 3308 ssq 9.0226-9.0226 reflect
step 3309 ssq 9.0226-9.0226 reflect
step 3310 ssq 9.0226-9.0226 reflect
step 3311 ssq 9.0226-9.0226 contract inside
step 3312 ssq 9.0226-9.0226 contract inside
step 3313 ssq 9.0226-9.0226 reflect
step 3314 ssq 9.0226-9.0226 contract inside
step 3315 ssq 9.0226-9.0226 reflect
step 3316 ssq 9.0226-9.0226 contract inside
step 3317 ssq 9.0226-9.0226 reflect
step 3318 ssq 9.0226-9.0226 contract inside
step 3319 ssq 9.0226-9.0226 reflect
step 3320 ssq 9.0226-9.0226 contract inside
step 3321 ssq 9.0226-9.0226 reflect
step 3322 ssq 9.0226-9.0226 contract inside
step 3323 ssq 9.0226-9.0226 contract outside
step 3324 ssq 9.0226-9.0226 reflect
step 3325 ssq 9.0226-9.0226 contract inside
step 3326 ssq 9.0226-9.0226 contract inside
step 3327 ssq 9.0226-9.0226 reflect
step 3328 ssq 9.0226-9.0226 contract outside
step 3329 ssq 9.0226-9.0226 reflect
step 3330 ssq 9.0226-9.0226 reflect
step 3331 ssq 9.0226-9.0226 reflect
step 3332 ssq 9.0226-9.0226 reflect
step 3333 ssq 9.0226-9.0226 reflect
step 3334 ssq 9.0226-9.0226 reflect
step 3335 ssq 9.0226-9.0226 expand
step 3336 ssq 9.0226-9.0226 contract inside
step 3337 ssq 9.0226-9.0226 contract inside
step 3338 ssq 9.0226-9.0226 reflect
step 3339 ssq 9.0226-9.0226 reflect
step 3340 ssq 9.0226-9.0226 reflect
step 3341 ssq 9.0226-9.0226 reflect
step 3342 ssq 9.0226-9.0226 contract inside
step 3343 ssq 9.0226-9.0226 contract inside
step 3344 ssq 9.0226-9.0226 reflect
step 3345 ssq 9.0226-9.0226 contract inside
step 3346 ssq 9.0226-9.0226 reflect
step 3347 ssq 9.0226-9.0226 contract inside
step 3348 ssq 9.0226-9.0226 reflect
step 3349 ssq 9.0226-9.0226 expand
step 3350 ssq 9.0226-9.0226 reflect
step 3351 ssq 9.0226-9.0226 reflect
step 3352 ssq 9.0226-9.0226 reflect
step 3353 ssq 9.0226-9.0226 reflect
step 3354 ssq 9.0226-9.0226 reflect
step 3355 ssq 9.0226-9.0226 reflect
step 3356 ssq 9.0226-9.0226 reflect
step 3357 ssq 9.0226-9.0226 reflect
step 3358 ssq 9.0226-9.0226 reflect
step 3359 ssq 9.0226-9.0226 reflect
step 3360 ssq 9.0226-9.0226 contract inside
step 3361 ssq 9.0226-9.0226 reflect
step 3362 ssq 9.0226-9.0226 reflect
step 3363 ssq 9.0226-9.0226 contract inside
step 3364 ssq 9.0226-9.0226 reflect
step 3365 ssq 9.0226-9.0226 contract inside
step 3366 ssq 9.0226-9.0226 reflect
step 3367 ssq 9.0226-9.0226 contract inside
step 3368 ssq 9.0226-9.0226 reflect
step 3369 ssq 9.0226-9.0226 expand
step 3370 ssq 9.0226-9.0226 reflect
step 3371 ssq 9.0226-9.0226 reflect
step 3372 ssq 9.0226-9.0226 reflect
step 3373 ssq 9.0226-9.0226 expand
step 3374 ssq 9.0226-9.0226 reflect
step 3375 ssq 9.0226-9.0226 reflect
step 3376 ssq 9.0226-9.0226 reflect
step 3377 ssq 9.0226-9.0226 reflect
step 3378 ssq 9.0226-9.0226 reflect
step 3379 ssq 9.0226-9.0226 expand
step 3380 ssq 9.0226-9.0226 reflect
step 3381 ssq 9.0226-9.0226 reflect
step 3382 ssq 9.0226-9.0226 reflect
step 3383 ssq 9.0226-9.0226 expand
step 3384 ssq 9.0226-9.0226 reflect
step 3385 ssq 9.0226-9.0226 reflect
step 3386 ssq 9.0226-9.0226 reflect
step 3387 ssq 9.0226-9.0226 reflect
step 3388 ssq 9.0226-9.0226 reflect
step 3389 ssq 9.0226-9.0226 expand
step 3390 ssq 9.0226-9.0226 reflect
step 3391 ssq 9.0226-9.0226 reflect
step 3392 ssq 9.0226-9.0226 reflect
step 3393 ssq 9.0226-9.0226 reflect
step 3394 ssq 9.0226-9.0226 expand
step 3395 ssq 9.0226-9.0226 expand
step 3396 ssq 9.0226-9.0226 reflect
step 3397 ssq 9.0226-9.0226 expand
step 3398 ssq 9.0226-9.0226 reflect
step 3399 ssq 9.0226-9.0226 reflect
step 3400 ssq 9.0226-9.0226 reflect
step 3401 ssq 9.0226-9.0226 reflect
step 3402 ssq 9.0226-9.0226 reflect
step 3403 ssq 9.0226-9.0226 expand
step 3404 ssq 9.0226-9.0226 reflect
step 3405 ssq 9.0226-9.0226 reflect
step 3406 ssq 9.0226-9.0226 reflect
step 3407 ssq 9.0226-9.0226 reflect
step 3408 ssq 9.0226-9.0226 expand
step 3409 ssq 9.0226-9.0226 reflect
step 3410 ssq 9.0226-9.0226 expand
step 3411 ssq 9.0226-9.0226 reflect
step 3412 ssq 9.0226-9.0226 reflect
step 3413 ssq 9.0226-9.0226 expand
step 3414 ssq 9.0226-9.0226 reflect
step 3415 ssq 9.0226-9.0226 expand
step 3416 ssq 9.0226-9.0226 expand
step 3417 ssq 9.0226-9.0226 reflect
step 3418 ssq 9.0226-9.0226 expand
step 3419 ssq 9.0226-9.0226 reflect
step 3420 ssq 9.0226-9.0226 reflect
step 3421 ssq 9.0226-9.0226 reflect
step 3422 ssq 9.0226-9.0226 reflect
step 3423 ssq 9.0226-9.0226 reflect
step 3424 ssq 9.0226-9.0226 reflect
step 3425 ssq 9.0226-9.0226 reflect
step 3426 ssq 9.0226-9.0226 contract inside
step 3427 ssq 9.0226-9.0226 reflect
step 3428 ssq 9.0226-9.0226 reflect
step 3429 ssq 9.0226-9.0226 reflect
step 3430 ssq 9.0226-9.0226 expand
step 3431 ssq 9.0226-9.0226 reflect
step 3432 ssq 9.0226-9.0226 contract inside
step 3433 ssq 9.0226-9.0226 contract inside
step 3434 ssq 9.0226-9.0226 reflect
step 3435 ssq 9.0226-9.0226 contract inside
step 3436 ssq 9.0226-9.0226 reflect
step 3437 ssq 9.0226-9.0226 reflect
step 3438 ssq 9.0226-9.0226 expand
step 3439 ssq 9.0226-9.0226 reflect
step 3440 ssq 9.0226-9.0226 reflect
step 3441 ssq 9.0226-9.0226 reflect
step 3442 ssq 9.0226-9.0226 reflect
step 3443 ssq 9.0226-9.0226 reflect
step 3444 ssq 9.0226-9.0226 reflect
step 3445 ssq 9.0226-9.0226 expand
step 3446 ssq 9.0226-9.0226 expand
step 3447 ssq 9.0226-9.0226 reflect
step 3448 ssq 9.0226-9.0226 reflect
step 3449 ssq 9.0226-9.0226 reflect
step 3450 ssq 9.0226-9.0226 reflect
step 3451 ssq 9.0226-9.0226 contract inside
step 3452 ssq 9.0226-9.0226 reflect
step 3453 ssq 9.0226-9.0226 reflect
step 3454 ssq 9.0226-9.0226 expand
step 3455 ssq 9.0226-9.0226 reflect
step 3456 ssq 9.0226-9.0226 reflect
step 3457 ssq 9.0226-9.0226 reflect
step 3458 ssq 9.0226-9.0226 reflect
step 3459 ssq 9.0226-9.0226 expand
step 3460 ssq 9.0226-9.0226 reflect
step 3461 ssq 9.0226-9.0226 reflect
step 3462 ssq 9.0226-9.0226 reflect
step 3463 ssq 9.0226-9.0226 reflect
step 3464 ssq 9.0226-9.0226 contract inside
step 3465 ssq 9.0226-9.0226 reflect
step 3466 ssq 9.0226-9.0226 reflect
step 3467 ssq 9.0226-9.0226 contract inside
step 3468 ssq 9.0226-9.0226 contract inside
step 3469 ssq 9.0226-9.0226 reflect
step 3470 ssq 9.0226-9.0226 reflect
step 3471 ssq 9.0226-9.0226 contract inside
step 3472 ssq 9.0226-9.0226 reflect
step 3473 ssq 9.0226-9.0226 reflect
step 3474 ssq 9.0226-9.0226 reflect
step 3475 ssq 9.0226-9.0226 reflect
step 3476 ssq 9.0226-9.0226 reflect
step 3477 ssq 9.0226-9.0226 reflect
step 3478 ssq 9.0226-9.0226 reflect
step 3479 ssq 9.0226-9.0226 contract outside
step 3480 ssq 9.0226-9.0226 reflect
step 3481 ssq 9.0226-9.0226 reflect
step 3482 ssq 9.0226-9.0226 reflect
step 3483 ssq 9.0226-9.0226 reflect
step 3484 ssq 9.0226-9.0226 reflect
step 3485 ssq 9.0226-9.0226 reflect
step 3486 ssq 9.0226-9.0226 contract outside
step 3487 ssq 9.0226-9.0226 reflect
step 3488 ssq 9.0226-9.0226 contract inside
step 3489 ssq 9.0226-9.0226 reflect
step 3490 ssq 9.0226-9.0226 reflect
step 3491 ssq 9.0226-9.0226 reflect
step 3492 ssq 9.0226-9.0226 reflect
step 3493 ssq 9.0226-9.0226 reflect
step 3494 ssq 9.0226-9.0226 contract inside
step 3495 ssq 9.0226-9.0226 expand
step 3496 ssq 9.0226-9.0226 contract inside
step 3497 ssq 9.0226-9.0226 reflect
step 3498 ssq 9.0226-9.0226 reflect
step 3499 ssq 9.0226-9.0226 reflect
step 3500 ssq 9.0226-9.0226 reflect
step 3501 ssq 9.0226-9.0226 contract inside
step 3502 ssq 9.0226-9.0226 reflect
step 3503 ssq 9.0226-9.0226 contract inside
step 3504 ssq 9.0226-9.0226 contract inside
step 3505 ssq 9.0226-9.0226 contract inside
step 3506 ssq 9.0226-9.0226 contract inside
step 3507 ssq 9.0226-9.0226 reflect
step 3508 ssq 9.0226-9.0226 reflect
step 3509 ssq 9.0226-9.0226 reflect
step 3510 ssq 9.0226-9.0226 reflect
step 3511 ssq 9.0226-9.0226 contract inside
step 3512 ssq 9.0226-9.0226 expand
step 3513 ssq 9.0226-9.0226 reflect
step 3514 ssq 9.0226-9.0226 reflect
step 3515 ssq 9.0226-9.0226 reflect
step 3516 ssq 9.0226-9.0226 contract inside
step 3517 ssq 9.0226-9.0226 reflect
step 3518 ssq 9.0226-9.0226 reflect
step 3519 ssq 9.0226-9.0226 reflect
step 3520 ssq 9.0226-9.0226 contract inside
step 3521 ssq 9.0226-9.0226 reflect
step 3522 ssq 9.0226-9.0226 contract inside
step 3523 ssq 9.0226-9.0226 contract inside
step 3524 ssq 9.0226-9.0226 reflect
step 3525 ssq 9.0226-9.0226 reflect
step 3526 ssq 9.0226-9.0226 contract inside
step 3527 ssq 9.0226-9.0226 contract inside
step 3528 ssq 9.0226-9.0226 reflect
step 3529 ssq 9.0226-9.0226 reflect
step 3530 ssq 9.0226-9.0226 reflect
step 3531 ssq 9.0226-9.0226 contract inside
step 3532 ssq 9.0226-9.0226 reflect
step 3533 ssq 9.0226-9.0226 contract outside
step 3534 ssq 9.0226-9.0226 reflect
step 3535 ssq 9.0226-9.0226 reflect
step 3536 ssq 9.0226-9.0226 reflect
step 3537 ssq 9.0226-9.0226 reflect
step 3538 ssq 9.0226-9.0226 contract inside
step 3539 ssq 9.0226-9.0226 reflect
step 3540 ssq 9.0226-9.0226 contract inside
step 3541 ssq 9.0226-9.0226 contract inside
step 3542 ssq 9.0226-9.0226 reflect
step 3543 ssq 9.0226-9.0226 contract inside
step 3544 ssq 9.0226-9.0226 reflect
step 3545 ssq 9.0226-9.0226 reflect
step 3546 ssq 9.0226-9.0226 reflect
step 3547 ssq 9.0226-9.0226 contract inside
step 3548 ssq 9.0226-9.0226 contract inside
step 3549 ssq 9.0226-9.0226 contract inside
step 3550 ssq 9.0226-9.0226 reflect
step 3551 ssq 9.0226-9.0226 contract inside
step 3552 ssq 9.0226-9.0226 reflect
step 3553 ssq 9.0226-9.0226 contract inside
step 3554 ssq 9.0226-9.0226 contract inside
step 3555 ssq 9.0226-9.0226 reflect
step 3556 ssq 9.0226-9.0226 reflect
step 3557 ssq 9.0226-9.0226 reflect
step 3558 ssq 9.0226-9.0226 reflect
step 3559 ssq 9.0226-9.0226 reflect
step 3560 ssq 9.0226-9.0226 contract inside
step 3561 ssq 9.0226-9.0226 expand
step 3562 ssq 9.0226-9.0226 reflect
step 3563 ssq 9.0226-9.0226 reflect
step 3564 ssq 9.0226-9.0226 contract inside
step 3565 ssq 9.0226-9.0226 contract inside
step 3566 ssq 9.0226-9.0226 contract inside
step 3567 ssq 9.0226-9.0226 reflect
step 3568 ssq 9.0226-9.0226 contract inside
step 3569 ssq 9.0226-9.0226 reflect
step 3570 ssq 9.0226-9.0226 reflect
step 3571 ssq 9.0226-9.0226 reflect
step 3572 ssq 9.0226-9.0226 reflect
step 3573 ssq 9.0226-9.0226 reflect
step 3574 ssq 9.0226-9.0226 reflect
step 3575 ssq 9.0226-9.0226 contract inside
step 3576 ssq 9.0226-9.0226 contract inside
step 3577 ssq 9.0226-9.0226 contract inside
step 3578 ssq 9.0226-9.0226 reflect
step 3579 ssq 9.0226-9.0226 contract inside
step 3580 ssq 9.0226-9.0226 reflect
step 3581 ssq 9.0226-9.0226 reflect
step 3582 ssq 9.0226-9.0226 contract inside
step 3583 ssq 9.0226-9.0226 reflect
step 3584 ssq 9.0226-9.0226 reflect
step 3585 ssq 9.0226-9.0226 reflect
step 3586 ssq 9.0226-9.0226 reflect
step 3587 ssq 9.0226-9.0226 reflect
step 3588 ssq 9.0226-9.0226 reflect
step 3589 ssq 9.0226-9.0226 contract inside
step 3590 ssq 9.0226-9.0226 reflect
step 3591 ssq 9.0226-9.0226 contract inside
step 3592 ssq 9.0226-9.0226 reflect
step 3593 ssq 9.0226-9.0226 contract inside
step 3594 ssq 9.0226-9.0226 contract outside
step 3595 ssq 9.0226-9.0226 reflect
step 3596 ssq 9.0226-9.0226 reflect
step 3597 ssq 9.0226-9.0226 contract outside
step 3598 ssq 9.0226-9.0226 reflect
step 3599 ssq 9.0226-9.0226 contract inside
step 3600 ssq 9.0226-9.0226 reflect
step 3601 ssq 9.0226-9.0226 reflect
step 3602 ssq 9.0226-9.0226 reflect
step 3603 ssq 9.0226-9.0226 contract inside
step 3604 ssq 9.0226-9.0226 reflect
step 3605 ssq 9.0226-9.0226 reflect
step 3606 ssq 9.0226-9.0226 reflect
step 3607 ssq 9.0226-9.0226 reflect
step 3608 ssq 9.0226-9.0226 reflect
step 3609 ssq 9.0226-9.0226 reflect
step 3610 ssq 9.0226-9.0226 reflect
step 3611 ssq 9.0226-9.0226 contract inside
step 3612 ssq 9.0226-9.0226 reflect
step 3613 ssq 9.0226-9.0226 reflect
step 3614 ssq 9.0226-9.0226 reflect
step 3615 ssq 9.0226-9.0226 contract inside
step 3616 ssq 9.0226-9.0226 contract inside
step 3617 ssq 9.0226-9.0226 contract inside
step 3618 ssq 9.0226-9.0226 reflect
step 3619 ssq 9.0226-9.0226 expand
step 3620 ssq 9.0226-9.0226 reflect
step 3621 ssq 9.0226-9.0226 reflect
step 3622 ssq 9.0226-9.0226 reflect
step 3623 ssq 9.0226-9.0226 reflect
step 3624 ssq 9.0226-9.0226 reflect
step 3625 ssq 9.0226-9.0226 reflect
step 3626 ssq 9.0226-9.0226 contract outside
step 3627 ssq 9.0226-9.0226 reflect
step 3628 ssq 9.0226-9.0226 reflect
step 3629 ssq 9.0226-9.0226 contract inside
step 3630 ssq 9.0226-9.0226 reflect
step 3631 ssq 9.0226-9.0226 reflect
step 3632 ssq 9.0226-9.0226 reflect
step 3633 ssq 9.0226-9.0226 reflect
step 3634 ssq 9.0226-9.0226 reflect
step 3635 ssq 9.0226-9.0226 contract inside
step 3636 ssq 9.0226-9.0226 reflect
step 3637 ssq 9.0226-9.0226 reflect
step 3638 ssq 9.0226-9.0226 reflect
step 3639 ssq 9.0226-9.0226 expand
step 3640 ssq 9.0226-9.0226 reflect
step 3641 ssq 9.0226-9.0226 reflect
step 3642 ssq 9.0226-9.0226 expand
step 3643 ssq 9.0226-9.0226 contract inside
step 3644 ssq 9.0226-9.0226 contract inside
step 3645 ssq 9.0226-9.0226 reflect
step 3646 ssq 9.0226-9.0226 contract inside
step 3647 ssq 9.0226-9.0226 reflect
step 3648 ssq 9.0226-9.0226 reflect
step 3649 ssq 9.0226-9.0226 reflect
step 3650 ssq 9.0226-9.0226 contract inside
step 3651 ssq 9.0226-9.0226 reflect
step 3652 ssq 9.0226-9.0226 reflect
step 3653 ssq 9.0226-9.0226 reflect
step 3654 ssq 9.0226-9.0226 contract inside
step 3655 ssq 9.0226-9.0226 reflect
step 3656 ssq 9.0226-9.0226 reflect
step 3657 ssq 9.0226-9.0226 reflect
step 3658 ssq 9.0226-9.0226 reflect
step 3659 ssq 9.0226-9.0226 contract inside
step 3660 ssq 9.0226-9.0226 reflect
step 3661 ssq 9.0226-9.0226 contract inside
step 3662 ssq 9.0226-9.0226 reflect
step 3663 ssq 9.0226-9.0226 expand
step 3664 ssq 9.0226-9.0226 reflect
step 3665 ssq 9.0226-9.0226 reflect
step 3666 ssq 9.0226-9.0226 reflect
step 3667 ssq 9.0226-9.0226 reflect
step 3668 ssq 9.0226-9.0226 reflect
step 3669 ssq 9.0226-9.0226 reflect
step 3670 ssq 9.0226-9.0226 reflect
step 3671 ssq 9.0226-9.0226 reflect
step 3672 ssq 9.0226-9.0226 contract inside
step 3673 ssq 9.0226-9.0226 contract inside
step 3674 ssq 9.0226-9.0226 reflect
step 3675 ssq 9.0226-9.0226 shrink
step 3676 ssq 9.0226-9.0226 contract inside
step 3677 ssq 9.0226-9.0226 reflect
step 3678 ssq 9.0226-9.0226 shrink
step 3679 ssq 9.0226-9.0226 reflect
step 3680 ssq 9.0226-9.0226 reflect
step 3681 ssq 9.0226-9.0226 reflect
step 3682 ssq 9.0226-9.0226 contract inside
step 3683 ssq 9.0226-9.0226 contract inside
step 3684 ssq 9.0226-9.0226 reflect
step 3685 ssq 9.0226-9.0226 reflect
step 3686 ssq 9.0226-9.0226 reflect
step 3687 ssq 9.0226-9.0226 contract inside
step 3688 ssq 9.0226-9.0226 reflect
step 3689 ssq 9.0226-9.0226 shrink
step 3690 ssq 9.0226-9.0226 reflect
step 3691 ssq 9.0226-9.0226 contract inside
step 3692 ssq 9.0226-9.0226 reflect
step 3693 ssq 9.0226-9.0226 contract inside
step 3694 ssq 9.0226-9.0226 reflect
step 3695 ssq 9.0226-9.0226 shrink
step 3696 ssq 9.0226-9.0226 reflect
step 3697 ssq 9.0226-9.0226 contract inside
step 3698 ssq 9.0226-9.0226 contract inside
step 3699 ssq 9.0226-9.0226 shrink
step 3700 ssq 9.0226-9.0226 reflect
step 3701 ssq 9.0226-9.0226 reflect
step 3702 ssq 9.0226-9.0226 reflect
step 3703 ssq 9.0226-9.0226 reflect
step 3704 ssq 9.0226-9.0226 reflect
step 3705 ssq 9.0226-9.0226 reflect
step 3706 ssq 9.0226-9.0226 reflect
step 3707 ssq 9.0226-9.0226 reflect
step 3708 ssq 9.0226-9.0226 contract outside
step 3709 ssq 9.0226-9.0226 shrink
step 3710 ssq 9.0226-9.0226 reflect
step 3711 ssq 9.0226-9.0226 reflect
step 3712 ssq 9.0226-9.0226 reflect
step 3713 ssq 9.0226-9.0226 contract inside
step 3714 ssq 9.0226-9.0226 contract inside
step 3715 ssq 9.0226-9.0226 reflect
step 3716 ssq 9.0226-9.0226 shrink
step 3717 ssq 9.0226-9.0226 reflect
step 3718 ssq 9.0226-9.0226 reflect
step 3719 ssq 9.0226-9.0226 reflect
step 3720 ssq 9.0226-9.0226 contract inside
step 3721 ssq 9.0226-9.0226 contract outside
step 3722 ssq 9.0226-9.0226 shrink
step 3723 ssq 9.0226-9.0226 reflect
step 3724 ssq 9.0226-9.0226 reflect
step 3725 ssq 9.0226-9.0226 shrink
step 3726 ssq 9.0226-9.0226 reflect
step 3727 ssq 9.0226-9.0226 reflect
step 3728 ssq 9.0226-9.0226 reflect
step 3729 ssq 9.0226-9.0226 reflect
step 3730 ssq 9.0226-9.0226 shrink
step 3731 ssq 9.0226-9.0226 shrink
step 3732 ssq 9.0226-9.0226 reflect
step 3733 ssq 9.0226-9.0226 reflect
step 3734 ssq 9.0226-9.0226 reflect
step 3735 ssq 9.0226-9.0226 contract inside
step 3736 ssq 9.0226-9.0226 reflect
step 3737 ssq 9.0226-9.0226 reflect
step 3738 ssq 9.0226-9.0226 shrink
step 3739 ssq 9.0226-9.0226 reflect
step 3740 ssq 9.0226-9.0226 reflect
step 3741 ssq 9.0226-9.0226 contract outside
step 3742 ssq 9.0226-9.0226 contract inside
step 3743 ssq 9.0226-9.0226 contract inside
step 3744 ssq 9.0226-9.0226 contract inside
step 3745 ssq 9.0226-9.0226 shrink
step 3746 ssq 9.0226-9.0226 contract inside
step 3747 ssq 9.0226-9.0226 reflect
step 3748 ssq 9.0226-9.0226 shrink
step 3749 ssq 9.0226-9.0226 reflect
step 3750 ssq 9.0226-9.0226 reflect
step 3751 ssq 9.0226-9.0226 reflect
step 3752 ssq 9.0226-9.0226 shrink
step 3753 ssq 9.0226-9.0226 contract inside
step 3754 ssq 9.0226-9.0226 contract outside
step 3755 ssq 9.0226-9.0226 contract inside
step 3756 ssq 9.0226-9.0226 reflect
step 3757 ssq 9.0226-9.0226 shrink
step 3758 ssq 9.0226-9.0226 reflect
step 3759 ssq 9.0226-9.0226 reflect
step 3760 ssq 9.0226-9.0226 reflect
step 3761 ssq 9.0226-9.0226 reflect
step 3762 ssq 9.0226-9.0226 reflect
step 3763 ssq 9.0226-9.0226 reflect
step 3764 ssq 9.0226-9.0226 shrink
step 3765 ssq 9.0226-9.0226 reflect
step 3766 ssq 9.0226-9.0226 contract inside
step 3767 ssq 9.0226-9.0226 reflect
step 3768 ssq 9.0226-9.0226 reflect
step 3769 ssq 9.0226-9.0226 reflect
step 3770 ssq 9.0226-9.0226 reflect
step 3771 ssq 9.0226-9.0226 reflect
step 3772 ssq 9.0226-9.0226 contract inside
step 3773 ssq 9.0226-9.0226 shrink
Successful convergence 
Parameter values and standard deviations 
1 ab, d, age at birth       336    328.8 
2 ap, d, age at puberty      2555     3401 
3 Lb, cm, length at birth       700    717.1 
4 Lp, cm, length at puberty      2050     1633 
5 Li, cm, ultimate length      2700     2619 
6 Wb, g, weight at birth  2.75e+05 3.505e+05 
7 Wp, g, weight at puberty   6.9e+06 4.14e+06 
8 Wi, g, ultimate weight   1.6e+07 1.708e+07 
9 rB, 1/d, von Bert growth rate  0.0005918 0.0008249 
10 Ri, #/d, maximum reprod rate    0.0011 0.001222 
11 am, d, life span  2.92e+04 -1.341e+154 
12 T,  K, actual body temp       310      310 
13 T_ref, K, reference temp       293      293 
14 T_A,   K, Arrhenius temp  1.28e+04 1.492e+04 
15 f, scaled functional response         1        1 
16 z, zoom factor       128      115 
17 del_M,  -, shape coefficient      0.04   0.0439 
18 F_m, l/d.cm^2, {F_m} max spec search r       6.5      6.5 
19 kap_X, -, digestion efficiency       0.8      0.8 
20 v, cm/d, energy conductance      0.02  0.01761 
21 kap, -, allocation fraction to soma       0.8   0.9856 
22 kap_R, -, reproduction efficiency      0.95     0.95 
23 [p_M], J/d.cm^3, vol-spec som maint        18     32.1 
24 {p_T}, J/d.cm^2, sur-spec som maint         0        0 
25 k_J, 1/d, maturity maint rate coefficient     0.002 0.0002644 
26 [E_G], J/cm^3, spec cost for structure     2800     2020 
27 E_H^b, J, maturity investm at birth  1.153e+07 1.58e+07 
28 E_H^p, J, maturity investm at puberty  3.146e+08 4.56e+08 
29 h_a, 1/d^2, Weibull aging acceleration  1.28e-07 -1.254e-08 
30 s_G, -, Gompertz stress coefficient      0.5      0.5 
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% Demonstrates the use og get_pars_m
% get parameters for Balaenoptera musculus
% get_pars_m is adapted for placentalia data (foetal development)


global dwm % pass d_O, w_O, mu_O directly to get_pars_m

% first initial estimators of the parameter values
% copy-paste from pars_animal


T    =   273 + 37; % K, actual body temperature ADAPT THIS FOR B.musculus
T_ref  = 293;      % K, temp for which rate pars are given 
T_A  =  1.6*8000;  % K, Arrhenius temp ADAT THIS FOR B.musculus
f = 1.0;           % scaled functional response
z = 128;           % zoom factor ADAPT THIS FOR B.musculus
del_M =.16/ 4;     % -, shape coefficient ADAPT THIS FOR B.musculus
F_m = 6.5;         % l/d.cm^2, {F_m} max spec searching rate
kap_X = 0.8;       % -, digestion efficiency of food to reserve
v = 0.02;          % cm/d, energy conductance
kap = 0.8;         % -, alloaction fraction to soma = growth + somatic maintenance
kap_R = 0.95;      % -, reproduction efficiency
p_M = 18;          % J/d.cm^3, [p_M] vol-specific somatic maintenance
p_T =  0;          % J/d.cm^2, {p_T} surface-specific som maintenance
k_J = 0.002;       % 1/d, < k_M = p_M/E_G, maturity maint rate coefficient
E_G = 2800;        % J/cm^3, [E_G], spec cost for structure
E_Hb = 20 * 1e-3 * 275 * z^3; % J, E_H^b ADAPT THIS FOR B.musculus
E_Hp = 3 * 50 * z^3;  % J, E_H^p ADAPT THIS FOR B.musculus
h_a = z * 1e-9;    % 1/d^2, Weibull aging acceleration
s_G = 0.5;         % -, Gompertz stress coefficient ADAPT THIS FOR B.musculus

% pack 18 parameters and fix T, T_ref, f, F_m, kap_X, kap_R, p_T, h_a, s_G
pars_Bm = [T 0; T_ref 0; T_A 1; f 0; z 1; del_M 1; 
    F_m 0; kap_X 0; v 1; kap 1; kap_R 0; p_M 1; p_T 0; k_J 1; E_G 1; E_Hb 1; E_Hp 1; h_a 1; s_G 0];

% 10 data for B.musculus
ab = 336;       %   1 ab    % d, age at birth
ap = 2555;      %   2 ap    % d, age at puberty
Lb = 700;       %   3 Lb    % cm, length at birth
Lp = 2050;      %   4 Lp    % cm, length at puberty
Li = 2700;      %   5 Li    % cm, ultimate length
Wb = 275000;    %   6 Wb    % g, weight at birth
Wp = 6900000;   %   7 Wp    % g, weight at puberty
Wi = 16000000;  %   8 Wi    % g, ultimate weight
rB = 5.9178e-4; %   9 rB    % 1/d, von Bertalanffy growth rate
Ri = .0011;     %  10 Ri    % #/d, maximum reproduction rate
tm = 29200;     %  11 tm    % d, life span

% pack data for B.musculus
%  append parameters for generalised animal as data
%   to make sure that those of B.musculus are near, except for z
data_Bm = [ab; ap; Lb; Lp; Li; Wb; Wp; Wi; rB; Ri; tm; pars_Bm(:,1)];
% nmregr wants to have 3 columns: indpendent var, dependent var, weight coeff
%   prepend independent variable (not used) and append weight coefficients
%   weight coeff inverse to squared data
Data_Bm = [zeros(30,1), data_Bm, 1 ./ max(1e-6, data_Bm) .^ 2];
Data_Bm(1:11,3) = 10 * Data_Bm(1:11,3); % give Bm data more weight
Data_Bm(11,3) = 0; % no weight to a_m; small value gives numerical problems
% we should turn to years, rather than days as unit of time to solve this problem
Data_Bm(26,3) = 20 * Data_Bm(26,3); % more weight to E_G
Data_Bm([14 20],3) = 10 * Data_Bm([14 20],3); % more weight to v, T_A
Data_Bm([12 13 16 27 28],3) = 0; % set weight for T, T_ref, z, E_Hb, E_Hp to zero

%% conversion coefficients (selected copy-paste from pars_animal)

n_O = [1.00, 1.00, 1.00, 1.00;  % C/C, equals 1 by definition
       1.80, 1.80, 2.00, 1.80;  % H/C
       0.50, 0.50, 0.75, 0.50;  % O/C
       0.20, 0.15, 0.20, 0.15]; % N/C
   
d_O = [.1; .1; .1; .1];     % g/cm^3, specific densities for organics
mu_X = 525000;                    % J/mol, chemical potential of food
mu_V = 500000;                    % J/mol, chemical potential of structure
mu_E = 550000;                    % J/mol, chemical potential of reserve
mu_P = 480000;                    % J/mol, chemical potential of faeces
mu_O = [mu_X; mu_V; mu_E; mu_P];  % J/mol, chemical potentials of organics
w_O = n_O' * [12; 1; 16; 14];     % g/mol, mol-weights for org. compounds
dwm = [d_O, w_O, mu_O]; % g/cm^3, g/mol, kJ/mol spec density, mol weight, chem pot

%% tune parameters
nmregr_options('max_step_number',2e4)
nmregr_options('max_fun_evals',2e4)
pars_Bm = nmregr('get_pars_m', pars_Bm, Data_Bm);
Edata_Bm = get_pars_m(pars_Bm(:,1), Data_Bm);
format short eng

txt_Bm = {...
    '1 ab, d, age at birth ';
    '2 ap, d, age at puberty ';
    '3 Lb, cm, length at birth ';
    '4 Lp, cm, length at puberty ';
    '5 Li, cm, ultimate length ';
    '6 Wb, g, weight at birth ';
    '7 Wp, g, weight at puberty ';
    '8 Wi, g, ultimate weight ';
    '9 rB, 1/d, von Bert growth rate ';
   '10 Ri, #/d, maximum reprod rate ';
   '11 am, d, life span ';
   '12 T,  K, actual body temp ';
   '13 T_ref, K, reference temp ';
   '14 T_A,   K, Arrhenius temp ';
   '15 f, scaled functional response ';
   '16 z, zoom factor ';
   '17 del_M,  -, shape coefficient ';
   '18 F_m, l/d.cm^2, {F_m} max spec search r ';
   '19 kap_X, -, digestion efficiency ';
   '20 v, cm/d, energy conductance ';
   '21 kap, -, allocation fraction to soma ';
   '22 kap_R, -, reproduction efficiency ';
   '23 [p_M], J/d.cm^3, vol-spec som maint ';
   '24 {p_T}, J/d.cm^2, sur-spec som maint ';
   '25 k_J, 1/d, maturity maint rate coefficient ';
   '26 [E_G], J/cm^3, spec cost for structure'; 
   '27 E_H^b, J, maturity investm at birth ';
   '28 E_H^p, J, maturity investm at puberty ';
   '29 h_a, 1/d^2, Weibull aging acceleration ';
   '30 s_G, -, Gompertz stress coefficient'};

printpar(txt_Bm, data_Bm, Edata_Bm)
##### SOURCE END #####
--></body></html>

<|start_filename|>animal/html/shprimary_parameters.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>shprimary_parameters</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-06"><meta name="DC.source" content="shprimary_parameters.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Output</a></li><li><a href="#6">Remarks</a></li><li><a href="#7">Example of use</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [pars vars TYPE FIT COMPLETE] = shprimary_parameters
</pre><pre class="codeinput"><span class="comment">% created at 2013/08/01 by <NAME></span>
<span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>plots parameters in Species.xls, which can be found at http://www.bio.vu.nl/thb/deb/deblab/
the present path-setting assumes that the file Species.xls is in subdir add_my_pet</pre><h2>Input<a name="4"></a></h2><pre>the file Species.xls</pre><h2>Output<a name="5"></a></h2><pre>lots of figures</pre><h2>Remarks<a name="6"></a></h2><pre>A desciption of pars and vars can be found in report_init</pre><h2>Example of use<a name="7"></a></h2><pre>[pars vars TYPE FIT COMPLETE] = shprimary_parameters</pre><pre class="codeinput">  file = <span class="string">'/add_my_pet/Species.xls'</span>;
  read_Species

  <span class="keyword">if</span> 0
    mv = mean(v); mvj = mean(vj);
    cv = std(v)/mv; cvj = std(vj)/mvj; <span class="comment">% -, variation coeff of v, vj</span>
    txt = {<span class="string">'before acceleration'</span>; <span class="string">'after acceleration'</span>};
    printpar(txt, [mv; mvj], [cv; cvj], <span class="string">'energy conductance mean, var coeff'</span>);
  <span class="keyword">end</span>

  close <span class="string">all</span>

<span class="keyword">if</span> 1

  figure <span class="comment">% L_i</span>
  hold <span class="string">on</span>
  surv_Li = surv(Li, 0);
  m_Li = sum(Li  &gt; 1)/ n_species;
  plot(surv_Li(:,1), surv_Li(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([0; 1; 1], [m_Li; m_Li; 0], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  ylim([0;1]);
  xlabel(<span class="string">'L_\infty, cm'</span>)

  figure <span class="comment">% v</span>
  hold <span class="string">on</span>
  surv_v = surv(v,0);  surv_vj = surv(vj,0);
  m_v = sum(v &gt; .02)/ n_species;
  plot(surv_v(:,1), surv_v(:,2),<span class="string">'b'</span>, <span class="string">'Linewidth'</span>, 2)
  plot(surv_vj(:,1), surv_vj(:,2),<span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([0; .02; .02], [m_v; m_v; 0], <span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'v, cm d^{-1}'</span>)
  taxa_loc = {<span class="string">'v_b'</span>; <span class="string">'v_j'</span>}; col_taxa_loc = [0 0 1; 1 0 0];
  txt_taxa(1, .8, taxa_loc, col_taxa_loc);

  figure <span class="comment">% L_i - v</span>
  hold <span class="string">on</span>
  scatter(log10(Li(TYPE&gt;0)), log10(vj(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0)), log10(v(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(v(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2;2], [log10(0.02); log10(0.02)],<span class="string">'b'</span>, <span class="string">'linewidth'</span>, 2)
  <span class="keyword">for</span> i = 1:n_species
    <span class="keyword">if</span> TYPE(i) &gt; 0 &amp;&amp; s_M(i) &gt; 1 <span class="comment">% TYPE(i) == 3 || TYPE(i) == 4</span>
      <span class="comment">%plot(log10(Li(i)), log10(v(i)), 'ob', 'linewidth', 2)</span>
      <span class="comment">%plot(log10(Li(i)), log10(vj(i)), 'or', 'linewidth', 2)</span>
      plot(log10(Li(i) * ones(2,1)), log10([vj(i); v(i)]),<span class="string">'-k'</span>, <span class="string">'Linewidth'</span>, 2)
    <span class="comment">%elseif TYPE(i) == 1 || TYPE(i) == 2</span>
      <span class="comment">%plot(log10(Li(i)), log10(v(i)), '.b', 'markersize', 20)</span>
    <span class="keyword">end</span>
  <span class="keyword">end</span>
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  <span class="comment">%set(gca, 'ylim', [-3 0.5], 'YTick', -2:.5:0.5)</span>
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>, <span class="string">'FontSize'</span>, 15)
  ylabel(<span class="string">'_{10}log v, cm d^{-1}'</span>, <span class="string">'FontSize'</span>, 15)
  txt_taxa(-2, 0.85, taxa, col_taxa);

  figure <span class="comment">% kap</span>
  hold <span class="string">on</span>
  surv_kap = surv(kap,0);
  m_kap = sum(kap &gt; .8)/ n_species;
  plot(surv_kap(:,1), surv_kap(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([0; .8; .8], [m_kap; m_kap; 0], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'\kappa, -'</span>)

  figure <span class="comment">% L_i - kap</span>
  hold <span class="string">on</span>
  scatter(log10(Li(TYPE&gt;0)), kap(TYPE&gt;0), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), kap(TYPE&gt;0 &amp; s_M == 1), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], 0.8 * [1; 1], <span class="string">'b'</span>, <span class="string">'linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  <span class="comment">%set(gca, 'ylim', [0 1], 'YTick', 0:.2:1)</span>
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'\kappa, -'</span>)
  txt_taxa(-2.2, 0.3, taxa, col_taxa);

  figure <span class="comment">% [p_M]</span>
  hold <span class="string">on</span>
  surv_pM = surv(pM,0);
  m_pM = sum(pM &gt; 20)/ n_species;
  plot(surv_pM(:,1), surv_pM(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([0; 20; 20], [m_pM; m_pM; 0], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'[p_M], J cm^{-1} d^{-1}'</span>)

  figure <span class="comment">% L_i - [p_M]</span>
  hold <span class="string">on</span>
  <span class="comment">%scatter(log10(Li(TYPE&gt;0)), log10(pM(TYPE&gt;0)), 60, color(TYPE&gt;0, :), 'LineWidth', 2)</span>
  scatter(log10(Li), log10(pM), 60, color, <span class="string">'LineWidth'</span>, 2)
  <span class="comment">%scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(pM(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), 'LineWidth', 4)</span>
  scatter(log10(Li(s_M == 1)), log10(pM(s_M == 1)), 20, color(s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(18) * [1; 1], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  set(gca, <span class="string">'ylim'</span>, [.25 4], <span class="string">'YTick'</span>, 0.5:1:4)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log [p_M], J cm^{-3} d^{-1}'</span>)
  txt_taxa(2, 3, taxa, col_taxa);

  figure <span class="comment">% L_i - [p_M]/ d_V</span>
  pMdV = pM ./ dV;
  hold <span class="string">on</span>
  scatter(log10(Li(TYPE&gt;0)), log10(pMdV(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(pMdV(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(180) * [1; 1], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  <span class="comment">%set(gca, 'ylim', [.25 4], 'YTick', 0.5:1:4)</span>
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log [p_M]/d_V, J g^{-1} d^{-1}'</span>)
  txt_taxa(2, 4.5, taxa, col_taxa);

  figure <span class="comment">% kap - [p_M]</span>
  hold <span class="string">on</span>
  scatter(kap(TYPE&gt;0), log10(pM(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(kap(TYPE&gt;0 &amp; s_M == 1), log10(pM(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  <span class="comment">%set(gca, 'xlim', [0 1])</span>
  <span class="comment">%set(gca, 'ylim', [.25 4], 'YTick', 0.5:1:4)</span>
  xlabel(<span class="string">'\kappa, -'</span>)
  ylabel(<span class="string">'_{10}log [p_M], J cm^{-3} d^{-1}'</span>)
  txt_taxa(.1, .5, taxa, col_taxa);

  figure <span class="comment">% k_J</span>
  hold <span class="string">on</span>
  surv_kJ = surv(kJ,0);
  m_kJ = sum(kJ &gt; .002)/ n_species;
  plot(surv_kJ(:,1), surv_kJ(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([0; .002; .002], [m_kJ; m_kJ; 0], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'k_J, d^{-1}'</span>)

  figure <span class="comment">% L_i - k_J</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(kJ(TYPE == 1 | TYPE == 2)),'.b', 'Markersize', 20)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(kJ(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(kJ(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(kJ(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(0.002) * [1; 1], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  set(gca, <span class="string">'ylim'</span>, [-8 -.5], <span class="string">'YTick'</span>, -8:2:1)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log k_J, d^{-1}'</span>)
  txt_taxa(-2, -6, taxa, col_taxa);

  figure <span class="comment">% [E_G]</span>
  hold <span class="string">on</span>
  surv_EG = surv(EG,0);
  m_EG = sum(EG &gt; 2800)/ n_species;
  plot(surv_EG(:,1), surv_EG(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([0; 2800; 2800], [m_EG; m_EG; 0], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'[E_G], J cm^{-1}'</span>)

  figure<span class="comment">% [E_G]/ d_V</span>
  EGdV = EG ./ dV;
  surv_EGdV = surv(EGdV,0);
  plot(surv_EGdV(:,1), surv_EGdV(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'[E_G]/ d_V, J g^{-1}'</span>)

  figure <span class="comment">% L_i - [E_G]/ d_V</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EGdV(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EGdV(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(EGdV(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(EGdV(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(28000) * [1; 1], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  set(gca, <span class="string">'ylim'</span>, [4.3 4.8], <span class="string">'YTick'</span>, 4.3:.1:4.8)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log [E_G]/d_V, J g^{-1}'</span>)
  txt_taxa(-2, -6, taxa, col_taxa);

  figure <span class="comment">% {p_Am}/ L_i</span>
  hold <span class="string">on</span>
  pAmLi = pAm ./ Li;
  surv_pAm = surv(log10(pAmLi), 0);
  EpAmLi = 20/ 0.8; <span class="comment">% J/d.cm^3, expected  {p_Am}/L_i for generlized animal</span>
  m_pAm = sum(log10(pAmLi)  &gt; log10(EpAmLi))/ n_species;
  plot(surv_pAm(:,1), surv_pAm(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([surv_pAm(1,1); log10(EpAmLi); log10(EpAmLi)], [m_pAm; m_pAm; 0], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log \{p_{Am}\}/L_\infy, J cm^{-3} d^{-1}'</span>)

  figure <span class="comment">% L_i - {p_Am}</span>
  hold <span class="string">on</span>
  scatter(log10(Li(TYPE&gt;0)), log10(pAmj(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0)), log10(pAm(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(pAm(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  <span class="comment">%plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(pAm(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(pAm(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(pAmj(TYPE == 3 | TYPE == 4)),'or', 'LineWidth', 2)</span>
  plot([-2; 2], log10(22.5) + [-2; 2], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  <span class="keyword">for</span> i = 1:n_species
    <span class="keyword">if</span> TYPE(i) &gt; 0 &amp;&amp; s_M(i) &gt; 1 <span class="comment">% TYPE(i) == 3 || TYPE(i) == 4</span>
      plot(log10(Li(i) * ones(2,1)), log10([pAmj(i); pAm(i)]),<span class="string">'-k'</span>, <span class="string">'Linewidth'</span>, 2)
    <span class="keyword">end</span>
  <span class="keyword">end</span>
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  set(gca, <span class="string">'ylim'</span>, [-.5 4.5], <span class="string">'YTick'</span>, 0:1:4)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log \{p_{Am}\}, J cm^{-2} d^{-1}'</span>)
  txt_taxa(-2, 3.5, taxa, col_taxa);

  figure <span class="comment">% E_H^b/ L_i^3</span>
  surv_EHb = surv(log10(EHb ./ Li.^3), 0);
  plot(surv_EHb(:,1), surv_EHb(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log E_H^b/ L_\infty^3, J/cm^2'</span>)

  figure <span class="comment">% L_i - E_H^b</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EHb(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EHb(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(EHb(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(EHb(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(275) - 3 + [-6; 6], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  <span class="comment">%set(gca, 'ylim', [-10 10], 'YTick', -10:5:10)</span>
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log E_H^b'</span>)
  txt_taxa(-2, 3.5, taxa, col_taxa);

  figure <span class="comment">% E_H^j/ L_i^3</span>
  surv_EHj = surv(log10(EHj ./ Li.^3), 0);
  plot(surv_EHj(:,1), surv_EHj(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10} log E_H^j/ L_\infty^3, J/cm^3'</span>)

  figure <span class="comment">% L_i - E_H^j</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EHj(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EHj(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(EHj(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(EHj(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(275) - 3 + [-6; 6], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  set(gca, <span class="string">'ylim'</span>, [-7 9], <span class="string">'YTick'</span>, -10:3:10)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log E_H^j'</span>)
  txt_taxa(-2, 3.5, taxa, col_taxa);

  figure <span class="comment">% E_H^p/ L_i^3</span>
  surv_EHp = surv(log10(EHp ./ Li.^3), 0);
  plot(surv_EHp(:,1), surv_EHp(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'_{10}log E_H^p/ L_\infty^3, J/cm^3'</span>)

  figure <span class="comment">% L_i - E_H^p</span>
  hold <span class="string">on</span>
  <span class="comment">%plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EHp(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)</span>
  <span class="comment">%plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EHp(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)</span>
  scatter(log10(Li(TYPE&gt;0)), log10(EHp(TYPE&gt;0)), 60, color(TYPE&gt;0, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; s_M == 1)), log10(EHp(TYPE&gt;0 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(166) + [-6; 6], <span class="string">'b'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  <span class="comment">%set(gca, 'ylim', [-5 10], 'YTick', -5:5:10)</span>
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log E_H^p'</span>)
  txt_taxa(-2, 3.5, taxa, col_taxa);

  figure <span class="comment">% L_i - h_a</span>
  hold <span class="string">on</span>
  scatter(log10(Li(TYPE&gt;0 &amp; sG &lt; 1e-3)), log10(ha(TYPE&gt;0 &amp; sG &lt; 1e-3)), 60, color(TYPE&gt;0 &amp; sG &lt; 1e-3, :), <span class="string">'LineWidth'</span>, 2)
  scatter(log10(Li(TYPE&gt;0 &amp; sG &lt; 1e-3 &amp; s_M == 1)), log10(ha(TYPE&gt;0 &amp; sG &lt; 1e-3 &amp; s_M == 1)), 20, color(TYPE&gt;0 &amp; sG &lt; 1e-3 &amp; s_M == 1, :), <span class="string">'LineWidth'</span>, 4)
  plot([-2; 2], log10(1e-6) + [2; -2], <span class="string">'k'</span>, <span class="string">'LineWidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  set(gca, <span class="string">'xlim'</span>, [-2.5 2.5], <span class="string">'XTick'</span>, -2:1:2)
  xlabel(<span class="string">'_{10}log L_\infty, cm'</span>)
  ylabel(<span class="string">'_{10}log h_a, d^{-2}'</span>)
  txt_taxa(-2, -15, taxa, col_taxa);

<span class="keyword">end</span>

  figure <span class="comment">% FIT</span>
  hold <span class="string">on</span>
  surv_FIT = surv(FIT,0);
  m_FIT = sum(FIT)/ n_species;
  M_FIT = sum(FIT &gt; m_FIT)/ n_species;
  plot(surv_FIT(:,1), surv_FIT(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([m_FIT; m_FIT; 0], [0; M_FIT; M_FIT], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlim([0 10]);
  xlabel(<span class="string">'FIT mark'</span>)

  figure <span class="comment">% COMPLETE</span>
  hold <span class="string">on</span>
  surv_COMPLETE = surv(COMPLETE,0);
  m_COMPLETE = sum(COMPLETE)/ n_species;
  M_COMPLETE = sum(COMPLETE &gt; m_COMPLETE)/ n_species;
  plot(surv_COMPLETE(:,1), surv_COMPLETE(:,2),<span class="string">'g'</span>, <span class="string">'Linewidth'</span>, 2)
  plot([m_COMPLETE; m_COMPLETE; 0], [0; M_COMPLETE; M_COMPLETE], <span class="string">'r'</span>, <span class="string">'Linewidth'</span>, 2)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'COMPLETE mark'</span>)

  figure <span class="comment">% COMPLETE - FIT</span>
  plot(COMPLETE, FIT,<span class="string">'.r'</span>,<span class="string">'MarkerSize'</span>, 20)
  set(gca, <span class="string">'FontSize'</span>, 15, <span class="string">'Box'</span>, <span class="string">'on'</span>)
  xlabel(<span class="string">'COMPLETE mark'</span>)
  ylabel(<span class="string">'FIT mark'</span>)
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [pars vars TYPE FIT COMPLETE] = shprimary_parameters 
% created at 2013/08/01 by <NAME> 
%
%% Description
%  plots parameters in Species.xls, which can be found at http://www.bio.vu.nl/thb/deb/deblab/
%  the present path-setting assumes that the file Species.xls is in subdir add_my_pet
%
%% Input
%  the file Species.xls
%
%% Output
%  lots of figures
%
%% Remarks
%  A desciption of pars and vars can be found in report_init
%
%% Example of use
%  [pars vars TYPE FIT COMPLETE] = shprimary_parameters 

  file = '/add_my_pet/Species.xls';
  read_Species

  if 0
    mv = mean(v); mvj = mean(vj);
    cv = std(v)/mv; cvj = std(vj)/mvj; % -, variation coeff of v, vj
    txt = {'before acceleration'; 'after acceleration'};
    printpar(txt, [mv; mvj], [cv; cvj], 'energy conductance mean, var coeff');
  end
  
  close all
  
if 1
    
  figure % L_i 
  hold on
  surv_Li = surv(Li, 0);
  m_Li = sum(Li  > 1)/ n_species;
  plot(surv_Li(:,1), surv_Li(:,2),'g', 'Linewidth', 2)
  plot([0; 1; 1], [m_Li; m_Li; 0], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  ylim([0;1]);
  xlabel('L_\infty, cm')
  
  figure % v
  hold on
  surv_v = surv(v,0);  surv_vj = surv(vj,0); 
  m_v = sum(v > .02)/ n_species;
  plot(surv_v(:,1), surv_v(:,2),'b', 'Linewidth', 2)
  plot(surv_vj(:,1), surv_vj(:,2),'r', 'Linewidth', 2)
  plot([0; .02; .02], [m_v; m_v; 0], 'g', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('v, cm d^{-1}')
  taxa_loc = {'v_b'; 'v_j'}; col_taxa_loc = [0 0 1; 1 0 0];
  txt_taxa(1, .8, taxa_loc, col_taxa_loc);

  figure % L_i - v
  hold on
  scatter(log10(Li(TYPE>0)), log10(vj(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(v(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(v(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2;2], [log10(0.02); log10(0.02)],'b', 'linewidth', 2)
  for i = 1:n_species
    if TYPE(i) > 0 && s_M(i) > 1 % TYPE(i) == 3 || TYPE(i) == 4
      %plot(log10(Li(i)), log10(v(i)), 'ob', 'linewidth', 2)
      %plot(log10(Li(i)), log10(vj(i)), 'or', 'linewidth', 2)
      plot(log10(Li(i) * ones(2,1)), log10([vj(i); v(i)]),'-k', 'Linewidth', 2)
    %elseif TYPE(i) == 1 || TYPE(i) == 2
      %plot(log10(Li(i)), log10(v(i)), '.b', 'markersize', 20)
    end
  end
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  %set(gca, 'ylim', [-3 0.5], 'YTick', -2:.5:0.5)
  xlabel('_{10}log L_\infty, cm', 'FontSize', 15)
  ylabel('_{10}log v, cm d^{-1}', 'FontSize', 15)
  txt_taxa(-2, 0.85, taxa, col_taxa);

  figure % kap
  hold on
  surv_kap = surv(kap,0);  
  m_kap = sum(kap > .8)/ n_species;
  plot(surv_kap(:,1), surv_kap(:,2),'g', 'Linewidth', 2)
  plot([0; .8; .8], [m_kap; m_kap; 0], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('\kappa, -')

  figure % L_i - kap
  hold on
  scatter(log10(Li(TYPE>0)), kap(TYPE>0), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), kap(TYPE>0 & s_M == 1), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], 0.8 * [1; 1], 'b', 'linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  %set(gca, 'ylim', [0 1], 'YTick', 0:.2:1)
  xlabel('_{10}log L_\infty, cm')
  ylabel('\kappa, -')
  txt_taxa(-2.2, 0.3, taxa, col_taxa);

  figure % [p_M]
  hold on
  surv_pM = surv(pM,0);  
  m_pM = sum(pM > 20)/ n_species;
  plot(surv_pM(:,1), surv_pM(:,2),'g', 'Linewidth', 2)
  plot([0; 20; 20], [m_pM; m_pM; 0], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('[p_M], J cm^{-1} d^{-1}')

  figure % L_i - [p_M]
  hold on
  %scatter(log10(Li(TYPE>0)), log10(pM(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li), log10(pM), 60, color, 'LineWidth', 2)
  %scatter(log10(Li(TYPE>0 & s_M == 1)), log10(pM(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  scatter(log10(Li(s_M == 1)), log10(pM(s_M == 1)), 20, color(s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(18) * [1; 1], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  set(gca, 'ylim', [.25 4], 'YTick', 0.5:1:4)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log [p_M], J cm^{-3} d^{-1}')
  txt_taxa(2, 3, taxa, col_taxa);
  
  figure % L_i - [p_M]/ d_V
  pMdV = pM ./ dV;
  hold on
  scatter(log10(Li(TYPE>0)), log10(pMdV(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(pMdV(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(180) * [1; 1], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  %set(gca, 'ylim', [.25 4], 'YTick', 0.5:1:4)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log [p_M]/d_V, J g^{-1} d^{-1}')
  txt_taxa(2, 4.5, taxa, col_taxa);

  figure % kap - [p_M]
  hold on
  scatter(kap(TYPE>0), log10(pM(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(kap(TYPE>0 & s_M == 1), log10(pM(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  set(gca, 'FontSize', 15, 'Box', 'on')
  %set(gca, 'xlim', [0 1])
  %set(gca, 'ylim', [.25 4], 'YTick', 0.5:1:4)
  xlabel('\kappa, -')
  ylabel('_{10}log [p_M], J cm^{-3} d^{-1}')
  txt_taxa(.1, .5, taxa, col_taxa);

  figure % k_J
  hold on
  surv_kJ = surv(kJ,0);  
  m_kJ = sum(kJ > .002)/ n_species;
  plot(surv_kJ(:,1), surv_kJ(:,2),'g', 'Linewidth', 2)
  plot([0; .002; .002], [m_kJ; m_kJ; 0], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('k_J, d^{-1}')

  figure % L_i - k_J
  hold on
  %plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(kJ(TYPE == 1 | TYPE == 2)),'.b', 'Markersize', 20)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(kJ(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(kJ(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(kJ(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(0.002) * [1; 1], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  set(gca, 'ylim', [-8 -.5], 'YTick', -8:2:1)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log k_J, d^{-1}')
  txt_taxa(-2, -6, taxa, col_taxa);

  figure % [E_G]
  hold on
  surv_EG = surv(EG,0);  
  m_EG = sum(EG > 2800)/ n_species;
  plot(surv_EG(:,1), surv_EG(:,2),'g', 'Linewidth', 2)
  plot([0; 2800; 2800], [m_EG; m_EG; 0], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('[E_G], J cm^{-1}')
  
  figure% [E_G]/ d_V
  EGdV = EG ./ dV;
  surv_EGdV = surv(EGdV,0);
  plot(surv_EGdV(:,1), surv_EGdV(:,2),'g', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('[E_G]/ d_V, J g^{-1}')

  figure % L_i - [E_G]/ d_V
  hold on
  %plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EGdV(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EGdV(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(EGdV(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(EGdV(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(28000) * [1; 1], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  set(gca, 'ylim', [4.3 4.8], 'YTick', 4.3:.1:4.8)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log [E_G]/d_V, J g^{-1}')
  txt_taxa(-2, -6, taxa, col_taxa);

  figure % {p_Am}/ L_i
  hold on
  pAmLi = pAm ./ Li;
  surv_pAm = surv(log10(pAmLi), 0);
  EpAmLi = 20/ 0.8; % J/d.cm^3, expected  {p_Am}/L_i for generlized animal
  m_pAm = sum(log10(pAmLi)  > log10(EpAmLi))/ n_species;
  plot(surv_pAm(:,1), surv_pAm(:,2),'g', 'Linewidth', 2)
  plot([surv_pAm(1,1); log10(EpAmLi); log10(EpAmLi)], [m_pAm; m_pAm; 0], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log \{p_{Am}\}/L_\infy, J cm^{-3} d^{-1}')

  figure % L_i - {p_Am}
  hold on
  scatter(log10(Li(TYPE>0)), log10(pAmj(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(pAm(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(pAm(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  %plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(pAm(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(pAm(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(pAmj(TYPE == 3 | TYPE == 4)),'or', 'LineWidth', 2)
  plot([-2; 2], log10(22.5) + [-2; 2], 'b', 'LineWidth', 2)
  for i = 1:n_species
    if TYPE(i) > 0 && s_M(i) > 1 % TYPE(i) == 3 || TYPE(i) == 4
      plot(log10(Li(i) * ones(2,1)), log10([pAmj(i); pAm(i)]),'-k', 'Linewidth', 2)
    end
  end
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  set(gca, 'ylim', [-.5 4.5], 'YTick', 0:1:4)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log \{p_{Am}\}, J cm^{-2} d^{-1}')
  txt_taxa(-2, 3.5, taxa, col_taxa);
  
  figure % E_H^b/ L_i^3
  surv_EHb = surv(log10(EHb ./ Li.^3), 0);
  plot(surv_EHb(:,1), surv_EHb(:,2),'g', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log E_H^b/ L_\infty^3, J/cm^2')

  figure % L_i - E_H^b
  hold on
  %plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EHb(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EHb(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(EHb(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(EHb(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(275) - 3 + [-6; 6], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  %set(gca, 'ylim', [-10 10], 'YTick', -10:5:10)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log E_H^b')
  txt_taxa(-2, 3.5, taxa, col_taxa);
  
  figure % E_H^j/ L_i^3
  surv_EHj = surv(log10(EHj ./ Li.^3), 0);
  plot(surv_EHj(:,1), surv_EHj(:,2),'g', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10} log E_H^j/ L_\infty^3, J/cm^3')

  figure % L_i - E_H^j
  hold on
  %plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EHj(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EHj(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(EHj(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(EHj(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(275) - 3 + [-6; 6], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  set(gca, 'ylim', [-7 9], 'YTick', -10:3:10)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log E_H^j')
  txt_taxa(-2, 3.5, taxa, col_taxa);

  figure % E_H^p/ L_i^3
  surv_EHp = surv(log10(EHp ./ Li.^3), 0);
  plot(surv_EHp(:,1), surv_EHp(:,2),'g', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('_{10}log E_H^p/ L_\infty^3, J/cm^3')

  figure % L_i - E_H^p
  hold on
  %plot(log10(Li(TYPE == 1 | TYPE == 2)), log10(EHp(TYPE == 1 | TYPE == 2)),'.b', 'MarkerSize', 20)
  %plot(log10(Li(TYPE == 3 | TYPE == 4)), log10(EHp(TYPE == 3 | TYPE == 4)),'ob', 'LineWidth', 2)
  scatter(log10(Li(TYPE>0)), log10(EHp(TYPE>0)), 60, color(TYPE>0, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & s_M == 1)), log10(EHp(TYPE>0 & s_M == 1)), 20, color(TYPE>0 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(166) + [-6; 6], 'b', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  %set(gca, 'ylim', [-5 10], 'YTick', -5:5:10)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log E_H^p')
  txt_taxa(-2, 3.5, taxa, col_taxa);

  figure % L_i - h_a
  hold on
  scatter(log10(Li(TYPE>0 & sG < 1e-3)), log10(ha(TYPE>0 & sG < 1e-3)), 60, color(TYPE>0 & sG < 1e-3, :), 'LineWidth', 2)
  scatter(log10(Li(TYPE>0 & sG < 1e-3 & s_M == 1)), log10(ha(TYPE>0 & sG < 1e-3 & s_M == 1)), 20, color(TYPE>0 & sG < 1e-3 & s_M == 1, :), 'LineWidth', 4)
  plot([-2; 2], log10(1e-6) + [2; -2], 'k', 'LineWidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  set(gca, 'xlim', [-2.5 2.5], 'XTick', -2:1:2)
  xlabel('_{10}log L_\infty, cm')
  ylabel('_{10}log h_a, d^{-2}')
  txt_taxa(-2, -15, taxa, col_taxa);

end

  figure % FIT
  hold on
  surv_FIT = surv(FIT,0);  
  m_FIT = sum(FIT)/ n_species; 
  M_FIT = sum(FIT > m_FIT)/ n_species;
  plot(surv_FIT(:,1), surv_FIT(:,2),'g', 'Linewidth', 2)
  plot([m_FIT; m_FIT; 0], [0; M_FIT; M_FIT], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlim([0 10]);
  xlabel('FIT mark')

  figure % COMPLETE
  hold on
  surv_COMPLETE = surv(COMPLETE,0);  
  m_COMPLETE = sum(COMPLETE)/ n_species; 
  M_COMPLETE = sum(COMPLETE > m_COMPLETE)/ n_species;
  plot(surv_COMPLETE(:,1), surv_COMPLETE(:,2),'g', 'Linewidth', 2)
  plot([m_COMPLETE; m_COMPLETE; 0], [0; M_COMPLETE; M_COMPLETE], 'r', 'Linewidth', 2)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('COMPLETE mark')

  figure % COMPLETE - FIT
  plot(COMPLETE, FIT,'.r','MarkerSize', 20)
  set(gca, 'FontSize', 15, 'Box', 'on')
  xlabel('COMPLETE mark')
  ylabel('FIT mark')

##### SOURCE END #####
--></body></html>

<|start_filename|>docs/DEBtool_microbe.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_microbe</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: microbe</H3>

Micro-organisms in reactors: 1 reserve, 1 structure, V1-morph

<HR>
<H4><A NAME="microbe">microbe</A></H4>

  <P>
  Demo that runs:
  <UL>
    <LI> <A HREF="#pars_microbe"><code>pars_microbe</code></A>: parameter setting </LI>
    <LI> <A HREF="#shbatch"><code>shbatch</code></A>: batch culture </LI>
    <LI> <A HREF="#shchemostat"><code>shchemostat</code></A>: chemostat in equilibrium </LI>
    <LI> <A HREF="#shflux_microbe"><code>shflux_microbe</code></A>: fluxes to/from a chemostat </LI>
    <LI> <A HREF="#shratio_microbe"><ccde>shratio_microbe</code></A>: Respiration, Watering, Urination Quotients </LI>
  </UL>

  The microbe is decomposed in:<BR>
  structure (V) and general reserves (E)

  <P>
   Organic compounds:<BR>
     X = substrate, V = structure, E = reserve, P = product(s)<BR>
   Mineral compounds:<BR>
     C = carbon dioxide, H = water, O = dioxygen, N = ammonia

  <P>
   Uptake is proportional to surface area, which is taken to be proportional to the structural volume: V1-morph. 
   This removes the distinction between the individual and the population level.

  <P>
  The simplification k_J = k_M*(1 - kap)/kap is implemented, which makes this energy-structured model also size-structured.
  The microbe divides when the structural mass exceeds a threshold value

  <P>
  In a generalized reactor, the specific supply and draining rates can be set independently for all compounds. 
  If they are chosen to be equal, we have a chemostat. 
  If the specific draining rates are set to zero, we have a fed-batch reactor; 
  if the specific supply rate set to zero as well, we have a batch-reactor.

  <P>
  Example of use after (optionally) editing file <code>pars_microbe.m</code>: 
  <CODE>microbe</CODE>

<HR>
<H4><A NAME="pars_microbe">pars_microbe</A></H4>

  Set the parameters by editing file <code>pars_microbe.m</code> in toolbox <code>microbe</code>.

<HR>
<H4><A NAME="shbatch">shbatch</A></H4>

  Batch reactor; Initial conditions can be changed by editing file <code>shbatch.m</code>.  
  See pages 315 ff of the 
  <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book</A>.<BR>
  Four figures are shown of variables against time

  <P>
  fig <B>1</B><BR>
  Living (green, drawn) and and dead (green, stippled) structure;
  living (red, drawn) and dead (red, stippled) reserve. All in Molar.

  <P>
  fig <B>2</B><BR> 
  Living (brown, drawn) and dead (brown, stippled) biomass (so structure plus reserve) in gram per litre.

  <P>
  fig <B>3</B><BR>
  Substrate (green, drawn) in Molar

  <P>
  fig <B>4</B><BR>
  Product (red, drawn) in Molar. 
  Think, for instance of penicillin, or acetate.  
  It is not difficult to extend the routine to include more types of product.

  <P>
  Example of use after editing <code>pars_microbe.m</code>: 
  <CODE>clear all; pars_microbe; shbatch</CODE>.<BR> 
  The command <CODE>clear; pars_microbe; shbatch (4)</CODE> will only plot fig <B>4</B>.


<HR>
<H4><A NAME="shchemostat">shchemostat</A></H4>

  Chemostat reactor in equilibrium. 
  See pages 147, 312 ff of the
  <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">
  DEB-book</A>.<BR> 
  Six figures are shown of variables against throughput rate

  <P>
  fig <B>1</B><BR>
  Living (green, drawn) and dead (green, stippled) structure;
  living (red, drawn) and dead (red, stippled) reserve, all in Molar

  <P>
  fig <B>2</B><BR> Living (brown, drawn) and dead (brown, stippled) biomass (so structure plus reserve) (red, drawn) in gram per litre.

  <P>
  fig <B>3</B><BR> 
  Fraction of dead structure (brown) in M/M.

  <P>
  fig <B>4</B><BR>
  Substrate (green) in the medium in Molar.

  <P>
  fig <B>5</B><BR>
  Product (brown) in the medium in Molar.

  <P>
  fig <B>6</B><BR>
  Heat production (red) in kJ/d by the biomass in the reactor. 

  <P>
  Example of use after editing <code>pars_microbe.m</code>: 
  <CODE>clear all; pars; shchemostat</CODE>.<BR> 
  The command <CODE>clear; pars; shchemostat(5)</CODE> will only plot fig <B>5</B>.

<HR>
<H4><A NAME="shflux_microbe">shflux_microbe</A></H4>
 
  This routine is similar to shchemostat, but presents scaled fluxes, rather than states: the ratio of the fluxes and the flux of substrate, or the flux of structure, or the total weight (living plus dead biomass).

  <p>
  fig <B>1</B><BR>
  Scaled flux of structure (green), reserve (red), product (black)

  <p>
  fig <B>2</B><BR>
  Scaled flux of carbon dioxide (black) and water (blue)

  <p>
  fig <B>3</B><BR>
  Scaled flux of dioxygen (black) and ammonia (blue)

  <p>
  fig <B>4</B><BR>
  Scaled flux of dissipating heat (red)

  <p>
  fig <B>5-8</B><BR>
  Similar to figs 1-4, but the fluxes are divided by the flux of (living) structure, rather than that of substrate. 
  Fig 5 shows the scaled flux of substrate rather than the scaled flux of structure (cf fig 1), for obvious reasons.

  <p>
  fig <B>9-12</B><BR>
  Similar to figs 1-4, but the fluxes are divided by the weight of biomass  (living plus dead), rather than the scaled flux of substrate.

  <P>
  Example of use after editing <code>pars_microbe.m</code>: 
  <CODE>clear all; pars_microbe; shflux_microbe</CODE>.<BR> 
  The command <CODE>clear; pars_microbe; shflux_microbe (2)</CODE> will only plot fig <B>2</B>.

<HR>
<H4><A NAME="chemostat">chemostat</A></H4>
 
  Calculates states, powers, organic and mineral fluxes. 
  (Used by <code>shchemostat</code> and <code>shflux_microbe</code>)

  <P>
  Input:
  <ul>
    <li> vector with throughput rates </li>
    <li> scalar with substrate concentration in the feed </li>
  </ul>
  
  <p>
  Output:
  4 matrices (throughput rates in rows). 
  In columns:
  <ul>  
    <li> states (6xM, 2xg/l): X, X_V, X_E, X_P, X_DV, X_DE, X_W, X_DW <BR>
         (1)substrate, (2)structure, (3)reserve, (4)product, <BR>
         (5)dead structure, (6)dead reserve, (7) living weight, (8) dead weight </li>
    <li> powers (kJ/d): p_T, p_A, p_D, p_G <BR>
         (1)heat, (2)assimilation, (3)dissipation, (4)growth </li>
    <li> organic fluxes (mol/d): J_X, J_V, J_E, J_P <BR>
         (1)substrate, (2)structure, (3)reserve, (4)product </li>
    <li> mineral fluxes (mol/d): J_C, J_H, J_O, J_N <BR>
         (1)carbon dioxide, (2)water, (3)dioxygen, (4)ammonia </li>
  </ul>

  <P>
  Example of use:<BR>
  <CODE>clear; pars; [Xh, ph, JOh, JMh] = chemostat ([.1 .2], 1);</CODE>

<HR>
<H4><A NAME="shratio_microbe">shratio_microbe</A></H4>

  Routine that produces three plots that show ratios of mineral fluxes as functions of the specific growth rate. 
  All fluxes are in terms of mol per time; the ratio's are dimensionless. 
  See pages 143 and 167 of the 
  <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB-book</A>. 
  Contrary to the similar routine in toobox <code>animal</code>, the contribution of assimilation is here taken into account, and no changes in signs are made. 
  (The signs depend on the composition of substrate and biomass, but the substrate can here be chosen from a wide range.)

  <P>
  fig <B>1</B><BR>
  Respiration Quotient: 
  ratio of carbon dioxide and dioxygen fluxes

  <P>
  fig <B>2</B><BR> 
  Watering Quotient: 
  ratio of water and dioxygen fluxes

  <P>
  fig <B>3</B><BR> 
  Urination Quotient: 
  ratio of nitrogen waste and  dioxygen fluxes
  
  <P>
  Example of use after editing <code>pars_microbe.m</code>: 
  <CODE>clear all; pars; shratio_microbe</CODE>.<BR> 
  The command <CODE>clear; pars; shratio_microbe (2)</CODE> will only plot fig <B>2</B>.

<HR>
<H4><A NAME="batch">batch</A></H4>

  Subroutine that specifies nutrient limited growth in a batch culture.
  The special case of no-maintenance and a very small saturation constant has been coded, which results in expo-logistic growth (see
  <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html">DEB book</A> page 355).

  <P>
  The script file <code>mydata_batch</code> illustrates the application of this subroutine in parameter estimation and plotting routines.

  <P>
  Input:
  <UL>
    <LI> p: 5-vector with parameter values
      <OL>
        <LI> mM, initial nutrient conc </LI>
        <LI> OD, initial biomass </LI>
        <LI> mM/(h.OD) max spec uptake rate </LI>
        <LI> -, investment ratio </LI>
        <LI> 1/h, reserve turnover </LI>
      </OL></LI>  
    <LI> tN: (ntN,3)-matrix with times in tN(:,1) for nutrient conc </LI>
    <LI> tX: (ntX,3)-matrix with times in tX(:,1) for biomass density </LI>
  </UL>

  <P>
  Ouput:
  <UL>
    <LI> Nt: (ntN,1)-matrix with nutrient concentrations </LI>
    <LI> Xt: (ntX,1)-matrix with biomass densities </LI>
  </UL>

  <P>
  Running mydata_batch shows 2 plots of the potassium concentration and of the biomass of <I>Escherichia coli</I> against time. 
  Notice the continuation of growth in absence of potassium, which reflects the presence of intracellular storage of potassium.

<HR>
<H4><A NAME="adapt">adapt</A></H4>

  Subroutine that specifies slow adaptation to substrate availability and mutual inhibition of the uptake of two substrates in a batch culture. 
  The special case of 2 substrates and 4 batch cultures has been coded. 
  The theory is given in<BR>   
  <A HREF="http://www.bio.vu.nl/thb/research/bib/BranKelp2004.html">
  <NAME>., <NAME>., <NAME>, Kooijman, <NAME>. 2004.
  Modelling microbial adaptation to changing availability of substrates.
  <i>Water Res.</i> <b>38</b>: 1003--1013</A>

  <P>
  The script file <code>mydata_adapt</code> illustrates the application of this subroutine in parameter estimation and plotting routines.

  <P>
  Input:
  <UL>
    <LI> a 35-vector with parameter values
      <OL>
        <LI> mM, saturation constant for substr A </LI>
        <LI> mM, inhibition constant for substr A on B </LI>
        <LI> mM, saturation constant for substr B </LI>
        <LI> mM, inhibition constant for substr B on A </LI>
        <LI> mM/(mol.h), max spec uptake rate for substr A </LI>
        <LI> mM/(mol.h), max spec uptake rate for substr B </LI>
        <LI> -, rel background expression for substr A </LI>
        <LI> -, rel background expression for substr B </LI>
        <LI> -, preference parameter for substr A; pB = 1 - pA </LI>
        <LI> 1/h, carrier turnover rate </LI>
        <LI> mol/mol yield of substr A on reserves </LI>
        <LI> mol/mol yield of substr B on reserves </LI>
        <LI> mol/mol yield of reserve on structure </LI>
        <LI> 1/h, reserve turnover rate </LI>
        <LI> 1/h, maintenance rate coefficient </LI>
        <LI> mM, substr A in cult 1 at time 0 </LI>
        <LI> mM, substr B in cult 1 at time 0 </LI>
        <LI> mM, biomass in cult 1 at time 0 </LI>
        <LI> mol/mol, res density in cult 1 at time 0 </LI>
        <LI> -, rel expresion for substr A </LI>
        <LI> mM, substr A in cult 2 at time 0 </LI>
        <LI> mM, substr B in cult 2 at time 0 </LI>
        <LI> -, biomass in cult 2 at time 0 </LI>
        <LI> -, res density in cult 2 at time 0 </LI>
        <LI> -, rel expresion for substr A </LI>
        <LI> mM, substr A in cult 3 at time 0 </LI>
        <LI> mM, substr B in cult 3 at time 0 </LI>
        <LI> -, biomass in cult 3 at time 0 </LI>
        <LI> -, res density in cult 3 at time 0 </LI>
        <LI> -, rel expresion for substr A </LI>
        <LI> mM, substr A in cult 4 at time 0 </LI>
        <LI> mM, substr B in cult 4 at time 0 </LI>
        <LI> -, biomass in cult 4 at time 0 </LI>
        <LI> -, res density in cult 4 at time 0 </LI>
        <LI> -, rel expresion for substr A </LI>
      </OL> 
    </LI>
    <LI> 4 data matrices with times and biomass measurements </LI>
  </UL>

  <P>
  The output is 4 vectors with predictions of biomasses. 
  The number of cultures can easily be adapted.
  
  <P>
  Running mydata_adapt shows 4 plots of biomass of <I>Klebsiella oxytoca</I> against time 
  in 4 batch cultures with different initial concentrations of glucose and xylose; in g/l: 
  (1) 5.8, 0 (2) 0, 4.7 (3) 0.5, 2.5 (4) 0.33, 2.0. 
  The bacteria were precultured on glucose. Data and model predictions are shown. 
  Diauxic growth is clearly visible (in the last two cultures).

<HR>
<H4><A NAME="yield">yield</A></H4>

  Calculates the yield coefficients for mineral and organic compounds, given the chemical indices of the organic compounds.

  <p>
  Input: 
  (4,4)-matrix with 
  chemical indices for energy and carbon substrate, reserve, structure in the columns, and 
  chemical element C, H, O, N in the rows.

  <p>
  Output: 
  (8,5)-matrix with yield coefficients with 
  mineral and organic compounds in the rows (CO<sub>2</sub>, H<sub>2</sub>O, O<sub>2</sub>, NH<sub>3</sub>, 
  energy and carbon substrate, reserve, structure) and processes in the columns 
  (catabolic and anabolic aspects of assimilation, maintenance, catabolic and anabolic aspects of growth).

  <p>
  Example of use: see mydata_reaction_eq

<HR>
<H4><A NAME="flux_5">flux_5</A></H4>

  Calculates the specific fluxes for catabolic and anabolic aspects of assimilation, maintenance, catabolic and anabolic aspects of growth.

  <p>
  Input:
  <ul>
    <li> n-vector with specific growth rates </li>
    <li> 5-vector with parameter values: 
       <ol>
         <li> yield of reserve on substrate (mol/mol) </li>
         <li> yield of structure on reserve (mol/mol) </li>
         <li> max spec assimilation flux (mol/mol.h) </li>
         <li> reserve turnover rate (1/h) </li>
         <li> maintenance rate coefficient (1/h) </li>
       </ol>
    </li>
  </ul>

  <p>
  Output: 
  (n,5)-matrix with fluxes in the columns 
  (catabolic and anabolic aspects of assimilation, maintenance, catabolic and anabolic aspects of growth).

  <p>
  Example of use: 
  see mydata_reaction_eq

<HR>
<H4><A NAME="entropy">entropy</A></H4>

  Calculates the entropy of a CHON compound under aerobic conditions in J/mol.K, on the basis of the entropies 
  214.70 J/mol.K for CO<sub>2</sub>, 
  72.331 J/mol.K for H<sub>2</sub>O, 
  205.80 J/mol.K for O<sub>2</sub> and 
  112.34] J/mol.K for NH<sub>3</sub>.

  <p>
  Input: 
  4-vector with chemical indices for elements C, H, O, N.

  <p>
  Output: 
  scalar with entropy of CHON-compound in J/mol.K

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML> 


<|start_filename|>animal/html/report_xls.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>report_xls</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="report_xls.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">Description</a></li><li><a href="#3">sheet 1: list of species</a></li><li><a href="#4">sheet 2: primary parameters for all species</a></li><li><a href="#5">sheet 3: statistics for all species</a></li><li><a href="#6">sheet species; one sheet per species</a></li><li><a href="#7">prepare for a next species</a></li></ul></div><pre class="codeinput"><span class="comment">% created 2009/07/11 by <NAME>, modified by <NAME> 2013/01/15</span>
<span class="comment">%</span>
</pre><h2>Description<a name="2"></a></h2><pre>writes report input parameters and output statistics
 to Excel-file file_name set in pars_my_pets
 assumes that report (and so parscomp) and report_xls_init have been run previously
   and report_xls_close afterwards
 txt_statistics, val_statistics, txt_par, val_par, txt_mudn are set in report</pre><pre class="codeinput"><span class="keyword">if</span> exist(<span class="string">'n_spec'</span>,<span class="string">'var'</span>)==0
  report_xls_init
<span class="keyword">end</span>

report_html <span class="comment">%  hmtl reporting parallel to xls</span>

n_spec = n_spec + 1; <span class="comment">% increment row number; initiated in report_xls_init</span>
txt_row = num2str(n_spec);
</pre><h2>sheet 1: list of species<a name="3"></a></h2><pre class="codeinput">  hyper_species = [<span class="string">'=HYPERLINK("['</span>, file_name, <span class="string">'.xls]'</span>, species, <span class="string">'!A1";"'</span>, species,<span class="string">'")'</span>];
  xlswrite(file_name, {phylum, class, order, family, hyper_species, species_en, TYPE, FIT, COMPLETE, data_0{:}, data_1{:}}, <span class="string">'species_list'</span>, [<span class="string">'A'</span>, txt_row])

  <span class="comment">% colour font for data_0 and data_1</span>
  n_data_0 = size(data_0,1); n_0_start = 1 + 9;       n_0_end = n_0_start + n_data_0 - 1;
    cell_0_start = cell_name{n_0_start}; cell_0_end = cell_name{n_0_end}; <span class="comment">% cell_name is defined in report_xls_init</span>
  n_data_1 = size(data_1,1); n_1_start = 1 + n_0_end; n_1_end = n_1_start + n_data_1 - 1;
    cell_1_start = cell_name{n_1_start}; cell_1_end = cell_name{n_1_end};

  excelObj = actxserver(<span class="string">'Excel.Application'</span>); <span class="comment">%opens up an excel object</span>
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  <span class="comment">% column width</span>
  excelObj.sheets.Item(<span class="string">'species_list'</span>).Range(<span class="string">'E:F'</span>).ColumnWidth = 20; <span class="comment">% species, common name-column are broad</span>
  excelObj.sheets.Item(<span class="string">'species_list'</span>).Range(<span class="string">'G:I'</span>).ColumnWidth = 4;  <span class="comment">% TYPE,COMPLETE,FIT-column are narrow</span>
  <span class="comment">% colour cells fit TYPE FIT and COMPLETE</span>
  excelObj.sheets.Item(<span class="string">'species_list'</span>).Range([<span class="string">'G2:I'</span>, num2str(n_spec)]).Interior.ColorIndex = 36;
  <span class="comment">% colour data types</span>
  <span class="keyword">if</span> n_data_0 &gt; 0
    excelObj.sheets.Item(1).Range([cell_0_start, txt_row, <span class="string">':'</span>, cell_0_end, txt_row]).Font.ColorIndex = 5; <span class="comment">% blue for zero-variate data</span>
  <span class="keyword">end</span>
  <span class="keyword">if</span> n_data_1 &gt; 0
    excelObj.sheets.Item(1).Range([cell_1_start, txt_row, <span class="string">':'</span>, cell_1_end, txt_row]).Font.ColorIndex = 10; <span class="comment">% green for uni-variate data</span>
  <span class="keyword">end</span>
  excelWorkbook.Save;         <span class="comment">% save font change</span>
  excelWorkbook.Close(false); <span class="comment">% closes excel object</span>
  excelObj.Quit;
  delete(excelObj);
</pre><h2>sheet 2: primary parameters for all species<a name="4"></a></h2><pre class="codeinput">  xlswrite(file_name, {hyper_species}, <span class="string">'primary_parameters'</span>, [<span class="string">'A'</span>, txt_row]);

  <span class="comment">% sequence of par_prim equals that of header in report_xls_init</span>
  <span class="comment">% present rates at reference temperature</span>
  par_primary = [ <span class="keyword">...</span>
      T; T_A; T_L; T_H; T_AL; T_AH;
      f; z; del_M; FT_m; kap_X; kap_X_P;
      p_Am; v; kap; kap_R; p_M; p_T; k_J; E_G;
      E_Hb; E_Hj; E_Hp; h_a; s_G;
      mu_X; mu_V; mu_E; mu_P;
      d_O;
      n_O(2:4,1); n_O(2:4,2);
      n_O(2:4,3); n_O(2:4,4)];

  xlswrite(file_name, par_primary', <span class="string">'primary_parameters'</span>, [<span class="string">'B'</span>, txt_row,<span class="string">':AT'</span>, txt_row]);

  <span class="comment">% colour cells</span>
  excelObj = actxserver(<span class="string">'Excel.Application'</span>); <span class="comment">%opens up an excel object</span>
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range(<span class="string">'A:A'</span>).ColumnWidth = 20; <span class="comment">% species-column is broad</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'A1:A'</span>, txt_row]).Interior.ColorIndex = 36; <span class="comment">% species list</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'B1:G'</span>, txt_row]).Interior.ColorIndex = 22; <span class="comment">% temp pars</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'H1:H'</span>, txt_row]).Interior.ColorIndex = 38; <span class="comment">% scaled func resp</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'I1:J'</span>, txt_row]).Interior.ColorIndex =  7; <span class="comment">% zoom, del_M</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'K1:N'</span>, txt_row]).Interior.ColorIndex = 43; <span class="comment">% assimilation</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'O1:Q'</span>, txt_row]).Interior.ColorIndex =  4; <span class="comment">% reserve, reprod</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'R1:T'</span>, txt_row]).Interior.ColorIndex =  6; <span class="comment">% maintenance</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'U1:U'</span>, txt_row]).Interior.ColorIndex = 19; <span class="comment">% growth</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'V1:X'</span>, txt_row]).Interior.ColorIndex = 17; <span class="comment">% life stages</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'Y1:Z'</span>, txt_row]).Interior.ColorIndex = 24; <span class="comment">% ageing</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'AA1:AD'</span>,txt_row]).Interior.ColorIndex = 42; <span class="comment">% chem potentials</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'AE1:AH'</span>,txt_row]).Interior.ColorIndex = 34; <span class="comment">% densities</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'AI1:AK'</span>,txt_row]).Interior.ColorIndex = 28; <span class="comment">% chem indices X</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'AL1:AN'</span>,txt_row]).Interior.ColorIndex = 33; <span class="comment">% chem indices V</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'AO1:AQ'</span>,txt_row]).Interior.ColorIndex = 28; <span class="comment">% chem indices E</span>
  excelObj.sheets.Item(<span class="string">'primary_parameters'</span>).Range([<span class="string">'AR1:AT'</span>,txt_row]).Interior.ColorIndex = 33; <span class="comment">% chem indices P</span>
  excelWorkbook.Save;
  excelWorkbook.Close(false);
  excelObj.Quit;
  delete(excelObj);
</pre><h2>sheet 3: statistics for all species<a name="5"></a></h2><pre class="codeinput">  xlswrite(file_name, {hyper_species}, <span class="string">'statistics'</span>, [<span class="string">'A'</span>, txt_row]);

  <span class="comment">% sequence of statistics equals that in report_animal</span>
  <span class="comment">% present rates at temperature that is set for each species</span>

  xlswrite(file_name, val_statistics', <span class="string">'statistics'</span>, [<span class="string">'B'</span>, txt_row,<span class="string">':DB'</span>, txt_row]);

  <span class="comment">% colour cells</span>
  excelObj = actxserver(<span class="string">'Excel.Application'</span>); <span class="comment">%opens up an excel object</span>
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">' B2: D'</span>,txt_row]).Interior.ColorIndex = 22; <span class="comment">% 1</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">' E2: J'</span>,txt_row]).Interior.ColorIndex = 38; <span class="comment">% 2</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">' K2: P'</span>,txt_row]).Interior.ColorIndex =  7; <span class="comment">% 3</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">' Q2: U'</span>,txt_row]).Interior.ColorIndex =  4; <span class="comment">% 4</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">' V2: Z'</span>,txt_row]).Interior.ColorIndex =  4; <span class="comment">% 5</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'AA2:AG'</span>,txt_row]).Interior.ColorIndex =  6; <span class="comment">% 6</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'AH2:AK'</span>,txt_row]).Interior.ColorIndex = 19; <span class="comment">% 7</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'AL2:AO'</span>,txt_row]).Interior.ColorIndex = 17; <span class="comment">% 8</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'AP2:AS'</span>,txt_row]).Interior.ColorIndex = 24; <span class="comment">% 9</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'AT2:BB'</span>,txt_row]).Interior.ColorIndex = 42; <span class="comment">% 10</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'BC2:BF'</span>,txt_row]).Interior.ColorIndex = 34; <span class="comment">% 11</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'BG2:BJ'</span>,txt_row]).Interior.ColorIndex = 28; <span class="comment">% 12</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'BK2:BT'</span>,txt_row]).Interior.ColorIndex = 22; <span class="comment">% 13</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'BU2:BZ'</span>,txt_row]).Interior.ColorIndex = 38; <span class="comment">% 14</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'CA2:CD'</span>,txt_row]).Interior.ColorIndex =  7; <span class="comment">% 15</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'CE2:CF'</span>,txt_row]).Interior.ColorIndex = 43; <span class="comment">% 16</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'CG2:CP'</span>,txt_row]).Interior.ColorIndex =  4; <span class="comment">% 17</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'CQ2:CS'</span>,txt_row]).Interior.ColorIndex =  6; <span class="comment">% 18</span>
  excelObj.sheets.Item(<span class="string">'statistics'</span>).Range([<span class="string">'CT2:DC'</span>,txt_row]).Interior.ColorIndex = 19; <span class="comment">% 19</span>
  excelWorkbook.Save;
  excelWorkbook.Close(false);
  excelObj.Quit;
  delete(excelObj);
</pre><h2>sheet species; one sheet per species<a name="6"></a></h2><pre class="codeinput">  <span class="comment">% links to pars-, mydata-, predict-, result-files in header</span>
  hyper_pars = [<span class="string">'=HYPERLINK("'</span>, hyp_add_my_pet, <span class="string">'pars_'</span>, species,<span class="string">'.m";"pars")'</span>];
  xlswrite(file_name, {hyper_pars}, species, <span class="string">'F1'</span>)

  hyper_mydata = [<span class="string">'=HYPERLINK("'</span>, hyp_add_my_pet, <span class="string">'mydata/mydata_'</span>, species,<span class="string">'.m";"mydata")'</span>];
  xlswrite(file_name, {hyper_mydata}, species, <span class="string">'G1'</span>)
  hyper_predict = [<span class="string">'=HYPERLINK("'</span>, hyp_add_my_pet, <span class="string">'mydata/predict_'</span>, species,<span class="string">'.m";"predict")'</span>];
  xlswrite(file_name, {hyper_predict}, species, <span class="string">'H1'</span>)
  hyper_result = [<span class="string">'=HYPERLINK("'</span>, hyp_add_my_pet, <span class="string">'mydata/html/mydata_'</span>, species,<span class="string">'.html";"fit")'</span>];
  xlswrite(file_name, {hyper_result}, species, <span class="string">'I1'</span>)


  <span class="comment">% statistics</span>
  hyper_statistics = [<span class="string">'=HYPERLINK("'</span>, hyp_add_my_pet, <span class="string">'add_my_pet.pdf"; "statistics at T")'</span>];
  xlswrite(file_name, [{hyper_statistics}; txt_statistics], species, <span class="string">'A1'</span>)
  xlswrite(file_name, val_statistics, species, <span class="string">'B2'</span>)

  <span class="comment">% input parameters</span>
  n_par = length(val_par);

  xlswrite(file_name, [{<span class="string">'Input parameters at T_ref'</span>}; txt_par; txt_mudn], species, <span class="string">'D1'</span>)
  xlswrite(file_name, val_par, species, <span class="string">'E2'</span>)
  xlswrite(file_name, [mu_O'; d_O'; n_O], species, [<span class="string">'E'</span>, num2str(2 + n_par)]);

  excelObj = actxserver(<span class="string">'Excel.Application'</span>); <span class="comment">%opens up an excel object</span>
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  excelObj.sheets.Item(species).Range(<span class="string">'A:A'</span>).ColumnWidth = 40; <span class="comment">% description-column is broad</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D:D'</span>).ColumnWidth = 30; <span class="comment">% description-column is broad</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A1:I1'</span>).Interior.ColorIndex   = 36; <span class="comment">% header</span>

  <span class="comment">% colour statistics</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A2:B4'</span>).Interior.ColorIndex   = 22; <span class="comment">% 1</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A5:B10'</span>).Interior.ColorIndex  = 38; <span class="comment">% 2</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A11:B16'</span>).Interior.ColorIndex =  7; <span class="comment">% 3</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A17:B21'</span>).Interior.ColorIndex =  4; <span class="comment">% 4</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A22:B26'</span>).Interior.ColorIndex =  4; <span class="comment">% 5</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A27:B33'</span>).Interior.ColorIndex =  6; <span class="comment">% 6</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A34:B37'</span>).Interior.ColorIndex = 19; <span class="comment">% 7</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A38:B41'</span>).Interior.ColorIndex = 17; <span class="comment">% 8</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A42:B45'</span>).Interior.ColorIndex = 24; <span class="comment">% 9</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A46:B54'</span>).Interior.ColorIndex = 42; <span class="comment">% 10</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A55:B58'</span>).Interior.ColorIndex = 34; <span class="comment">% 11</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A59:B62'</span>).Interior.ColorIndex = 28; <span class="comment">% 12</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A63:B72'</span>).Interior.ColorIndex = 22; <span class="comment">% 13</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A73:B78'</span>).Interior.ColorIndex = 38; <span class="comment">% 14</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A79:B82'</span>).Interior.ColorIndex =  7; <span class="comment">% 15</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A83:B84'</span>).Interior.ColorIndex = 43; <span class="comment">% 16</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A85:B94'</span>).Interior.ColorIndex =  4; <span class="comment">% 17</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A95:B97'</span>).Interior.ColorIndex =  6; <span class="comment">% 18</span>
  excelObj.sheets.Item(species).Range(<span class="string">'A98:B107'</span>).Interior.ColorIndex = 19;<span class="comment">% 19</span>

  <span class="comment">% colour primary_parameters</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D2:E8'</span>).Interior.ColorIndex =   22; <span class="comment">% temp pars</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D9:E9'</span>).Interior.ColorIndex =   38; <span class="comment">% scaled func resp</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D10:E11'</span>).Interior.ColorIndex =  7; <span class="comment">% zoom, del_M</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D12:E14'</span>).Interior.ColorIndex = 43; <span class="comment">% assimilation</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D15:E17'</span>).Interior.ColorIndex =  4; <span class="comment">% reserve, reprod</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D18:E20'</span>).Interior.ColorIndex =  6; <span class="comment">% maintenance</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D21:E21'</span>).Interior.ColorIndex = 19; <span class="comment">% growth</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D22:E24'</span>).Interior.ColorIndex = 17; <span class="comment">% life stages</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D25:E26'</span>).Interior.ColorIndex = 24; <span class="comment">% ageing</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D27:H27'</span>).Interior.ColorIndex = 42; <span class="comment">% chem potentials</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D28:H28'</span>).Interior.ColorIndex = 34; <span class="comment">% densities</span>
  excelObj.sheets.Item(species).Range(<span class="string">'D29:H32'</span>).Interior.ColorIndex = 28; <span class="comment">% chem indices X</span>

  excelWorkbook.Save;         <span class="comment">% save font change</span>
  excelWorkbook.Close(false); <span class="comment">% closes excel object</span>
  excelObj.Quit;
  delete(excelObj);
</pre><h2>prepare for a next species<a name="7"></a></h2><pre class="codeinput">  clear <span class="string">T*</span> <span class="string">t_*</span> <span class="string">W*</span> <span class="string">w*</span> <span class="string">d*</span> <span class="string">M*</span> <span class="string">m*</span> <span class="string">E*</span> <span class="string">e*</span> <span class="string">p*</span> <span class="string">V*</span> <span class="string">v*</span> <span class="string">U*</span> <span class="string">u*</span> <span class="string">L*</span> <span class="string">l*</span> <span class="string">a*</span> <span class="string">F*</span> <span class="string">s_*</span> <span class="string">SD*</span> <span class="string">S_*</span> <span class="string">K*</span> <span class="string">k*</span>
  clear <span class="string">y*</span> <span class="string">J*</span> <span class="string">j*</span> <span class="string">x*</span> <span class="string">z*</span> <span class="string">G*</span> <span class="string">g*</span> <span class="string">F*</span> <span class="string">R*</span> <span class="string">r*</span> <span class="string">h_*</span> <span class="string">hT*</span> <span class="string">C*</span> <span class="string">X*</span> <span class="string">f</span> <span class="string">f_*</span> <span class="string">n_M</span> <span class="string">n_O</span>
  clear <span class="string">val*</span> <span class="string">info*</span> <span class="string">species</span> <span class="string">family</span> <span class="string">order</span> <span class="string">class</span> <span class="string">phylum</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
% created 2009/07/11 by <NAME>, modified by <NAME> 2013/01/15
%
%% Description
%  writes report input parameters and output statistics
%   to Excel-file file_name set in pars_my_pets
%   assumes that report (and so parscomp) and report_xls_init have been run previously 
%     and report_xls_close afterwards
%   txt_statistics, val_statistics, txt_par, val_par, txt_mudn are set in report

if exist('n_spec','var')==0
  report_xls_init 
end

report_html %  hmtl reporting parallel to xls

n_spec = n_spec + 1; % increment row number; initiated in report_xls_init
txt_row = num2str(n_spec);

%% sheet 1: list of species
        
  hyper_species = ['=HYPERLINK("[', file_name, '.xls]', species, '!A1";"', species,'")'];
  xlswrite(file_name, {phylum, class, order, family, hyper_species, species_en, TYPE, FIT, COMPLETE, data_0{:}, data_1{:}}, 'species_list', ['A', txt_row])
   
  % colour font for data_0 and data_1
  n_data_0 = size(data_0,1); n_0_start = 1 + 9;       n_0_end = n_0_start + n_data_0 - 1; 
    cell_0_start = cell_name{n_0_start}; cell_0_end = cell_name{n_0_end}; % cell_name is defined in report_xls_init
  n_data_1 = size(data_1,1); n_1_start = 1 + n_0_end; n_1_end = n_1_start + n_data_1 - 1;
    cell_1_start = cell_name{n_1_start}; cell_1_end = cell_name{n_1_end};
 
  excelObj = actxserver('Excel.Application'); %opens up an excel object
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  % column width
  excelObj.sheets.Item('species_list').Range('E:F').ColumnWidth = 20; % species, common name-column are broad
  excelObj.sheets.Item('species_list').Range('G:I').ColumnWidth = 4;  % TYPE,COMPLETE,FIT-column are narrow
  % colour cells fit TYPE FIT and COMPLETE
  excelObj.sheets.Item('species_list').Range(['G2:I', num2str(n_spec)]).Interior.ColorIndex = 36;
  % colour data types
  if n_data_0 > 0
    excelObj.sheets.Item(1).Range([cell_0_start, txt_row, ':', cell_0_end, txt_row]).Font.ColorIndex = 5; % blue for zero-variate data
  end
  if n_data_1 > 0 
    excelObj.sheets.Item(1).Range([cell_1_start, txt_row, ':', cell_1_end, txt_row]).Font.ColorIndex = 10; % green for uni-variate data
  end  
  excelWorkbook.Save;         % save font change
  excelWorkbook.Close(false); % closes excel object
  excelObj.Quit;
  delete(excelObj);
 
%% sheet 2: primary parameters for all species

  xlswrite(file_name, {hyper_species}, 'primary_parameters', ['A', txt_row]);
  
  % sequence of par_prim equals that of header in report_xls_init
  % present rates at reference temperature
  par_primary = [ ...
      T; T_A; T_L; T_H; T_AL; T_AH;
      f; z; del_M; FT_m; kap_X; kap_X_P;
      p_Am; v; kap; kap_R; p_M; p_T; k_J; E_G;
      E_Hb; E_Hj; E_Hp; h_a; s_G;
      mu_X; mu_V; mu_E; mu_P;
      d_O;
      n_O(2:4,1); n_O(2:4,2);
      n_O(2:4,3); n_O(2:4,4)];
  
  xlswrite(file_name, par_primary', 'primary_parameters', ['B', txt_row,':AT', txt_row]);
  
  % colour cells
  excelObj = actxserver('Excel.Application'); %opens up an excel object
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  excelObj.sheets.Item('primary_parameters').Range('A:A').ColumnWidth = 20; % species-column is broad
  excelObj.sheets.Item('primary_parameters').Range(['A1:A', txt_row]).Interior.ColorIndex = 36; % species list
  excelObj.sheets.Item('primary_parameters').Range(['B1:G', txt_row]).Interior.ColorIndex = 22; % temp pars
  excelObj.sheets.Item('primary_parameters').Range(['H1:H', txt_row]).Interior.ColorIndex = 38; % scaled func resp
  excelObj.sheets.Item('primary_parameters').Range(['I1:J', txt_row]).Interior.ColorIndex =  7; % zoom, del_M
  excelObj.sheets.Item('primary_parameters').Range(['K1:N', txt_row]).Interior.ColorIndex = 43; % assimilation
  excelObj.sheets.Item('primary_parameters').Range(['O1:Q', txt_row]).Interior.ColorIndex =  4; % reserve, reprod
  excelObj.sheets.Item('primary_parameters').Range(['R1:T', txt_row]).Interior.ColorIndex =  6; % maintenance
  excelObj.sheets.Item('primary_parameters').Range(['U1:U', txt_row]).Interior.ColorIndex = 19; % growth
  excelObj.sheets.Item('primary_parameters').Range(['V1:X', txt_row]).Interior.ColorIndex = 17; % life stages
  excelObj.sheets.Item('primary_parameters').Range(['Y1:Z', txt_row]).Interior.ColorIndex = 24; % ageing
  excelObj.sheets.Item('primary_parameters').Range(['AA1:AD',txt_row]).Interior.ColorIndex = 42; % chem potentials
  excelObj.sheets.Item('primary_parameters').Range(['AE1:AH',txt_row]).Interior.ColorIndex = 34; % densities
  excelObj.sheets.Item('primary_parameters').Range(['AI1:AK',txt_row]).Interior.ColorIndex = 28; % chem indices X
  excelObj.sheets.Item('primary_parameters').Range(['AL1:AN',txt_row]).Interior.ColorIndex = 33; % chem indices V
  excelObj.sheets.Item('primary_parameters').Range(['AO1:AQ',txt_row]).Interior.ColorIndex = 28; % chem indices E
  excelObj.sheets.Item('primary_parameters').Range(['AR1:AT',txt_row]).Interior.ColorIndex = 33; % chem indices P
  excelWorkbook.Save;
  excelWorkbook.Close(false);
  excelObj.Quit;
  delete(excelObj);

%% sheet 3: statistics for all species

  xlswrite(file_name, {hyper_species}, 'statistics', ['A', txt_row]);
  
  % sequence of statistics equals that in report_animal
  % present rates at temperature that is set for each species
  
  xlswrite(file_name, val_statistics', 'statistics', ['B', txt_row,':DB', txt_row]);

  % colour cells
  excelObj = actxserver('Excel.Application'); %opens up an excel object
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  excelObj.sheets.Item('statistics').Range([' B2: D',txt_row]).Interior.ColorIndex = 22; % 1
  excelObj.sheets.Item('statistics').Range([' E2: J',txt_row]).Interior.ColorIndex = 38; % 2
  excelObj.sheets.Item('statistics').Range([' K2: P',txt_row]).Interior.ColorIndex =  7; % 3
  excelObj.sheets.Item('statistics').Range([' Q2: U',txt_row]).Interior.ColorIndex =  4; % 4
  excelObj.sheets.Item('statistics').Range([' V2: Z',txt_row]).Interior.ColorIndex =  4; % 5
  excelObj.sheets.Item('statistics').Range(['AA2:AG',txt_row]).Interior.ColorIndex =  6; % 6
  excelObj.sheets.Item('statistics').Range(['AH2:AK',txt_row]).Interior.ColorIndex = 19; % 7
  excelObj.sheets.Item('statistics').Range(['AL2:AO',txt_row]).Interior.ColorIndex = 17; % 8
  excelObj.sheets.Item('statistics').Range(['AP2:AS',txt_row]).Interior.ColorIndex = 24; % 9
  excelObj.sheets.Item('statistics').Range(['AT2:BB',txt_row]).Interior.ColorIndex = 42; % 10
  excelObj.sheets.Item('statistics').Range(['BC2:BF',txt_row]).Interior.ColorIndex = 34; % 11
  excelObj.sheets.Item('statistics').Range(['BG2:BJ',txt_row]).Interior.ColorIndex = 28; % 12
  excelObj.sheets.Item('statistics').Range(['BK2:BT',txt_row]).Interior.ColorIndex = 22; % 13
  excelObj.sheets.Item('statistics').Range(['BU2:BZ',txt_row]).Interior.ColorIndex = 38; % 14
  excelObj.sheets.Item('statistics').Range(['CA2:CD',txt_row]).Interior.ColorIndex =  7; % 15
  excelObj.sheets.Item('statistics').Range(['CE2:CF',txt_row]).Interior.ColorIndex = 43; % 16
  excelObj.sheets.Item('statistics').Range(['CG2:CP',txt_row]).Interior.ColorIndex =  4; % 17
  excelObj.sheets.Item('statistics').Range(['CQ2:CS',txt_row]).Interior.ColorIndex =  6; % 18
  excelObj.sheets.Item('statistics').Range(['CT2:DC',txt_row]).Interior.ColorIndex = 19; % 19
  excelWorkbook.Save;
  excelWorkbook.Close(false);
  excelObj.Quit;
  delete(excelObj);
  
%% sheet species; one sheet per species

  % links to pars-, mydata-, predict-, result-files in header
  hyper_pars = ['=HYPERLINK("', hyp_add_my_pet, 'pars_', species,'.m";"pars")'];
  xlswrite(file_name, {hyper_pars}, species, 'F1')

  hyper_mydata = ['=HYPERLINK("', hyp_add_my_pet, 'mydata/mydata_', species,'.m";"mydata")'];
  xlswrite(file_name, {hyper_mydata}, species, 'G1')
  hyper_predict = ['=HYPERLINK("', hyp_add_my_pet, 'mydata/predict_', species,'.m";"predict")'];
  xlswrite(file_name, {hyper_predict}, species, 'H1')
  hyper_result = ['=HYPERLINK("', hyp_add_my_pet, 'mydata/html/mydata_', species,'.html";"fit")'];
  xlswrite(file_name, {hyper_result}, species, 'I1')


  % statistics
  hyper_statistics = ['=HYPERLINK("', hyp_add_my_pet, 'add_my_pet.pdf"; "statistics at T")'];
  xlswrite(file_name, [{hyper_statistics}; txt_statistics], species, 'A1')
  xlswrite(file_name, val_statistics, species, 'B2') 

  % input parameters
  n_par = length(val_par);

  xlswrite(file_name, [{'Input parameters at T_ref'}; txt_par; txt_mudn], species, 'D1')
  xlswrite(file_name, val_par, species, 'E2')
  xlswrite(file_name, [mu_O'; d_O'; n_O], species, ['E', num2str(2 + n_par)]);
  
  excelObj = actxserver('Excel.Application'); %opens up an excel object
  excelWorkbook = excelObj.workbooks.Open([txt_pwd, file_name]);
  excelObj.sheets.Item(species).Range('A:A').ColumnWidth = 40; % description-column is broad
  excelObj.sheets.Item(species).Range('D:D').ColumnWidth = 30; % description-column is broad
  excelObj.sheets.Item(species).Range('A1:I1').Interior.ColorIndex   = 36; % header

  % colour statistics
  excelObj.sheets.Item(species).Range('A2:B4').Interior.ColorIndex   = 22; % 1
  excelObj.sheets.Item(species).Range('A5:B10').Interior.ColorIndex  = 38; % 2
  excelObj.sheets.Item(species).Range('A11:B16').Interior.ColorIndex =  7; % 3
  excelObj.sheets.Item(species).Range('A17:B21').Interior.ColorIndex =  4; % 4
  excelObj.sheets.Item(species).Range('A22:B26').Interior.ColorIndex =  4; % 5
  excelObj.sheets.Item(species).Range('A27:B33').Interior.ColorIndex =  6; % 6
  excelObj.sheets.Item(species).Range('A34:B37').Interior.ColorIndex = 19; % 7
  excelObj.sheets.Item(species).Range('A38:B41').Interior.ColorIndex = 17; % 8
  excelObj.sheets.Item(species).Range('A42:B45').Interior.ColorIndex = 24; % 9
  excelObj.sheets.Item(species).Range('A46:B54').Interior.ColorIndex = 42; % 10
  excelObj.sheets.Item(species).Range('A55:B58').Interior.ColorIndex = 34; % 11
  excelObj.sheets.Item(species).Range('A59:B62').Interior.ColorIndex = 28; % 12
  excelObj.sheets.Item(species).Range('A63:B72').Interior.ColorIndex = 22; % 13
  excelObj.sheets.Item(species).Range('A73:B78').Interior.ColorIndex = 38; % 14
  excelObj.sheets.Item(species).Range('A79:B82').Interior.ColorIndex =  7; % 15
  excelObj.sheets.Item(species).Range('A83:B84').Interior.ColorIndex = 43; % 16
  excelObj.sheets.Item(species).Range('A85:B94').Interior.ColorIndex =  4; % 17
  excelObj.sheets.Item(species).Range('A95:B97').Interior.ColorIndex =  6; % 18
  excelObj.sheets.Item(species).Range('A98:B107').Interior.ColorIndex = 19;% 19
 
  % colour primary_parameters
  excelObj.sheets.Item(species).Range('D2:E8').Interior.ColorIndex =   22; % temp pars
  excelObj.sheets.Item(species).Range('D9:E9').Interior.ColorIndex =   38; % scaled func resp
  excelObj.sheets.Item(species).Range('D10:E11').Interior.ColorIndex =  7; % zoom, del_M
  excelObj.sheets.Item(species).Range('D12:E14').Interior.ColorIndex = 43; % assimilation
  excelObj.sheets.Item(species).Range('D15:E17').Interior.ColorIndex =  4; % reserve, reprod
  excelObj.sheets.Item(species).Range('D18:E20').Interior.ColorIndex =  6; % maintenance
  excelObj.sheets.Item(species).Range('D21:E21').Interior.ColorIndex = 19; % growth
  excelObj.sheets.Item(species).Range('D22:E24').Interior.ColorIndex = 17; % life stages
  excelObj.sheets.Item(species).Range('D25:E26').Interior.ColorIndex = 24; % ageing
  excelObj.sheets.Item(species).Range('D27:H27').Interior.ColorIndex = 42; % chem potentials
  excelObj.sheets.Item(species).Range('D28:H28').Interior.ColorIndex = 34; % densities
  excelObj.sheets.Item(species).Range('D29:H32').Interior.ColorIndex = 28; % chem indices X

  excelWorkbook.Save;         % save font change
  excelWorkbook.Close(false); % closes excel object
  excelObj.Quit;
  delete(excelObj);

%% prepare for a next species
  
  clear T* t_* W* w* d* M* m* E* e* p* V* v* U* u* L* l* a* F* s_* SD* S_* K* k*
  clear y* J* j* x* z* G* g* F* R* r* h_* hT* C* X* f f_* n_M n_O
  clear val* info* species family order class phylum

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebtcohrt.h<|end_filename|>
/***
   NAME
     ebtcohrt.h
   PURPOSE
     Interface header file to the functions defined in ebtcohrt.c
   NOTES
     
   HISTORY
     AMdR - Jul 19, 1995 : Created.
     AMdR - Nov 15, 2015 : Revised last.
***/

/*==========================================================================*/
#ifndef EBTCOHRT_H
#define EBTCOHRT_H

#ifdef	EBTCOHRT_C
#undef	EXTERN
#define EXTERN
#else
#undef	EXTERN
#define EXTERN	extern
#endif
EXTERN   void     	CohortCycle(double);
#if (I_CONST_DIM > 0)
EXTERN int		InsCohort(cohort, cohortID, int);
#else
EXTERN   int		InsCohort(cohort, int);
#endif
EXTERN_C void		TransBcohorts(void);
EXTERN   void		SievePop(void);



/*==========================================================================*/
#endif /* EBTCOHRT_H */


<|start_filename|>animal/html/parscomp.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>created 2002/04/09 by <NAME>, modified 2014/03/12</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-03-20"><meta name="DC.source" content="parscomp.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>created 2002/04/09 by <NAME>, modified 2014/03/12</h1><!--introduction--><p>script for 'pars_animal', called from 'animal'; See: Kooijman 2010 run pars_animal (or pars_my_pet) before running this script calculates compound parameters that are used by other routines no reproduction buffer handling rules are specified    this buffer is excluded from the calculations below</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">conversion coefficients</a></li><li><a href="#2">compound parameters before metamorphosis, if present</a></li><li><a href="#3">correct primary rates for temperature difference relative to reference</a></li><li><a href="#4">life stage parameters</a></li><li><a href="#5">compound parameters II</a></li><li><a href="#6">fluxes and half sat coeff, post metamorphosis</a></li></ul></div><h2>conversion coefficients<a name="1"></a></h2><pre class="codeinput"><span class="comment">% molecular weights</span>
w_O = n_O' * [12; 1; 16; 14];    <span class="comment">% g/mol, mol-weights for org. compounds</span>
w_V = w_O(2);

<span class="comment">% specific densities</span>
d_V = d_O(2);                    <span class="comment">% g/cm^3, specific density of structure</span>
M_V = d_V/ w_V;                  <span class="comment">% mol/cm^3, [M_V] volume-specific mass of structure</span>
<span class="comment">% notice that "volume" in [M_V] relates to wet volume, while "mass" relates to dry mass</span>
<span class="comment">% so for volume to mol: M_V = [M_V] * V;</span>
<span class="comment">% or for volume to weight: W_V = w_V * M_V = d_V * V</span>
E_V = d_V * mu_V/ w_V;           <span class="comment">% J/cm^3, [E_V] volume-specific energy of structure</span>

<span class="comment">% yield coefficients</span>
y_E_X = kap_X * mu_X/ mu_E;      <span class="comment">% mol/mol, yield of reserve on food</span>
y_X_E = 1/ y_E_X;                <span class="comment">% mol/mol, yield of food on reserve</span>
y_V_E = mu_E * M_V/ E_G;         <span class="comment">% mol/mol, yield of structure on reserve</span>
y_E_V = 1/ y_V_E;                <span class="comment">% mol/mol, yield of reserve on structure</span>
y_P_X = kap_X_P * mu_X/ mu_P;    <span class="comment">% mol/mol, yield of faeces on food</span>
y_X_P = 1/ y_P_X;                <span class="comment">% mol/mol, yield of food on faeces</span>
y_P_E = y_P_X/ y_E_X;            <span class="comment">% mol/mol, yield of faeces on reserve</span>

<span class="comment">% mass-power couplers</span>
eta_XA = y_X_E/mu_E;             <span class="comment">% mol/J, food-assim energy coupler</span>
eta_PA = y_P_E/mu_E;             <span class="comment">% mol/J, faeces-assim energy coupler</span>
eta_VG = y_V_E/mu_E;             <span class="comment">% mol/J, struct-growth energy coupler</span>
eta_O = [-eta_XA  0        0;    <span class="comment">% mol/J, mass-energy coupler</span>
	      0       0   eta_VG;    <span class="comment">%         used in: J_O = eta_O * p</span>
	 1/mu_E  -1/mu_E -1/mu_E;
	      eta_PA  0        0];
</pre><h2>compound parameters before metamorphosis, if present<a name="2"></a></h2><pre class="codeinput">L_m_ref = 1;                   <span class="comment">% cm, reference length</span>
p_Am = z * p_M * L_m_ref/ kap; <span class="comment">% J/d.cm^2, {p_Am} spec assimilation flux</span>
p_Xm = p_Am/ kap_X;            <span class="comment">% J/d.cm^2, max spec feeding power</span>

k_M = p_M/ E_G;                <span class="comment">% 1/d, somatic maintenance rate coefficient</span>
k = k_J/ k_M;                  <span class="comment">% -, maintenance ratio</span>

E_m = p_Am/ v;                 <span class="comment">% J/cm^3, reserve capacity [E_m]</span>
m_Em = y_E_V * E_m/ E_G;       <span class="comment">% mol/mol, reserve capacity</span>
g = E_G/ kap/ E_m;             <span class="comment">% -, energy investment ratio</span>
kap_G = mu_V * M_V/ E_G;       <span class="comment">% -, growth efficieny</span>
<span class="comment">%  energy fixed in structure relative to energy invested in structure</span>

L_m = kap * p_Am/ p_M;         <span class="comment">% cm, maximum length</span>
L_T = p_T/ p_M;                <span class="comment">% cm, heating length (also applies to osmotic work)</span>
l_T = L_T/ L_m;                <span class="comment">% -, scaled heating length</span>
</pre><h2>correct primary rates for temperature difference relative to reference<a name="3"></a></h2><pre class="codeinput">TC = tempcorr(T,T_ref,pars_T);   <span class="comment">% -, Temperature Correction factor</span>

FT_m = TC * F_m;                 <span class="comment">% L/d.cm^2, {F_m} max spec searching rate</span>
pT_Xm = TC * p_Xm;               <span class="comment">% J/d.cm^2, temp corrected spec feeding rate</span>
pT_Am = TC * p_Am;               <span class="comment">% J/d.cm^2, temp corrected spec assimilation rate</span>
vT = TC * v;                     <span class="comment">% cm/d, temp corrected energy conductance</span>
kT_M = TC * k_M;                 <span class="comment">% 1/d, temp corrected somatic maintenance rate coefficient</span>
pT_M = TC * p_M;                 <span class="comment">% J/d.cm^3, temp corrected vol-specific som maint costs</span>
pT_T = TC * p_T;                 <span class="comment">% J/d.cm^2, temp corrected sur-specific som maint costs</span>
kT_J = TC * k_J;                 <span class="comment">% 1/d, temp corrected mat maint rate coefficient</span>
hT_a = TC * TC * h_a;            <span class="comment">% 1/d^2, temp corrected aging acceleration</span>
</pre><h2>life stage parameters<a name="4"></a></h2><p>metamorphosis occurs in bivalves, many fish and some crustations, see KooyPecq2011   embryos, late juveniles and adults: isomorphs   early juveniles are V1-morphs; {p_Am} and v increase propto L theory presented in subsection 7.8.2 of Kooy2010</p><pre class="codeinput"><span class="keyword">if</span> exist(<span class="string">'E_Hj'</span>,<span class="string">'var'</span>) == 0 <span class="comment">% maturity at metamorphosis</span>
  E_Hj = [];        <span class="comment">% actually means: no metamorphosis, no V1-stage, no acceleration</span>
<span class="keyword">end</span>
<span class="keyword">if</span> isempty(E_Hj)
  E_Hj = E_Hb;      <span class="comment">% actually means: no metamorphosis, no V1-stage, no acceleration</span>
<span class="keyword">end</span>

<span class="comment">% M_H is the cumulated mass of reserve invested in maturation</span>
<span class="comment">% maturity at birth</span>
M_Hb = E_Hb/ mu_E;               <span class="comment">% mol, maturity at birth</span>
U_Hb = E_Hb/ pT_Am;              <span class="comment">% cm^2 d, scaled maturity at birth</span>
u_Hb = U_Hb * g^2 * kT_M^3/ vT^2;<span class="comment">% -, scaled maturity at birth</span>
V_Hb = U_Hb/ (1 - kap);          <span class="comment">% cm^2 d, scaled maturity at birth</span>
v_Hb = V_Hb * g^2 * kT_M^3/ vT^2;<span class="comment">% -, scaled maturity at birth</span>
<span class="comment">% maturity at metamorphosis</span>
M_Hj = E_Hj/ mu_E;               <span class="comment">% mol, maturity at metamorphosis</span>
U_Hj = E_Hj/ pT_Am;              <span class="comment">% cm^2 d, scaled maturity at metamorphosis</span>
u_Hj = U_Hj * g^2 * kT_M^3/ vT^2;<span class="comment">% -, scaled maturity at metamorphosis</span>
V_Hj = U_Hj/ (1 - kap);          <span class="comment">% cm^2 d, scaled maturity at metamorphosis</span>
v_Hj = V_Hj * g^2 * kT_M^3/ vT^2;<span class="comment">% -, scaled maturity at metamorphosis</span>
<span class="comment">% maturity at puberty</span>
M_Hp = E_Hp/ mu_E;               <span class="comment">% mol, maturity at puberty</span>
U_Hp = E_Hp/ pT_Am;              <span class="comment">% cm^2 d, scaled maturity at puberty</span>
u_Hp = U_Hp * g^2 * kT_M^3/ vT^2;<span class="comment">% -, scaled maturity at puberty</span>
V_Hp = U_Hp/ (1 - kap);          <span class="comment">% cm^2 d, scaled maturity at puberty</span>
v_Hp = V_Hp * g^2 * kT_M^3/ vT^2;<span class="comment">% -, scaled maturity at puberty</span>
</pre><h2>compound parameters II<a name="5"></a></h2><pre class="codeinput"><span class="keyword">if</span> E_Hj == E_Hb <span class="comment">% no metamorphosis, f = 1</span>
  pars_tp = [g; k; l_T; v_Hb; v_Hp]; <span class="comment">% parameters for get_tp</span>
  [t_p t_b l_p l_b info] = get_tp(pars_tp, 1); <span class="comment">% -, scaled age at puberty</span>
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in get_tp: invalid parameter value combination for t_p \n'</span>)
  <span class="keyword">end</span>
  l_j = l_b;                         <span class="comment">% scaled length at metamorphosis</span>
  t_j = t_b;                         <span class="comment">% scaled age at metamorphosis</span>
  l_i = 1 - l_T;                     <span class="comment">% scaled ultimate length</span>
  s_M = 1; <span class="comment">% -, acceleration factor</span>
<span class="keyword">else</span> <span class="comment">% metamorphosis, f = 1</span>
  <span class="comment">% notice that L_m relates to the embryo-values</span>
  pars_tj = [g; k; l_T; v_Hb; v_Hj; v_Hp]; <span class="comment">% parameters for get_tj</span>
  [t_j t_p t_b l_j l_p l_b l_i r_j r_B info] = get_tj(pars_tj, 1);
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in get_tj: invalid parameter value combination for t_j \n'</span>)
  <span class="keyword">end</span>
  s_M = l_j/ l_j; <span class="comment">% -, acceleration factor at f = 1; will be overwritten by statistics</span>
<span class="keyword">end</span>
s_H = log10(E_Hp/ E_Hb);             <span class="comment">% -, altriciality index s_H^pb</span>

<span class="comment">% dry weight at f = 1</span>
L_i = s_M * L_m; <span class="comment">% cm, ultimate length at f = 1, will be overwitten by statistics</span>
W_m = L_i^3 * d_O(2)* (1 + m_Em * w_O(3)/ w_O(2)); <span class="comment">% g, maximum dry weight</span>

del_V = 1/(1 + f * m_Em * w_O(3)/ w_O(2)); <span class="comment">% -, fraction of max weight that is structure</span>
M_Vm = L_i^3 * d_O(2)/ w_O(2);       <span class="comment">% mol, max struc mass</span>
M_Em = m_Em * M_Vm;                  <span class="comment">% mol, max reserve mass</span>

t_E = L_m/ vT;                       <span class="comment">% d, maximum reserve residence time</span>
t_starve = E_m/ pT_M;                <span class="comment">% d, max survival time when starved</span>
</pre><h2>fluxes and half sat coeff, post metamorphosis<a name="6"></a></h2><pre class="codeinput">JT_E_Am = pT_Am/ mu_E * s_M;     <span class="comment">% mol/d.cm^2, {J_EAm}, max surface-spec assimilation flux</span>
JT_X_Am = y_X_E * JT_E_Am;       <span class="comment">% mol/d.cm^2, {J_XAm}, max surface-spec feeding flux</span>
jT_E_Am = JT_E_Am * L_m^2/ M_Vm; <span class="comment">% mol/d.mol, j_EAm,  mass-spec max assim flux</span>
jT_X_Am = y_X_E * jT_E_Am;       <span class="comment">% mol/d.mol, j_XAm, mass-spec max feeding flux</span>
K = JT_X_Am/ FT_m;               <span class="comment">% M, half-saturation coefficient</span>

JT_E_M = pT_M/ mu_E;             <span class="comment">% mol/d.cm^3, [J_EM]</span>
JT_E_T = pT_T/ mu_E;             <span class="comment">% mol/d.cm^2, {J_ET}</span>
jT_E_M = kT_M * y_E_V;           <span class="comment">% mol/d.mol, spec somatic  maint costs</span>
jT_E_J = kT_J * y_E_V;           <span class="comment">% mol/d.mol, spec maturity maint costs</span>

pp_M = kT_M * y_E_V * mu_E * d_O(2)/ w_O(2); <span class="comment">% J/d.cm^3 spec somatic maint costs</span>
pp_T = L_T * pp_M;                           <span class="comment">% J/d.cm^2 spec heating costs</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% created 2002/04/09 by <NAME>, modified 2014/03/12
% script for 'pars_animal', called from 'animal'; See: Kooijman 2010
% run pars_animal (or pars_my_pet) before running this script
% calculates compound parameters that are used by other routines
% no reproduction buffer handling rules are specified
%    this buffer is excluded from the calculations below

%% conversion coefficients

% molecular weights
w_O = n_O' * [12; 1; 16; 14];    % g/mol, mol-weights for org. compounds
w_V = w_O(2); 

% specific densities
d_V = d_O(2);                    % g/cm^3, specific density of structure
M_V = d_V/ w_V;                  % mol/cm^3, [M_V] volume-specific mass of structure
% notice that "volume" in [M_V] relates to wet volume, while "mass" relates to dry mass
% so for volume to mol: M_V = [M_V] * V;
% or for volume to weight: W_V = w_V * M_V = d_V * V
E_V = d_V * mu_V/ w_V;           % J/cm^3, [E_V] volume-specific energy of structure

% yield coefficients
y_E_X = kap_X * mu_X/ mu_E;      % mol/mol, yield of reserve on food
y_X_E = 1/ y_E_X;                % mol/mol, yield of food on reserve
y_V_E = mu_E * M_V/ E_G;         % mol/mol, yield of structure on reserve
y_E_V = 1/ y_V_E;                % mol/mol, yield of reserve on structure
y_P_X = kap_X_P * mu_X/ mu_P;    % mol/mol, yield of faeces on food 
y_X_P = 1/ y_P_X;                % mol/mol, yield of food on faeces
y_P_E = y_P_X/ y_E_X;            % mol/mol, yield of faeces on reserve

% mass-power couplers
eta_XA = y_X_E/mu_E;             % mol/J, food-assim energy coupler
eta_PA = y_P_E/mu_E;             % mol/J, faeces-assim energy coupler
eta_VG = y_V_E/mu_E;             % mol/J, struct-growth energy coupler
eta_O = [-eta_XA  0        0;    % mol/J, mass-energy coupler
	      0       0   eta_VG;    %         used in: J_O = eta_O * p
	 1/mu_E  -1/mu_E -1/mu_E;
	      eta_PA  0        0];
      
%% compound parameters before metamorphosis, if present

L_m_ref = 1;                   % cm, reference length
p_Am = z * p_M * L_m_ref/ kap; % J/d.cm^2, {p_Am} spec assimilation flux
p_Xm = p_Am/ kap_X;            % J/d.cm^2, max spec feeding power

k_M = p_M/ E_G;                % 1/d, somatic maintenance rate coefficient
k = k_J/ k_M;                  % -, maintenance ratio

E_m = p_Am/ v;                 % J/cm^3, reserve capacity [E_m]
m_Em = y_E_V * E_m/ E_G;       % mol/mol, reserve capacity 
g = E_G/ kap/ E_m;             % -, energy investment ratio
kap_G = mu_V * M_V/ E_G;       % -, growth efficieny
%  energy fixed in structure relative to energy invested in structure

L_m = kap * p_Am/ p_M;         % cm, maximum length 
L_T = p_T/ p_M;                % cm, heating length (also applies to osmotic work)
l_T = L_T/ L_m;                % -, scaled heating length

%% correct primary rates for temperature difference relative to reference
TC = tempcorr(T,T_ref,pars_T);   % -, Temperature Correction factor

FT_m = TC * F_m;                 % L/d.cm^2, {F_m} max spec searching rate
pT_Xm = TC * p_Xm;               % J/d.cm^2, temp corrected spec feeding rate
pT_Am = TC * p_Am;               % J/d.cm^2, temp corrected spec assimilation rate
vT = TC * v;                     % cm/d, temp corrected energy conductance 
kT_M = TC * k_M;                 % 1/d, temp corrected somatic maintenance rate coefficient
pT_M = TC * p_M;                 % J/d.cm^3, temp corrected vol-specific som maint costs
pT_T = TC * p_T;                 % J/d.cm^2, temp corrected sur-specific som maint costs
kT_J = TC * k_J;                 % 1/d, temp corrected mat maint rate coefficient
hT_a = TC * TC * h_a;            % 1/d^2, temp corrected aging acceleration

%% life stage parameters
% metamorphosis occurs in bivalves, many fish and some crustations, see KooyPecq2011
%   embryos, late juveniles and adults: isomorphs
%   early juveniles are V1-morphs; {p_Am} and v increase propto L
% theory presented in subsection 7.8.2 of Kooy2010

if exist('E_Hj','var') == 0 % maturity at metamorphosis
  E_Hj = [];        % actually means: no metamorphosis, no V1-stage, no acceleration
end
if isempty(E_Hj)
  E_Hj = E_Hb;      % actually means: no metamorphosis, no V1-stage, no acceleration
end

% M_H is the cumulated mass of reserve invested in maturation
% maturity at birth
M_Hb = E_Hb/ mu_E;               % mol, maturity at birth  
U_Hb = E_Hb/ pT_Am;              % cm^2 d, scaled maturity at birth
u_Hb = U_Hb * g^2 * kT_M^3/ vT^2;% -, scaled maturity at birth
V_Hb = U_Hb/ (1 - kap);          % cm^2 d, scaled maturity at birth
v_Hb = V_Hb * g^2 * kT_M^3/ vT^2;% -, scaled maturity at birth
% maturity at metamorphosis
M_Hj = E_Hj/ mu_E;               % mol, maturity at metamorphosis  
U_Hj = E_Hj/ pT_Am;              % cm^2 d, scaled maturity at metamorphosis
u_Hj = U_Hj * g^2 * kT_M^3/ vT^2;% -, scaled maturity at metamorphosis
V_Hj = U_Hj/ (1 - kap);          % cm^2 d, scaled maturity at metamorphosis
v_Hj = V_Hj * g^2 * kT_M^3/ vT^2;% -, scaled maturity at metamorphosis
% maturity at puberty
M_Hp = E_Hp/ mu_E;               % mol, maturity at puberty
U_Hp = E_Hp/ pT_Am;              % cm^2 d, scaled maturity at puberty 
u_Hp = U_Hp * g^2 * kT_M^3/ vT^2;% -, scaled maturity at puberty
V_Hp = U_Hp/ (1 - kap);          % cm^2 d, scaled maturity at puberty
v_Hp = V_Hp * g^2 * kT_M^3/ vT^2;% -, scaled maturity at puberty

%% compound parameters II

if E_Hj == E_Hb % no metamorphosis, f = 1
  pars_tp = [g; k; l_T; v_Hb; v_Hp]; % parameters for get_tp
  [t_p t_b l_p l_b info] = get_tp(pars_tp, 1); % -, scaled age at puberty
  if info ~= 1              
    fprintf('warning in get_tp: invalid parameter value combination for t_p \n')
  end
  l_j = l_b;                         % scaled length at metamorphosis
  t_j = t_b;                         % scaled age at metamorphosis
  l_i = 1 - l_T;                     % scaled ultimate length 
  s_M = 1; % -, acceleration factor
else % metamorphosis, f = 1
  % notice that L_m relates to the embryo-values
  pars_tj = [g; k; l_T; v_Hb; v_Hj; v_Hp]; % parameters for get_tj
  [t_j t_p t_b l_j l_p l_b l_i r_j r_B info] = get_tj(pars_tj, 1); 
  if info ~= 1
    fprintf('warning in get_tj: invalid parameter value combination for t_j \n')
  end  
  s_M = l_j/ l_j; % -, acceleration factor at f = 1; will be overwritten by statistics
end
s_H = log10(E_Hp/ E_Hb);             % -, altriciality index s_H^pb

% dry weight at f = 1
L_i = s_M * L_m; % cm, ultimate length at f = 1, will be overwitten by statistics
W_m = L_i^3 * d_O(2)* (1 + m_Em * w_O(3)/ w_O(2)); % g, maximum dry weight

del_V = 1/(1 + f * m_Em * w_O(3)/ w_O(2)); % -, fraction of max weight that is structure
M_Vm = L_i^3 * d_O(2)/ w_O(2);       % mol, max struc mass
M_Em = m_Em * M_Vm;                  % mol, max reserve mass

t_E = L_m/ vT;                       % d, maximum reserve residence time
t_starve = E_m/ pT_M;                % d, max survival time when starved

%% fluxes and half sat coeff, post metamorphosis

JT_E_Am = pT_Am/ mu_E * s_M;     % mol/d.cm^2, {J_EAm}, max surface-spec assimilation flux
JT_X_Am = y_X_E * JT_E_Am;       % mol/d.cm^2, {J_XAm}, max surface-spec feeding flux
jT_E_Am = JT_E_Am * L_m^2/ M_Vm; % mol/d.mol, j_EAm,  mass-spec max assim flux
jT_X_Am = y_X_E * jT_E_Am;       % mol/d.mol, j_XAm, mass-spec max feeding flux 
K = JT_X_Am/ FT_m;               % M, half-saturation coefficient

JT_E_M = pT_M/ mu_E;             % mol/d.cm^3, [J_EM]
JT_E_T = pT_T/ mu_E;             % mol/d.cm^2, {J_ET}
jT_E_M = kT_M * y_E_V;           % mol/d.mol, spec somatic  maint costs
jT_E_J = kT_J * y_E_V;           % mol/d.mol, spec maturity maint costs

pp_M = kT_M * y_E_V * mu_E * d_O(2)/ w_O(2); % J/d.cm^3 spec somatic maint costs
pp_T = L_T * pp_M;                           % J/d.cm^2 spec heating costs

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebtutils.h<|end_filename|>
/***
  NAME
    ebtutils.h
  PURPOSE
    Interface header file to the functions defined in ebtutils.c
  NOTES
     
  HISTORY
    AMdR - Jul 19, 1995 : Created.
    AMdR - May 23, 2019 : Revised last.
***/

/*==================================================================================================================================*/
#ifndef EBTUTILS_H
#define EBTUTILS_H

#ifdef  EBTUTILS_C
#undef  EXTERN
#define EXTERN
#else
#undef  EXTERN
#define EXTERN                    extern
#endif
#ifdef iszero
#undef iszero
#endif

EXTERN int                        imin(int, int);
EXTERN int                        imax(int, int);
EXTERN double                     min(double, double);
EXTERN double                     max(double, double);
EXTERN int                        iszero(double);
EXTERN int                        ismissing(double);
EXTERN int                        isequal(double, double);
EXTERN void                       SetStepSize(double);
EXTERN void                       ErrorAbort(const char *);
EXTERN void                       ErrorExit(const int, const char *);
EXTERN void                       Warning(const char *);
EXTERN void                       FileOut(void);
EXTERN void                       FileState(void);
EXTERN void                       *Myalloc(void *, size_t, size_t);
EXTERN void                       PrettyPrint(FILE *fp, double output);
EXTERN void                       WriteStateToFile(FILE *fp, double *data);
EXTERN void                       kill_shmem(void);
EXTERN int                        init_shmem(void);
EXTERN void                       ReportNote(const char *, ...);
#if (BIFURCATION == 1)
EXTERN void                       SetBifOutputTimes(double *);
#if (MEASUREBIFSTATS == 1)
EXTERN void                       outputMeasureBifstats(double *env, population *pop);
EXTERN void                       measureBifstats(double *env, population *pop);
#endif
#endif // (BIFURCATION == 1)


/*==================================================================================================================================*/
#endif // EBTUTILS_H


<|start_filename|>animal/html/report_html.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>report_html</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="report_html.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>report_html</h1><!--introduction--><p>clear and create file my_pet.html in subdirectory html and write data to it append data to Species.html in current directory append data to primary_parameters.html and statistics.html in subdirectory html this script is called at start of report_xls and assumes that report_html_int has been run previously files must be completed by report_html_close</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Species.html</a></li><li><a href="#2">primary_parameters.html</a></li><li><a href="#3">statistics.html</a></li><li><a href="#4">my_pet.html</a></li></ul></div><h2>Species.html<a name="1"></a></h2><pre class="codeinput">  n_data_0 = size(data_0,1); n_data_1 = size(data_1,1);

  fprintf(fid_Spec, <span class="string">'      &lt;TR&gt;\n'</span>);
  fprintf(fid_Spec,[<span class="string">'        &lt;TD&gt;'</span>, phylum, <span class="string">'&lt;/TD&gt;  &lt;TD&gt;'</span>, class, <span class="string">'&lt;/TD&gt; &lt;TD&gt;'</span>, order, <span class="string">'&lt;/TD&gt; &lt;TD&gt;'</span>, family, <span class="string">'&lt;/TD&gt; '</span>]);
  fprintf(fid_Spec,[<span class="string">'&lt;TD&gt;&lt;A HREF="./html/'</span>, species, <span class="string">'.html"&gt;'</span>, species, <span class="string">'&lt;/A&gt;&lt;/TD&gt; &lt;TD&gt;'</span>, species_en, <span class="string">'&lt;/TD&gt; '</span>]);
  fprintf(fid_Spec, <span class="string">'&lt;TD BGCOLOR = "#FFC6A5"&gt;%g&lt;/TD&gt; '</span>, TYPE);
  fprintf(fid_Spec, <span class="string">'&lt;TD BGCOLOR = "#FFE7C6"&gt;%g&lt;/TD&gt; '</span>, FIT);
  fprintf(fid_Spec, <span class="string">'&lt;TD BGCOLOR = "#FFCE9C"&gt;%g&lt;/TD&gt;\n        '</span>, COMPLETE);
  <span class="keyword">for</span> i = 1:n_data_0
    fprintf(fid_Spec, <span class="string">'&lt;TD BGCOLOR = "#FFFFC6"&gt;%s&lt;/TD&gt; '</span>, data_0{i});
  <span class="keyword">end</span>
  <span class="keyword">for</span> i = 1:n_data_1
    fprintf(fid_Spec, <span class="string">'&lt;TD BGCOLOR = "#FFFF9C"&gt;%s&lt;/TD&gt;'</span>, data_1{i});
  <span class="keyword">end</span>
  fprintf(fid_Spec, <span class="string">'\n      &lt;/TR&gt;\n'</span>);
</pre><h2>primary_parameters.html<a name="2"></a></h2><pre class="codeinput">  <span class="comment">% sequence of par_prim equals that of header in report_html_init and in report_xls_init</span>
  <span class="comment">% present rates at reference temperature</span>
  par_primary = [ <span class="keyword">...</span>
      T; T_A; T_L; T_H; T_AL; T_AH;
      f; z; del_M; FT_m; kap_X; kap_X_P;
      p_Am; v; kap; kap_R; p_M; p_T; k_J; E_G;
      E_Hb; E_Hj; E_Hp; h_a; s_G;
      mu_X; mu_V; mu_E; mu_P;
      d_O;
      n_O(2:4,1); n_O(2:4,2);
      n_O(2:4,3); n_O(2:4,4)];

  n_par_primary = size(par_primary,1);

  fprintf(fid_par,  <span class="string">'      &lt;TR&gt;\n'</span>);
  fprintf(fid_par, [<span class="string">'        &lt;TD&gt;&lt;A HREF="./'</span>, species, <span class="string">'.html"&gt;'</span>, species, <span class="string">'&lt;/A&gt;&lt;/TD&gt;\n'</span>]);
  <span class="keyword">for</span> i = 1:n_par_primary
    fprintf(fid_par,<span class="string">'        &lt;TD BGCOLOR = "%s"&gt;%g&lt;/TD&gt; '</span>, col_par_primary{i}, par_primary(i));
  <span class="keyword">end</span>
  fprintf(fid_par,<span class="string">'\n      &lt;/TR&gt;\n'</span>);
</pre><h2>statistics.html<a name="3"></a></h2><pre class="codeinput">  fprintf(fid_stat, <span class="string">'      &lt;TR&gt;\n'</span>);
  fprintf(fid_stat, [<span class="string">'        &lt;TD&gt;&lt;A HREF="./'</span>, species, <span class="string">'.html"&gt;'</span>, species, <span class="string">'&lt;/A&gt;&lt;/TD&gt;\n        '</span>]);
  <span class="keyword">for</span> i = 1:n_statistics
    fprintf(fid_stat, <span class="string">'&lt;TD BGCOLOR = "%s"&gt;%g&lt;/TD&gt; '</span>, col_statistics{i}, val_statistics(i));
  <span class="keyword">end</span>
  fprintf(fid_stat, <span class="string">'      &lt;/TR&gt;\n'</span>);
</pre><h2>my_pet.html<a name="4"></a></h2><pre class="codeinput">  oid = fopen([<span class="string">'./html/'</span>, species, <span class="string">'.html'</span>], <span class="string">'w+'</span>); <span class="comment">% % open file for writing, delete existing content</span>
  fprintf(oid, <span class="string">'%s\n'</span> ,<span class="string">'&lt;HTML&gt;'</span>);
  fprintf(oid, <span class="string">'%s\n'</span> ,<span class="string">'  &lt;HEAD&gt;'</span>);
  fprintf(oid,[<span class="string">'    &lt;TITLE&gt;add_my_pet:'</span>, species, <span class="string">'&lt;/TITLE&gt;\n'</span>]);
  fprintf(oid, <span class="string">'%s'</span>   ,<span class="string">'    &lt;META NAME = "keywords" '</span>);
  fprintf(oid, <span class="string">'%s\n'</span> ,<span class="string">'     CONTENT="add_my_pet, Dynamic Energy Budget theory, DEBtool"&gt;'</span>);
  fprintf(oid, <span class="string">'%s\n'</span> ,<span class="string">'  &lt;/HEAD&gt;'</span>);
  fprintf(oid,<span class="string">'%s\n\n'</span>,<span class="string">'  &lt;BODY&gt;'</span>);
  fprintf(oid,[<span class="string">'    &lt;H1 ALIGN="CENTER"&gt;'</span>, species, <span class="string">': '</span>, species_en, <span class="string">'&lt;/H1&gt;\n\n'</span>]);
  fprintf(oid, <span class="string">'    &lt;H3 ALIGN="CENTER"&gt;Go to &lt;A HREF="../Species.html"&gt;species-list&lt;/A&gt;, \n'</span>);
  fprintf(oid,[<span class="string">'                             &lt;A HREF="../pars_'</span>, species, <span class="string">'.m"&gt;pars&lt;/A&gt;, \n'</span>]);
  fprintf(oid,[<span class="string">'                             &lt;A HREF="../mydata/mydata_'</span>,  species, <span class="string">'.m"&gt;mydata&lt;/A&gt;, \n'</span>]);
  fprintf(oid,[<span class="string">'                             &lt;A HREF="../mydata/predict_'</span>, species, <span class="string">'.m"&gt;predict&lt;/A&gt;, \n'</span>]);
  fprintf(oid,[<span class="string">'                             &lt;A HREF="../mydata/html/mydata_'</span>, species, <span class="string">'.html"&gt;fit&lt;/A&gt;&lt;H3&gt;\n\n'</span>]);
  fprintf(oid, <span class="string">'  &lt;TABLE CELLSPACING=50&gt;&lt;TR VALIGN=TOP&gt;&lt;TD&gt;\n'</span>);
  fprintf(oid, <span class="string">'    &lt;TABLE&gt;\n'</span>);
  fprintf(oid, <span class="string">'      &lt;TR BGCOLOR = "#FFE7C6"&gt; &lt;TH&gt;statistic&lt;/TH&gt; &lt;TH&gt;value at T&lt;/TH&gt; &lt;/TR&gt;\n'</span>);
  <span class="keyword">for</span> i = 1: n_statistics
    fprintf(oid, <span class="string">'      &lt;TR&gt;&lt;TD BGCOLOR = "%s"&gt;%s&lt;/TD&gt; &lt;TD BGCOLOR = "%s"&gt;%g&lt;/TD&gt;&lt;/TR&gt;\n'</span>, col_statistics{i}, txt_statistics{i}, col_statistics{i}, val_statistics(i));
  <span class="keyword">end</span>
  fprintf(oid, <span class="string">'    &lt;/TABLE&gt;\n'</span>);
  fprintf(oid, <span class="string">'  &lt;/TD&gt;&lt;TD&gt;\n'</span>);
  fprintf(oid, <span class="string">'    &lt;TABLE&gt;\n'</span>);
  fprintf(oid, <span class="string">'      &lt;TR BGCOLOR = "#FFE7C6"&gt; &lt;TH&gt;parameter&lt;/TH&gt; &lt;TH&gt;value  at T_ref&lt;/TH&gt; &lt;/TR&gt;\n'</span>);
  <span class="keyword">for</span> i = 1: n_par_primary
    fprintf(oid, <span class="string">'      &lt;TR&gt;&lt;TD BGCOLOR = "%s"&gt;%s&lt;/TD&gt; &lt;TD BGCOLOR = "%s"&gt;%g&lt;/TD&gt;&lt;/TR&gt;\n'</span>, col_par_primary{i}, txt_par_primary{i}, col_par_primary{i}, par_primary(i));
  <span class="keyword">end</span>
  fprintf(oid, <span class="string">'    &lt;/TABLE&gt;\n'</span>);
  fprintf(oid, <span class="string">'  &lt;/TD&gt;&lt;/TABLE&gt;\n'</span>);
  fprintf(oid, <span class="string">'  &lt;/BODY&gt;\n'</span>);
  fprintf(oid, <span class="string">'&lt;/HTML&gt;\n'</span>);
  fclose(oid);
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% report_html
% clear and create file my_pet.html in subdirectory html and write data to it
% append data to Species.html in current directory
% append data to primary_parameters.html and statistics.html in subdirectory html
% this script is called at start of report_xls and assumes that report_html_int has been run previously
% files must be completed by report_html_close

%% Species.html

  n_data_0 = size(data_0,1); n_data_1 = size(data_1,1); 
  
  fprintf(fid_Spec, '      <TR>\n');
  fprintf(fid_Spec,['        <TD>', phylum, '</TD>  <TD>', class, '</TD> <TD>', order, '</TD> <TD>', family, '</TD> ']);
  fprintf(fid_Spec,['<TD><A HREF="./html/', species, '.html">', species, '</A></TD> <TD>', species_en, '</TD> ']);
  fprintf(fid_Spec, '<TD BGCOLOR = "#FFC6A5">%g</TD> ', TYPE);
  fprintf(fid_Spec, '<TD BGCOLOR = "#FFE7C6">%g</TD> ', FIT);
  fprintf(fid_Spec, '<TD BGCOLOR = "#FFCE9C">%g</TD>\n        ', COMPLETE);
  for i = 1:n_data_0
    fprintf(fid_Spec, '<TD BGCOLOR = "#FFFFC6">%s</TD> ', data_0{i});      
  end
  for i = 1:n_data_1
    fprintf(fid_Spec, '<TD BGCOLOR = "#FFFF9C">%s</TD>', data_1{i});  
  end
  fprintf(fid_Spec, '\n      </TR>\n');

%% primary_parameters.html
 
  % sequence of par_prim equals that of header in report_html_init and in report_xls_init
  % present rates at reference temperature
  par_primary = [ ...
      T; T_A; T_L; T_H; T_AL; T_AH;
      f; z; del_M; FT_m; kap_X; kap_X_P;
      p_Am; v; kap; kap_R; p_M; p_T; k_J; E_G;
      E_Hb; E_Hj; E_Hp; h_a; s_G;
      mu_X; mu_V; mu_E; mu_P;
      d_O;
      n_O(2:4,1); n_O(2:4,2);
      n_O(2:4,3); n_O(2:4,4)];

  n_par_primary = size(par_primary,1);
  
  fprintf(fid_par,  '      <TR>\n');
  fprintf(fid_par, ['        <TD><A HREF="./', species, '.html">', species, '</A></TD>\n']);
  for i = 1:n_par_primary
    fprintf(fid_par,'        <TD BGCOLOR = "%s">%g</TD> ', col_par_primary{i}, par_primary(i));
  end  
  fprintf(fid_par,'\n      </TR>\n');

%% statistics.html

  fprintf(fid_stat, '      <TR>\n');
  fprintf(fid_stat, ['        <TD><A HREF="./', species, '.html">', species, '</A></TD>\n        ']);
  for i = 1:n_statistics
    fprintf(fid_stat, '<TD BGCOLOR = "%s">%g</TD> ', col_statistics{i}, val_statistics(i));
  end  
  fprintf(fid_stat, '      </TR>\n');

%% my_pet.html

  oid = fopen(['./html/', species, '.html'], 'w+'); % % open file for writing, delete existing content
  fprintf(oid, '%s\n' ,'<HTML>');
  fprintf(oid, '%s\n' ,'  <HEAD>');
  fprintf(oid,['    <TITLE>add_my_pet:', species, '</TITLE>\n']);
  fprintf(oid, '%s'   ,'    <META NAME = "keywords" ');
  fprintf(oid, '%s\n' ,'     CONTENT="add_my_pet, Dynamic Energy Budget theory, DEBtool">');
  fprintf(oid, '%s\n' ,'  </HEAD>');
  fprintf(oid,'%s\n\n','  <BODY>');
  fprintf(oid,['    <H1 ALIGN="CENTER">', species, ': ', species_en, '</H1>\n\n']);
  fprintf(oid, '    <H3 ALIGN="CENTER">Go to <A HREF="../Species.html">species-list</A>, \n'); 
  fprintf(oid,['                             <A HREF="../pars_', species, '.m">pars</A>, \n']);
  fprintf(oid,['                             <A HREF="../mydata/mydata_',  species, '.m">mydata</A>, \n']);
  fprintf(oid,['                             <A HREF="../mydata/predict_', species, '.m">predict</A>, \n']);
  fprintf(oid,['                             <A HREF="../mydata/html/mydata_', species, '.html">fit</A><H3>\n\n']);
  fprintf(oid, '  <TABLE CELLSPACING=50><TR VALIGN=TOP><TD>\n');
  fprintf(oid, '    <TABLE>\n');
  fprintf(oid, '      <TR BGCOLOR = "#FFE7C6"> <TH>statistic</TH> <TH>value at T</TH> </TR>\n');
  for i = 1: n_statistics
    fprintf(oid, '      <TR><TD BGCOLOR = "%s">%s</TD> <TD BGCOLOR = "%s">%g</TD></TR>\n', col_statistics{i}, txt_statistics{i}, col_statistics{i}, val_statistics(i));
  end
  fprintf(oid, '    </TABLE>\n');
  fprintf(oid, '  </TD><TD>\n');
  fprintf(oid, '    <TABLE>\n');
  fprintf(oid, '      <TR BGCOLOR = "#FFE7C6"> <TH>parameter</TH> <TH>value  at T_ref</TH> </TR>\n');
  for i = 1: n_par_primary
    fprintf(oid, '      <TR><TD BGCOLOR = "%s">%s</TD> <TD BGCOLOR = "%s">%g</TD></TR>\n', col_par_primary{i}, txt_par_primary{i}, col_par_primary{i}, par_primary(i));
  end  
  fprintf(oid, '    </TABLE>\n');  
  fprintf(oid, '  </TD></TABLE>\n');  
  fprintf(oid, '  </BODY>\n');
  fprintf(oid, '</HTML>\n');
  fclose(oid);

##### SOURCE END #####
--></body></html>

<|start_filename|>docs/DEBtool_community.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_community</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: community</H3>

  A collection of routines for interacting populations in an environment with nutrient recycling

<HR>
<H4><A NAME="mixo">mixo</A></H4>

  A one-species community of mixotrophs: 
  organisms that can assimilate according to the phototrophic route (light plus inorganic carbon and nutrients), and the heterotrophic route (digestion of organic carbon, in this case dead individuals).

  Demo that runs:
  <UL>
    <LI> <A HREF="#shtime_mixo*"><code>shtime_mixo*</code></A>: 
         ontogeny batch culture of mixotrophs with * reserves </LI>
    <LI> <A HREF="#shstate*_mixo"><code>shstate*_mixo</code></A>:
         equilibrium of a batch culture of mixotrophs with * reserves </LI>
  </UL>

  The theory for the model can be found in: <BR> 
  Kooijman, <NAME>., <NAME>. and <NAME>. 2002
  <A HREF="http://www.bio.vu.nl/thb/research/bib/KooyDijk2002.html">
  Light-induced mass turnover in a mono-species community of mixotrophs.</A> 
  J. Theor. Biol. <B>214</B>: 233 - 254.

  <BR>
  The paper describes how light affect the turnover rates of organic matter and nutrients in a community that is open for energy, but closed for mass. 
  It also deals with steady states as functions of light, total carbon and total nitrogen, and depth-profiles of systems' components, including the ratio of the auto versus heterotrophic activities.

  <P>
  Example of use: 
  <CODE>mixo</CODE>

<HR>
<H4><A NAME="shtime*_mixo">shtime*_mixo</A></H4>

  Ontogeny of a batch reactor of mixotrops with * reserves, where * = 0, 1, or 3. Initial conditions can be changed by editing the files <code>pars0_mixo.m</code>, <code>pars1_mixo.m</code> or <code>pars3_mixo.m</code>.<BR>
  The figures show all the state variables against time. 

  <P>
  Example of use after editing <code>pars*_mixo.m</code> for * = 0, 1 or 3: 
  <CODE>shtime*_mixo</CODE>. 
  The command <CODE>shtime1_mixo (4)</CODE> will only plot fig <B>4</B> of the mixotroph community with 1 reserve.

<HR>
<H4><A NAME="shstate*_mixo">shstate*_mixo</A></H4>

  Equilibrium of a batch reactor of mixotrops with * reserves, where * = 0, 1, or 3 as functions of light, total carbon and total nitrogen. 
  The maximum values of these three system parameters are set in <code>pars*_mixo.m</code>.

  <P> 
  The distribution of carbon and nitrogen over the compounts are plotted cumulatively, so they sum to fixed totals.<BR>
  For carbon from bottom to top: DIC, structure-detritus, reserve-detritus (for * = 1, 3), structure, reserve (for * = 1, 3), carbon-reserve (for * = 3). 
  The curves between the type of detritus, and between structure and reserves are stippled.<BR>
  For nitrogen from bottom to top: DIN, structure-detritus, reserve-detritus (for * = 1, 3), structure, reserve (for * = 1, 3), nitrogen-reserve (for * = 3). 
  The curves between the type of detritus, and between structure and reserves are stippled.

  <P>
  Two equilibria can exist for the 3-reserve model. 
  If this happens, both branches are shown; one branch is plotted in magenta.

  <P>
  Example of use after editing <code>pars*_mixo.m</code> for * = 0, 1 or 3: 
  <CODE>shstate*_mixo</CODE>. 
  The command <CODE>shstate1_mixo (2)</CODE> will only plot fig <B>2</B> of the mixotroph community with 1 reserve.

<HR>
<H4><A NAME="shgrad*_mixo">shgrad*_mixo</A></H4>

  Shows gradients of mixotrops with * reserves, where * = 0, 1, or 3 as function of depth. 
  The parameters are set in <code>pars*_mixo.m</code>. 
  The number of layers is set in shgrad*_mixo; the light intensity reduces by a fixed factor between subsequent layers; 
  this factor is set in <code>pars*</code>. 
  The upward and downward specific mixing rates can be set per state variable (but make sure that that for structure and reserves are equal).

  <P>
  The output represent the state variables (in the columns) for the different layers (in the rows; the first row represents the surface layer) at the last time point of integration (set by tmax in shgrad*).

  <P>
  If a plot number is specified, the gradient ontogeny is shown, starting from a homogeneous distribution. 
  The stack of layers is closed for mass (no downward transport). 
  If no plot number is specified, all state variables as plotted as a function of depth for the last time point only.

  <P>
  Example of use after editing <code>pars*.m</code> for * = 0, 1 or 3: 
  <CODE>X = shgrad*_mixo;</CODE>. 
  The command <CODE>X = shgrad1_mixo (2)</CODE> will show a movie for state variable 2 (which is DIN) as a function of depth during time with 1 reserve; it also prints the final gradient.

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>animal/html/statistics.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>created 2000/11/02 by <NAME>, modified 2014/03/17</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-03-20"><meta name="DC.source" content="statistics.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>created 2000/11/02 by <NAME>, modified 2014/03/17</h1><!--introduction--><p>calculates food-dependent quantities for 'animal' run pars_animal before running this script add_my_pet is also using this script; first run pars_my_pet</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">life stage quantities</a></li><li><a href="#2">size</a></li><li><a href="#3">life span</a></li><li><a href="#4">feeding</a></li><li><a href="#5">reproduction</a></li><li><a href="#6">mass fluxes for L = L_i = s_M (f L_m - L_T)</a></li><li><a href="#7">population characteristics</a></li></ul></div><h2>life stage quantities<a name="1"></a></h2><pre class="codeinput"><span class="keyword">if</span> foetus == 1 &amp;&amp; E_Hj == E_Hb <span class="comment">% foetal development, no metamorphosis</span>
  <span class="comment">% notice that foetal development typically combines with high U_Hb</span>
  pars_E0 = [V_Hb; g; kT_J; kT_M; vT]; <span class="comment">% pars for initial_scaled_reserve</span>
  [U_E0 L_b info] = initial_scaled_reserve_foetus(f, pars_E0); <span class="comment">% d cm^2, initial scaled reserve</span>
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in initial_scaled_reserve_foetus: invalid parameter value combination for foetus \n'</span>)
  <span class="keyword">end</span>
  [l_b, t_b, info] = get_lb_foetus([g; k; v_Hb]);
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in get_lb_foetus: invalid parameter value combination for foetus \n'</span>)
  <span class="keyword">end</span>
  l_j = l_b;
  t_j = t_b;
  pars_tp = [g; k; l_T; v_Hb; v_Hp]; <span class="comment">% parameters for get_tp</span>
  [t_p tb l_p lb info] = get_tp_foetus(pars_tp, f);
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in get_tp: invalid parameter value combination for foetus \n'</span>)
  <span class="keyword">end</span>
  l_i = f - l_T;                       <span class="comment">% scaled ultimate length</span>
  r_B = 1/(3/ kT_M + 3 * f * L_m/ vT); <span class="comment">% 1/d, von Bert growth rate after j</span>
  s_M = 1; <span class="comment">% -, acceleration factor</span>
  clear <span class="string">tb</span> <span class="string">lb</span>
<span class="keyword">else</span> <span class="comment">% egg development, possibly with metamorphosis</span>
  <span class="keyword">if</span> E_Hj == E_Hb <span class="comment">% no metamorphosis</span>
    pars_tp = [g; k; l_T; v_Hb; v_Hp]; <span class="comment">% parameters for get_tp</span>
    [t_p t_b l_p l_b info] = get_tp(pars_tp, f); <span class="comment">% -, scaled age at puberty</span>
    <span class="keyword">if</span> info ~= 1
      fprintf(<span class="string">'warning in get_tp: invalid parameter value combination for t_p \n'</span>)
    <span class="keyword">end</span>
    l_j = l_b;                          <span class="comment">% -, scaled length at metamorphosis</span>
    t_j = t_b;                          <span class="comment">% -, scaled age at metamorphosis</span>
    l_i = f - l_T;                      <span class="comment">% -, scaled ultimate length</span>
    r_j = 0;                            <span class="comment">% 1/d, exponential growth rate between b and j</span>
    r_B = 1/(3/ kT_M + 3 * f * L_m/ vT);<span class="comment">% 1/d, von Bert growth rate after j</span>
    s_M = 1; <span class="comment">% -, acceleration factor</span>
  <span class="keyword">else</span> <span class="comment">% metamorphosis</span>
    <span class="comment">% notice that L_m relates to the embryo-values</span>
    pars_tj = [g; k; l_T; v_Hb; v_Hj; v_Hp]; <span class="comment">% parameters for get_tj</span>
    [t_j t_p t_b l_j l_p l_b l_i rho_j rho_B info] = get_tj(pars_tj, f, l_b);
    <span class="keyword">if</span> info ~= 1
      fprintf(<span class="string">'warning in get_tj: invalid parameter value combination for t_j \n'</span>)
    <span class="keyword">end</span>
    r_j = rho_j * kT_M;  <span class="comment">% 1/d, exponential growth rate between b and j</span>
    r_B = rho_B * kT_M;  <span class="comment">% 1/d, von Bert growth rate after j</span>
    s_M = l_j/ l_b;      <span class="comment">% -, acceleration factor</span>
  <span class="keyword">end</span>
  pars_E0 = [V_Hb; g; kT_J; kT_M; vT]; <span class="comment">% pars for initial_scaled_reserve</span>
  [U_E0 L_b info] = initial_scaled_reserve(f, pars_E0); <span class="comment">% d cm^2, initial scaled reserve</span>
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in initial_scaled_reserve: invalid parameter value combination for egg \n'</span>)
  <span class="keyword">end</span>
<span class="keyword">end</span>
E_0 = pT_Am * U_E0;    <span class="comment">% J, initial reserve (of embryo)</span>
M_E0 = E_0/ mu_E;      <span class="comment">% mol, initial reserve (of embryo)</span>
W_0 = M_E0 * w_O(3);   <span class="comment">% g, initial reserve (of embryo)</span>

a_b = t_b/ kT_M;       <span class="comment">% d, age at birth at T</span>
a_j = t_j/ kT_M;       <span class="comment">% d, age at metamorphosis at T</span>
a_p = t_p/ kT_M;       <span class="comment">% d, age at puberty at T</span>
a_99 = a_p + log((1 - l_p/ l_i)/(1 - 0.99))/ r_B;
				       <span class="comment">% d, time to reach length 0.99 * L_i</span>
L_b = L_m * l_b;       <span class="comment">% cm, structural length at birth</span>
L_j = L_m * l_j;       <span class="comment">% cm, structural length at metamorphosis</span>
L_p = L_m * l_p;       <span class="comment">% cm, structural length at puberty</span>
L_i = L_m * l_i;       <span class="comment">% cm, ultimate structural length</span>
Lw_b = L_b/ del_M;     <span class="comment">% cm. physical length at birth</span>
Lw_j = L_j/ del_M;     <span class="comment">% cm. physical length at metamorphosis</span>
Lw_p = L_p/ del_M;     <span class="comment">% cm, physical length at puberty</span>
Lw_i = L_i/ del_M;     <span class="comment">% cm, physical ultimate length</span>
M_Vb = M_V * L_b^3;    <span class="comment">% mol, structural mass at birth</span>
M_Vj = M_V * L_j^3;    <span class="comment">% mol, structural mass at metamorphosis</span>
M_Vp = M_V * L_p^3;    <span class="comment">% mol, structural mass at puberty</span>
M_Vi = M_V * L_i^3;    <span class="comment">% mol, ultimate structural mass</span>
U_Eb = f * E_m * L_b^3/ pT_Am; <span class="comment">% d cm^2, scaled reserve at birth</span>
del_Ub = U_Eb/ U_E0;   <span class="comment">% -, fraction of reserve left at birth</span>

s_s = k_J * E_Hp * (p_M + p_T/ L_i)^2/ p_Am^3/ f^3/ s_M^3; <span class="comment">% -, supply stress</span>
</pre><h2>size<a name="2"></a></h2><pre class="codeinput">W_b = L_b^3 * d_O(2) * (1 + f * m_Em * w_O(3)/ w_O(2)); <span class="comment">% g, dry weight at birth</span>
W_j = L_j^3 * d_O(2) * (1 + f * m_Em * w_O(3)/ w_O(2)); <span class="comment">% g, dry weight at metamorphosis</span>
W_p = L_p^3 * d_O(2) * (1 + f * m_Em * w_O(3)/ w_O(2)); <span class="comment">% g, dry weight at puberty</span>
W_i = L_i^3 * d_O(2)* (1 + f * m_Em * w_O(3)/ w_O(2));  <span class="comment">% g, ultimate dry weight</span>

del_Wb = W_b/ W_m;     <span class="comment">% -, birth weight as fraction of maximum weight</span>
del_Wj = W_j/ W_m;     <span class="comment">% -, metamorphosis weight as fraction of maximum weight</span>
del_Wp = W_p/ W_m;     <span class="comment">% -, puberty weight as fraction of maximum weight</span>
xi_W_E = (mu_V + mu_O(3) * m_Em * f)/ (w_O(2) + w_O(3) * m_Em * f);
    <span class="comment">% kJ/g, whole-body energy density (no reprod buffer), &lt;E + E_V&gt;</span>
</pre><h2>life span<a name="3"></a></h2><pre class="codeinput">pars_tm = [g; k; l_T; v_Hb; v_Hp; h_a/ (p_M/ E_G)^2; s_G];
<span class="comment">%[t_m S_b S_p] = get_tm(pars_tm, f, l_b, l_p); a_m = t_m/ kT_M; % d, mean life span</span>
[t_m S_b S_p] = get_tm_s(pars_tm, f, l_b/ l_i, l_p/ l_i); a_m = t_m/ kT_M; <span class="comment">% d, mean life span</span>
<span class="comment">% if E_Hj &gt; E_Hb: l_i &gt; f - l_T</span>
hT_W = (hT_a * f * kT_M * g/ 6)^(1/3); <span class="comment">% 1/d, Weibull ageing rate</span>
hT_G = s_G * f * kT_M * g;             <span class="comment">% 1/d, Gompertz ageing rate</span>
</pre><h2>feeding<a name="4"></a></h2><pre class="codeinput"><span class="comment">% scaled functional responses</span>
[eb_min lb_min uE0_min info_eb_min] = get_eb_min([g; k; v_Hb]); <span class="comment">% growth, maturation cease at birth</span>
M_E0_min_b = L_m^3 * E_m * g * uE0_min/ mu_E; <span class="comment">% mol, initial reserve (of embryo) at eb_min</span>

<span class="keyword">if</span> sum(info_eb_min) ~= 2
  fprintf(<span class="string">'Warning: no convergence for eb_min\n'</span>)
<span class="keyword">end</span>
<span class="keyword">if</span> E_Hj == E_Hb
  ep_min  = get_ep_min([k; l_T; v_Hp]); <span class="comment">% growth and maturation cease at puberty</span>
<span class="keyword">else</span>
  ep_min  = get_ep_min_metam([g; k; l_T; v_Hb; v_Hj; v_Hp]); <span class="comment">% growth and maturation cease at puberty</span>
<span class="keyword">end</span>
M_E0_min_p = L_m^3 * E_m * g * get_ue0([g; k; v_Hb], ep_min)/ mu_E; <span class="comment">% mol, initial reserve (of embryo) at ep_min</span>

<span class="comment">% food densities</span>
Kb_min = K * eb_min ./ (1 - eb_min);          <span class="comment">% growth, maturation cease at birth</span>
Kp_min = K * ep_min ./ (1 - ep_min);          <span class="comment">% growth and maturation cease at puberty</span>

<span class="comment">% food intake</span>
pT_Xb = pT_Am * f * L_b^2/ kap_X;             <span class="comment">% J/d, food intake at birth</span>
JT_XAb = pT_Xb/ mu_X;                         <span class="comment">% mol/d, food intake at birth</span>
pT_Xj = s_M * pT_Am * f * L_j^2/ kap_X;       <span class="comment">% J/d, food intake at metamorphosis</span>
JT_XAj = pT_Xj/ mu_X;                         <span class="comment">% mol/d, food intake at metamorphosis</span>
pT_Xp = s_M * pT_Am * f * L_p^2/ kap_X;       <span class="comment">% J/d, food intake at puberty</span>
JT_XAp = pT_Xp/ mu_X;                         <span class="comment">% mol/d, food intake at puberty</span>
pT_Xi = s_M * pT_Am * f * L_i^2/ kap_X;       <span class="comment">% J/d, ultimate food intake</span>
JT_XAi = pT_Xi/ mu_X;                         <span class="comment">% mol/d, ultimate food intake</span>

<span class="comment">% clearance rates</span>
CR_b = FT_m * L_b^2;                          <span class="comment">% l/d, clearance rate at birth</span>
CR_j = s_M * FT_m * L_j^2;                    <span class="comment">% l/d, clearance rate at metamorphosis</span>
CR_p = s_M * FT_m * L_p^2;                    <span class="comment">% l/d, clearance rate at puberty</span>
CR_i = s_M * FT_m * L_i^2;                    <span class="comment">% l/d, ultimate clearance rate</span>
</pre><h2>reproduction<a name="5"></a></h2><pre class="codeinput">pars_R = [kap; kap_R; g; kT_J; kT_M; L_T; vT; U_Hb; U_Hp];
<span class="keyword">if</span> foetus == 1 <span class="comment">% foetal development</span>
  R_i = reprod_rate_foetus(L_i, f, pars_R); <span class="comment">% d^-1</span>
<span class="keyword">elseif</span> E_Hj == E_Hb <span class="comment">% egg development without metamorphosis</span>
  R_i = reprod_rate(L_i, f, pars_R); <span class="comment">% d^-1</span>
<span class="keyword">else</span> <span class="comment">% egg development with metamorphosis</span>
  pars_R = [pars_R; L_b; L_j; L_p]; <span class="comment">% append lengths at b,j,p</span>
  [R_i, UE0, info] = reprod_rate_metam(L_i, f, pars_R);
  <span class="keyword">if</span> info ~= 1
    fprintf(<span class="string">'warning in reprod_rate_metam: invalid parameter value combination for R_i \n'</span>)
  <span class="keyword">end</span>
  clear <span class="string">UE0</span>
<span class="keyword">end</span>
<span class="comment">% very sensitive to U_Hb, which controls size at birth</span>

<span class="comment">% max gonado-somatic index of fully grown individual</span>
<span class="comment">%   that spawns once per year see (4.89) of DEB3</span>
GI = 365 * kT_M * g/ f^3/ (f + kap * g * y_V_E);
GI = GI * ((1 - kap) * f^3 - k_J * U_Hp/ L_i^2/ s_M^3); <span class="comment">% mol E_R/ mol W</span>
</pre><h2>mass fluxes for L = L_i = s_M (f L_m - L_T)<a name="6"></a></h2><pre class="codeinput">p_ref = pT_Am * L_m^2;        <span class="comment">% max assimilation power at max size</span>
<span class="keyword">if</span> U_Hj == U_Hb <span class="comment">% no metamorphosis</span>
  pars_pow = [kap; kap_R; g; kT_J; kT_M; L_T; vT; U_Hb; U_Hp];
  pACSJGRD_i = p_ref * scaled_power(L_i, f, pars_pow, l_b, l_p); <span class="comment">% powers</span>
  pACSJGRD_b = p_ref * scaled_power(L_b, f, pars_pow, l_b, l_p); <span class="comment">% powers</span>
  pACSJGRD_p = p_ref * scaled_power(L_p, f, pars_pow, l_b, l_p); <span class="comment">% powers</span>
<span class="keyword">else</span> <span class="comment">% metamorphosis</span>
  pars_pow = [kap; kap_R; g; kT_J; kT_M; L_T; vT; U_Hb; U_Hj; U_Hp];
  pACSJGRD_i = p_ref * scaled_power_j(L_i, f, pars_pow, l_b, l_j, l_p); <span class="comment">% powers</span>
  pACSJGRD_b = p_ref * scaled_power_j(L_b, f, pars_pow, l_b, l_j, l_p); <span class="comment">% powers</span>
  pACSJGRD_p = p_ref * scaled_power_j(L_p, f, pars_pow, l_b, l_j, l_p); <span class="comment">% powers</span>
<span class="keyword">end</span>
<span class="comment">% at birth</span>
pADG_b = pACSJGRD_b(:,[1 7 5])';  <span class="comment">% assimilation, dissipation, growth power</span>
J_O = eta_O * diag(pADG_b);     <span class="comment">% mol/d, J_X, J_V, J_E, J_P in rows, A, D, G in cols</span>
J_M = - (n_M\n_O) * J_O;      <span class="comment">% mol/d, J_C, J_H, J_O, J_N in rows, A, D, G in cols</span>
RQ_b = -(J_M(1,2) + J_M(1,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol C/ mol O, resp quotient</span>
UQ_b = -(J_M(4,2) + J_M(4,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol N/ mol O, urin quotient</span>
WQ_b = -(J_M(2,2) + J_M(2,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol H/ mol O, water quotient</span>
SDA_b = J_M(3,1)/ J_O(1,1);     <span class="comment">% mol O/mol X, specific dynamic action</span>
VO_b = J_M(3,2)/ W_b/ 24/ X_gas; <span class="comment">% L/g.h, dioxygen use per gram max dry weight, &lt;J_OD&gt;</span>
p_Tt_b = sum(- J_O' * mu_O - J_M' * mu_M); <span class="comment">% J/d, dissipating heat</span>
<span class="comment">% at puberty</span>
pADG_p = pACSJGRD_p(:,[1 7 5])';  <span class="comment">% assimilation, dissipation, growth power</span>
J_O = eta_O * diag(pADG_p);     <span class="comment">% mol/d, J_X, J_V, J_E, J_P in rows, A, D, G in cols</span>
J_M = - (n_M\n_O) * J_O;      <span class="comment">% mol/d, J_C, J_H, J_O, J_N in rows, A, D, G in cols</span>
RQ_p = -(J_M(1,2) + J_M(1,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol C/ mol O, resp quotient</span>
UQ_p = -(J_M(4,2) + J_M(4,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol N/ mol O, urin quotient</span>
WQ_p = -(J_M(2,2) + J_M(2,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol H/ mol O, water quotient</span>
SDA_p = J_M(3,1)/ J_O(1,1);     <span class="comment">% mol O/mol X, specific dynamic action</span>
VO_p = J_M(3,2)/ W_p/ 24/ X_gas; <span class="comment">% L/g.h, dioxygen use per gram max dry weight, &lt;J_OD&gt;</span>
p_Tt_p = sum(- J_O' * mu_O - J_M' * mu_M); <span class="comment">% J/d, dissipating heat</span>
<span class="comment">% at ultimate</span>
pADG_i = pACSJGRD_i(:,[1 7 5])';  <span class="comment">% assimilation, dissipation, growth power</span>
J_O = eta_O * diag(pADG_i);     <span class="comment">% mol/d, J_X, J_V, J_E, J_P in rows, A, D, G in cols</span>
J_M = - (n_M\n_O) * J_O;      <span class="comment">% mol/d, J_C, J_H, J_O, J_N in rows, A, D, G in cols</span>
RQ_i = -(J_M(1,2) + J_M(1,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol C/ mol O, resp quotient</span>
UQ_i = -(J_M(4,2) + J_M(4,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol N/ mol O, urin quotient</span>
WQ_i = -(J_M(2,2) + J_M(2,3))/ (J_M(3,2) + J_M(3,3)); <span class="comment">% mol H/ mol O, water quotient</span>
SDA_i = J_M(3,1)/ J_O(1,1);     <span class="comment">% mol O/mol X, specific dynamic action</span>
VO_i = J_M(3,2)/ W_i/ 24/ X_gas; <span class="comment">% L/g.h, dioxygen use per gram max dry weight, &lt;J_OD&gt;</span>
p_Tt_i = sum(- J_O' * mu_O - J_M' * mu_M); <span class="comment">% J/d, dissipating heat</span>
</pre><h2>population characteristics<a name="7"></a></h2><pre class="codeinput"><span class="keyword">if</span> foetus == 1 &amp;&amp; E_Hj == E_Hb <span class="comment">% foetal development</span>
  pars_rm = [kap kap_R g kT_J kT_M L_T vT U_Hb U_Hp hT_a s_G];
  [r_m Ea_m EL_m EL2_m EL3_m info_ssd] = ssd_iso_foetus(pars_rm, f);
  <span class="keyword">if</span> info_ssd ~= 1
    fprintf([<span class="string">'Warning: no convergence for sgr_iso_foetus for f = '</span>, num2str(f),<span class="string">'\n'</span>]);
  <span class="keyword">end</span>
  <span class="comment">% f_r = f_ris0(pars_rm, 1.02 * ep_min(1));</span>
  f_r = 1.02 * ep_min(1);
  [r_0 Ea_0 EL_0 EL2_0 EL3_0 info_ssd] = ssd_iso_foetus(pars_rm, f_r, 0);
<span class="keyword">elseif</span> E_Hj == E_Hb  <span class="comment">% egg development, no metamorphosis</span>
  pars_rm = [kap kap_R g kT_J kT_M L_T vT U_Hb U_Hp hT_a s_G];
  [r_m Ea_m EL_m EL2_m EL3_m info_ssd] = ssd_iso(pars_rm, f);
  <span class="keyword">if</span> info_ssd &lt; 1
    fprintf([<span class="string">'Warning: no convergence for sgr_iso for f = '</span>, num2str(f),<span class="string">'\n'</span>]);
  <span class="keyword">end</span>
  <span class="comment">% f_r = f_ris0(pars_rm, 1.02 * ep_min(1));</span>
  f_r = 1.02 * ep_min(1);
  [r_0 Ea_0 EL_0 EL2_0 EL3_0 info_ssd] = ssd_iso(pars_rm, f_r, 0);
<span class="keyword">else</span> <span class="comment">% egg development with metamorphosis</span>
  pars_rm = [kap kap_R g kT_J kT_M L_T vT U_Hb U_Hj U_Hp hT_a s_G];
  [r_m Ea_m EL_m EL2_m EL3_m info_ssd] = ssd_iso_metam(pars_rm, f);
  <span class="keyword">if</span> info_ssd ~= 1
    fprintf([<span class="string">'Warning: no convergence for sgr_iso_metam for f = '</span>, num2str(f),<span class="string">'\n'</span>]);
  <span class="keyword">end</span>
  <span class="comment">% f_r = f_ris0(pars_rm, 1.02 * ep_min(1));</span>
  f_r = 1.5 * ep_min(1);
  [r_0 Ea_0 EL_0 EL2_0 EL3_0 info_ssd] = ssd_iso_metam(pars_rm, f_r, 0);
<span class="keyword">end</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% created 2000/11/02 by <NAME>, modified 2014/03/17
% calculates food-dependent quantities for 'animal'
% run pars_animal before running this script
% add_my_pet is also using this script; first run pars_my_pet 

%% life stage quantities

if foetus == 1 && E_Hj == E_Hb % foetal development, no metamorphosis  
  % notice that foetal development typically combines with high U_Hb
  pars_E0 = [V_Hb; g; kT_J; kT_M; vT]; % pars for initial_scaled_reserve
  [U_E0 L_b info] = initial_scaled_reserve_foetus(f, pars_E0); % d cm^2, initial scaled reserve
  if info ~= 1
    fprintf('warning in initial_scaled_reserve_foetus: invalid parameter value combination for foetus \n')
  end
  [l_b, t_b, info] = get_lb_foetus([g; k; v_Hb]);
  if info ~= 1
    fprintf('warning in get_lb_foetus: invalid parameter value combination for foetus \n')
  end
  l_j = l_b;
  t_j = t_b;
  pars_tp = [g; k; l_T; v_Hb; v_Hp]; % parameters for get_tp
  [t_p tb l_p lb info] = get_tp_foetus(pars_tp, f);
  if info ~= 1
    fprintf('warning in get_tp: invalid parameter value combination for foetus \n')
  end
  l_i = f - l_T;                       % scaled ultimate length
  r_B = 1/(3/ kT_M + 3 * f * L_m/ vT); % 1/d, von Bert growth rate after j
  s_M = 1; % -, acceleration factor
  clear tb lb
else % egg development, possibly with metamorphosis
  if E_Hj == E_Hb % no metamorphosis
    pars_tp = [g; k; l_T; v_Hb; v_Hp]; % parameters for get_tp
    [t_p t_b l_p l_b info] = get_tp(pars_tp, f); % -, scaled age at puberty
    if info ~= 1              
      fprintf('warning in get_tp: invalid parameter value combination for t_p \n')
    end
    l_j = l_b;                          % -, scaled length at metamorphosis
    t_j = t_b;                          % -, scaled age at metamorphosis
    l_i = f - l_T;                      % -, scaled ultimate length
    r_j = 0;                            % 1/d, exponential growth rate between b and j
    r_B = 1/(3/ kT_M + 3 * f * L_m/ vT);% 1/d, von Bert growth rate after j
    s_M = 1; % -, acceleration factor
  else % metamorphosis
    % notice that L_m relates to the embryo-values
    pars_tj = [g; k; l_T; v_Hb; v_Hj; v_Hp]; % parameters for get_tj
    [t_j t_p t_b l_j l_p l_b l_i rho_j rho_B info] = get_tj(pars_tj, f, l_b); 
    if info ~= 1
      fprintf('warning in get_tj: invalid parameter value combination for t_j \n')
    end
    r_j = rho_j * kT_M;  % 1/d, exponential growth rate between b and j
    r_B = rho_B * kT_M;  % 1/d, von Bert growth rate after j
    s_M = l_j/ l_b;      % -, acceleration factor
  end
  pars_E0 = [V_Hb; g; kT_J; kT_M; vT]; % pars for initial_scaled_reserve
  [U_E0 L_b info] = initial_scaled_reserve(f, pars_E0); % d cm^2, initial scaled reserve
  if info ~= 1
    fprintf('warning in initial_scaled_reserve: invalid parameter value combination for egg \n')
  end
end
E_0 = pT_Am * U_E0;    % J, initial reserve (of embryo)
M_E0 = E_0/ mu_E;      % mol, initial reserve (of embryo)
W_0 = M_E0 * w_O(3);   % g, initial reserve (of embryo)
    
a_b = t_b/ kT_M;       % d, age at birth at T
a_j = t_j/ kT_M;       % d, age at metamorphosis at T
a_p = t_p/ kT_M;       % d, age at puberty at T
a_99 = a_p + log((1 - l_p/ l_i)/(1 - 0.99))/ r_B; 
				       % d, time to reach length 0.99 * L_i
L_b = L_m * l_b;       % cm, structural length at birth
L_j = L_m * l_j;       % cm, structural length at metamorphosis
L_p = L_m * l_p;       % cm, structural length at puberty
L_i = L_m * l_i;       % cm, ultimate structural length
Lw_b = L_b/ del_M;     % cm. physical length at birth
Lw_j = L_j/ del_M;     % cm. physical length at metamorphosis
Lw_p = L_p/ del_M;     % cm, physical length at puberty
Lw_i = L_i/ del_M;     % cm, physical ultimate length
M_Vb = M_V * L_b^3;    % mol, structural mass at birth
M_Vj = M_V * L_j^3;    % mol, structural mass at metamorphosis
M_Vp = M_V * L_p^3;    % mol, structural mass at puberty
M_Vi = M_V * L_i^3;    % mol, ultimate structural mass
U_Eb = f * E_m * L_b^3/ pT_Am; % d cm^2, scaled reserve at birth
del_Ub = U_Eb/ U_E0;   % -, fraction of reserve left at birth

s_s = k_J * E_Hp * (p_M + p_T/ L_i)^2/ p_Am^3/ f^3/ s_M^3; % -, supply stress

%% size

W_b = L_b^3 * d_O(2) * (1 + f * m_Em * w_O(3)/ w_O(2)); % g, dry weight at birth
W_j = L_j^3 * d_O(2) * (1 + f * m_Em * w_O(3)/ w_O(2)); % g, dry weight at metamorphosis
W_p = L_p^3 * d_O(2) * (1 + f * m_Em * w_O(3)/ w_O(2)); % g, dry weight at puberty
W_i = L_i^3 * d_O(2)* (1 + f * m_Em * w_O(3)/ w_O(2));  % g, ultimate dry weight

del_Wb = W_b/ W_m;     % -, birth weight as fraction of maximum weight
del_Wj = W_j/ W_m;     % -, metamorphosis weight as fraction of maximum weight
del_Wp = W_p/ W_m;     % -, puberty weight as fraction of maximum weight
xi_W_E = (mu_V + mu_O(3) * m_Em * f)/ (w_O(2) + w_O(3) * m_Em * f); 
    % kJ/g, whole-body energy density (no reprod buffer), <E + E_V>

%% life span

pars_tm = [g; k; l_T; v_Hb; v_Hp; h_a/ (p_M/ E_G)^2; s_G]; 
%[t_m S_b S_p] = get_tm(pars_tm, f, l_b, l_p); a_m = t_m/ kT_M; % d, mean life span
[t_m S_b S_p] = get_tm_s(pars_tm, f, l_b/ l_i, l_p/ l_i); a_m = t_m/ kT_M; % d, mean life span
% if E_Hj > E_Hb: l_i > f - l_T
hT_W = (hT_a * f * kT_M * g/ 6)^(1/3); % 1/d, Weibull ageing rate
hT_G = s_G * f * kT_M * g;             % 1/d, Gompertz ageing rate

%% feeding

% scaled functional responses
[eb_min lb_min uE0_min info_eb_min] = get_eb_min([g; k; v_Hb]); % growth, maturation cease at birth
M_E0_min_b = L_m^3 * E_m * g * uE0_min/ mu_E; % mol, initial reserve (of embryo) at eb_min

if sum(info_eb_min) ~= 2
  fprintf('Warning: no convergence for eb_min\n')
end
if E_Hj == E_Hb
  ep_min  = get_ep_min([k; l_T; v_Hp]); % growth and maturation cease at puberty
else
  ep_min  = get_ep_min_metam([g; k; l_T; v_Hb; v_Hj; v_Hp]); % growth and maturation cease at puberty  
end
M_E0_min_p = L_m^3 * E_m * g * get_ue0([g; k; v_Hb], ep_min)/ mu_E; % mol, initial reserve (of embryo) at ep_min

% food densities
Kb_min = K * eb_min ./ (1 - eb_min);          % growth, maturation cease at birth
Kp_min = K * ep_min ./ (1 - ep_min);          % growth and maturation cease at puberty

% food intake
pT_Xb = pT_Am * f * L_b^2/ kap_X;             % J/d, food intake at birth
JT_XAb = pT_Xb/ mu_X;                         % mol/d, food intake at birth
pT_Xj = s_M * pT_Am * f * L_j^2/ kap_X;       % J/d, food intake at metamorphosis
JT_XAj = pT_Xj/ mu_X;                         % mol/d, food intake at metamorphosis
pT_Xp = s_M * pT_Am * f * L_p^2/ kap_X;       % J/d, food intake at puberty
JT_XAp = pT_Xp/ mu_X;                         % mol/d, food intake at puberty
pT_Xi = s_M * pT_Am * f * L_i^2/ kap_X;       % J/d, ultimate food intake
JT_XAi = pT_Xi/ mu_X;                         % mol/d, ultimate food intake

% clearance rates
CR_b = FT_m * L_b^2;                          % l/d, clearance rate at birth 
CR_j = s_M * FT_m * L_j^2;                    % l/d, clearance rate at metamorphosis
CR_p = s_M * FT_m * L_p^2;                    % l/d, clearance rate at puberty
CR_i = s_M * FT_m * L_i^2;                    % l/d, ultimate clearance rate

%% reproduction

pars_R = [kap; kap_R; g; kT_J; kT_M; L_T; vT; U_Hb; U_Hp];
if foetus == 1 % foetal development
  R_i = reprod_rate_foetus(L_i, f, pars_R); % d^-1
elseif E_Hj == E_Hb % egg development without metamorphosis
  R_i = reprod_rate(L_i, f, pars_R); % d^-1
else % egg development with metamorphosis
  pars_R = [pars_R; L_b; L_j; L_p]; % append lengths at b,j,p
  [R_i, UE0, info] = reprod_rate_metam(L_i, f, pars_R);
  if info ~= 1
    fprintf('warning in reprod_rate_metam: invalid parameter value combination for R_i \n')
  end  
  clear UE0
end
% very sensitive to U_Hb, which controls size at birth

% max gonado-somatic index of fully grown individual 
%   that spawns once per year see (4.89) of DEB3
GI = 365 * kT_M * g/ f^3/ (f + kap * g * y_V_E);
GI = GI * ((1 - kap) * f^3 - k_J * U_Hp/ L_i^2/ s_M^3); % mol E_R/ mol W

%% mass fluxes for L = L_i = s_M (f L_m - L_T)

p_ref = pT_Am * L_m^2;        % max assimilation power at max size
if U_Hj == U_Hb % no metamorphosis
  pars_pow = [kap; kap_R; g; kT_J; kT_M; L_T; vT; U_Hb; U_Hp];
  pACSJGRD_i = p_ref * scaled_power(L_i, f, pars_pow, l_b, l_p); % powers
  pACSJGRD_b = p_ref * scaled_power(L_b, f, pars_pow, l_b, l_p); % powers
  pACSJGRD_p = p_ref * scaled_power(L_p, f, pars_pow, l_b, l_p); % powers
else % metamorphosis
  pars_pow = [kap; kap_R; g; kT_J; kT_M; L_T; vT; U_Hb; U_Hj; U_Hp];
  pACSJGRD_i = p_ref * scaled_power_j(L_i, f, pars_pow, l_b, l_j, l_p); % powers
  pACSJGRD_b = p_ref * scaled_power_j(L_b, f, pars_pow, l_b, l_j, l_p); % powers
  pACSJGRD_p = p_ref * scaled_power_j(L_p, f, pars_pow, l_b, l_j, l_p); % powers
end
% at birth
pADG_b = pACSJGRD_b(:,[1 7 5])';  % assimilation, dissipation, growth power
J_O = eta_O * diag(pADG_b);     % mol/d, J_X, J_V, J_E, J_P in rows, A, D, G in cols
J_M = - (n_M\n_O) * J_O;      % mol/d, J_C, J_H, J_O, J_N in rows, A, D, G in cols
RQ_b = -(J_M(1,2) + J_M(1,3))/ (J_M(3,2) + J_M(3,3)); % mol C/ mol O, resp quotient
UQ_b = -(J_M(4,2) + J_M(4,3))/ (J_M(3,2) + J_M(3,3)); % mol N/ mol O, urin quotient
WQ_b = -(J_M(2,2) + J_M(2,3))/ (J_M(3,2) + J_M(3,3)); % mol H/ mol O, water quotient
SDA_b = J_M(3,1)/ J_O(1,1);     % mol O/mol X, specific dynamic action
VO_b = J_M(3,2)/ W_b/ 24/ X_gas; % L/g.h, dioxygen use per gram max dry weight, <J_OD>
p_Tt_b = sum(- J_O' * mu_O - J_M' * mu_M); % J/d, dissipating heat
% at puberty
pADG_p = pACSJGRD_p(:,[1 7 5])';  % assimilation, dissipation, growth power
J_O = eta_O * diag(pADG_p);     % mol/d, J_X, J_V, J_E, J_P in rows, A, D, G in cols
J_M = - (n_M\n_O) * J_O;      % mol/d, J_C, J_H, J_O, J_N in rows, A, D, G in cols
RQ_p = -(J_M(1,2) + J_M(1,3))/ (J_M(3,2) + J_M(3,3)); % mol C/ mol O, resp quotient
UQ_p = -(J_M(4,2) + J_M(4,3))/ (J_M(3,2) + J_M(3,3)); % mol N/ mol O, urin quotient
WQ_p = -(J_M(2,2) + J_M(2,3))/ (J_M(3,2) + J_M(3,3)); % mol H/ mol O, water quotient
SDA_p = J_M(3,1)/ J_O(1,1);     % mol O/mol X, specific dynamic action
VO_p = J_M(3,2)/ W_p/ 24/ X_gas; % L/g.h, dioxygen use per gram max dry weight, <J_OD>
p_Tt_p = sum(- J_O' * mu_O - J_M' * mu_M); % J/d, dissipating heat
% at ultimate
pADG_i = pACSJGRD_i(:,[1 7 5])';  % assimilation, dissipation, growth power
J_O = eta_O * diag(pADG_i);     % mol/d, J_X, J_V, J_E, J_P in rows, A, D, G in cols
J_M = - (n_M\n_O) * J_O;      % mol/d, J_C, J_H, J_O, J_N in rows, A, D, G in cols
RQ_i = -(J_M(1,2) + J_M(1,3))/ (J_M(3,2) + J_M(3,3)); % mol C/ mol O, resp quotient
UQ_i = -(J_M(4,2) + J_M(4,3))/ (J_M(3,2) + J_M(3,3)); % mol N/ mol O, urin quotient
WQ_i = -(J_M(2,2) + J_M(2,3))/ (J_M(3,2) + J_M(3,3)); % mol H/ mol O, water quotient
SDA_i = J_M(3,1)/ J_O(1,1);     % mol O/mol X, specific dynamic action
VO_i = J_M(3,2)/ W_i/ 24/ X_gas; % L/g.h, dioxygen use per gram max dry weight, <J_OD>
p_Tt_i = sum(- J_O' * mu_O - J_M' * mu_M); % J/d, dissipating heat


%% population characteristics

if foetus == 1 && E_Hj == E_Hb % foetal development
  pars_rm = [kap kap_R g kT_J kT_M L_T vT U_Hb U_Hp hT_a s_G];
  [r_m Ea_m EL_m EL2_m EL3_m info_ssd] = ssd_iso_foetus(pars_rm, f);
  if info_ssd ~= 1
    fprintf(['Warning: no convergence for sgr_iso_foetus for f = ', num2str(f),'\n']);
  end
  % f_r = f_ris0(pars_rm, 1.02 * ep_min(1));
  f_r = 1.02 * ep_min(1);
  [r_0 Ea_0 EL_0 EL2_0 EL3_0 info_ssd] = ssd_iso_foetus(pars_rm, f_r, 0);
elseif E_Hj == E_Hb  % egg development, no metamorphosis
  pars_rm = [kap kap_R g kT_J kT_M L_T vT U_Hb U_Hp hT_a s_G];
  [r_m Ea_m EL_m EL2_m EL3_m info_ssd] = ssd_iso(pars_rm, f);
  if info_ssd < 1
    fprintf(['Warning: no convergence for sgr_iso for f = ', num2str(f),'\n']);
  end
  % f_r = f_ris0(pars_rm, 1.02 * ep_min(1));
  f_r = 1.02 * ep_min(1);
  [r_0 Ea_0 EL_0 EL2_0 EL3_0 info_ssd] = ssd_iso(pars_rm, f_r, 0);
else % egg development with metamorphosis
  pars_rm = [kap kap_R g kT_J kT_M L_T vT U_Hb U_Hj U_Hp hT_a s_G];
  [r_m Ea_m EL_m EL2_m EL3_m info_ssd] = ssd_iso_metam(pars_rm, f);
  if info_ssd ~= 1
    fprintf(['Warning: no convergence for sgr_iso_metam for f = ', num2str(f),'\n']);
  end
  % f_r = f_ris0(pars_rm, 1.02 * ep_min(1));
  f_r = 1.5 * ep_min(1);
  [r_0 Ea_0 EL_0 EL2_0 EL3_0 info_ssd] = ssd_iso_metam(pars_rm, f_r, 0);
end

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/Odesolvers/ebtrkck.c<|end_filename|>
/***
   NAME
     ebtrkck
   DESCRIPTION
     This file contains the specification of the Cash-Karp Runga-Kutta
     integration method with adaptive stepsize for the actual time integration
     of the ODEs in the Escalator Boxcar Train program.
   NOTES
     
   HISTORY
     AMdR - Nov 08, 1998 : Created.
     AMdR - Jan 07, 2012 : Revised last.
***/
#ifndef EBTRKCK
#define EBTRKCK
#endif



/*==========================================================================*/
/*
 * Defining all constants that are local to this specific file.
 */

#define PSHRINK		-0.25
#define PGROW		-0.2
#define ABS_ERR		(2.0E-13)/accuracy
#define SAFETY		0.9



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define MAFO "Memory allocation failure in ODE integration routine!"
#define REC  "Too many recursions in integration to find suitable stepsize!"
#define SSS  "Step size in integration routine too small!"



/*==========================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

static int		step_failed=0, recur_no;
static long		ODEAllocated = 0L, SystemSize;
static double		abs_err;
static double		*xin = NULL, *xtemp = NULL;
static double		*der1 = NULL, *der2 = NULL, *der3 = NULL;
static double		*der4 = NULL, *der5 = NULL, *der6 = NULL;
#if (POPULATION_NR > 0)
static int		table_size[POPULATION_NR];
static population	u_pop[POPULATION_NR], 	   u_ofs[POPULATION_NR];
static population	u_popgrad1[POPULATION_NR], u_ofsgrad1[POPULATION_NR];
static population	u_popgrad2[POPULATION_NR], u_ofsgrad2[POPULATION_NR];
static population	u_popgrad3[POPULATION_NR], u_ofsgrad3[POPULATION_NR];
static population	u_popgrad4[POPULATION_NR], u_ofsgrad4[POPULATION_NR];
static population	u_popgrad5[POPULATION_NR], u_ofsgrad5[POPULATION_NR];
static population	u_popgrad6[POPULATION_NR], u_ofsgrad6[POPULATION_NR];
#else
static population	*bpoints = NULL;
static population	*u_pop = NULL, 	    *u_ofs = NULL;
static population	*u_popgrad1 = NULL, *u_ofsgrad1 = NULL;
static population	*u_popgrad2 = NULL, *u_ofsgrad2 = NULL;
static population	*u_popgrad3 = NULL, *u_ofsgrad3 = NULL;
static population	*u_popgrad4 = NULL, *u_ofsgrad4 = NULL;
static population	*u_popgrad5 = NULL, *u_ofsgrad5 = NULL;
static population	*u_popgrad6 = NULL, *u_ofsgrad6 = NULL;
#endif // (POPULATION_NR > 0)



/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

void	PrepareCycle()

  /* 
   * PrepareCycle - This routine is called at the beginning of a cohort
   *		    cycle, when the size of the system of ODEs is fixed and
   *		    will not change until the end of the cohort cycle has
   *		    been reached. The different memory copies of the data
   *		    to be integrated and the pointers into the data heap
   *		    can hence safely be set up.
   */

{
  abs_err 	= ABS_ERR;
  SystemSize    = ENVIRON_DIM;

#if (POPULATION_NR > 0)
  register int		i;

  for(i=0; i<POPULATION_NR; i++)
    {
      table_size[i] = CohortNo[i]+BpointNo[i];
      SystemSize   += table_size[i]*COHORT_SIZE;
    }
#endif

  if (!(SystemSize < ODEAllocated))
    {
      ODEAllocated = MemBlocks(SystemSize);
      xin   = (double *)Myalloc((void *)xin, (size_t)ODEAllocated,
				sizeof(double));
      xtemp = (double *)Myalloc((void *)xtemp, (size_t)ODEAllocated,
				sizeof(double));
      der1  = (double *)Myalloc((void *)der1, (size_t)ODEAllocated,
				sizeof(double));
      der2  = (double *)Myalloc((void *)der2, (size_t)ODEAllocated,
				sizeof(double));
      der3  = (double *)Myalloc((void *)der3, (size_t)ODEAllocated,
				sizeof(double));
      der4  = (double *)Myalloc((void *)der4, (size_t)ODEAllocated,
				sizeof(double));
      der5  = (double *)Myalloc((void *)der5, (size_t)ODEAllocated,
				sizeof(double));
      der6  = (double *)Myalloc((void *)der6, (size_t)ODEAllocated,
				sizeof(double));
      if(!(xin && xtemp && der1 && der2 && der3 && der4 && der5 && der6))
	ErrorAbort(MAFO);
    }

  (void)memcpy((DEF_TYPE *)xin,			/* Copy environment vars.   */
	       (DEF_TYPE *)env,
	       ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
  int			len;

  len = ENVIRON_DIM;
  for(i=0; i<POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)(xin+len),	/* Copy other populations   */
		   (DEF_TYPE *)pop[i],
		   (table_size[i]*COHORT_SIZE)*sizeof(double));
      u_pop[i] = (population)(xtemp+len);
      u_ofs[i] = (population)(xtemp+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad1[i] = (population)(der1+len);
      u_ofsgrad1[i] = (population)(der1+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad2[i] = (population)(der2+len);
      u_ofsgrad2[i] = (population)(der2+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad3[i] = (population)(der3+len);
      u_ofsgrad3[i] = (population)(der3+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad4[i] = (population)(der4+len);
      u_ofsgrad4[i] = (population)(der4+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad5[i] = (population)(der5+len);
      u_ofsgrad5[i] = (population)(der5+len+CohortNo[i]*COHORT_SIZE);
      u_popgrad6[i] = (population)(der6+len);
      u_ofsgrad6[i] = (population)(der6+len+CohortNo[i]*COHORT_SIZE);

      len += (table_size[i]*COHORT_SIZE);
    }
#endif

  return;
}




/*==========================================================================*/

static void	rkck(double dt)

  /* 
   * rkck - Routine performs a Cash-Karp Runge-Kutta integration step of
   *        the system and updates all the variables.
   */

{
  register int		i;
  static CONST double	b11=		     0.2;
  static CONST double	b21=	    3.0/    40.0,  b22=	       9.0/     40.0;
  static CONST double	b31=		     0.3,  b32= -		 0.9,
			b33=		     1.2;
  static CONST double	b41= -	   11.0/    54.0,  b42=			 2.5,
			b43= -	   70.0/    27.0,  b44=	      35.0/	27.0;
  static CONST double	b51=	 1631.0/ 55296.0,  b52=	     175.0/    512.0, 
			b53=	  575.0/ 13824.0,  b54=	   44275.0/ 110592.0, 
			b55=	  253.0/  4096.0;
  static CONST double	c1  =  37.0/ 378.0,
			c3  = 250.0/ 621.0,
			c4  = 125.0/ 594.0,
			c6  = 512.0/1771.0;
  static CONST double	dc1 =  37.0/ 378.0 -  2825.0/27648.0,
			dc3 = 250.0/ 621.0 - 18575.0/48384.0,
			dc4 = 125.0/ 594.0 - 13525.0/55296.0,
			dc5 =		   -   277.0/14336.0,
			dc6 = 512.0/1771.0 - 0.25;

  initState = xin;
  currentState = xtemp;
  currentDers[1] = der1;
  currentDers[2] = der2;
  currentDers[3] = der3;
  currentDers[4] = der4;
  currentDers[5] = der5;
  currentDers[6] = der6;
						/* Set all time derivatives */
  der1[0] = der2[0] = der3[0] = der4[0] = der5[0] = der6[0] = 1.0;

						/* Don't do first deriva-   */
  if(!recur_no)					/* tive if already present  */
    {
      (void)memcpy((DEF_TYPE *)xtemp,(DEF_TYPE *)xin,
		   SystemSize*sizeof(double));
      rk_level = 1;
      Gradient(xtemp, u_pop, u_ofs, der1, u_popgrad1, u_ofsgrad1, bpoints);
    }

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + dt*(b11*der1[i]);

  rk_level = 2;
  Gradient(xtemp, u_pop, u_ofs, der2, u_popgrad2, u_ofsgrad2, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + dt*(b21*der1[i]+b22*der2[i]);

  rk_level = 3;
  Gradient(xtemp, u_pop, u_ofs, der3, u_popgrad3, u_ofsgrad3, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] + dt*(b31*der1[i]+b32*der2[i]+b33*der3[i]);

  rk_level = 4;
  Gradient(xtemp, u_pop, u_ofs, der4, u_popgrad4, u_ofsgrad4, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] +
      dt*(b41*der1[i]+b42*der2[i]+b43*der3[i]+b44*der4[i]);

  rk_level = 5;
  Gradient(xtemp, u_pop, u_ofs, der5, u_popgrad5, u_ofsgrad5, bpoints);

  for (i=0; i<SystemSize; i++)
    xtemp[i] = xin[i] +
      dt*(b51*der1[i]+b52*der2[i]+b53*der3[i]+b54*der4[i]+b55*der5[i]);

  rk_level = 6;
  Gradient(xtemp, u_pop, u_ofs, der6, u_popgrad6, u_ofsgrad6, bpoints);

  for (i=0; i<SystemSize; i++)			/* Save 5th order values    */
    xtemp[i] = xin[i] +
      dt*(c1*der1[i]+c3*der3[i]+c4*der4[i]+c6*der6[i]);

						/* Save differences with 4th*/
  for (i=0; i<SystemSize; i++)			/* order values in der2     */
    der2[i] =					/* (no longer needed)       */
      dt*(dc1*der1[i]+dc3*der3[i]+dc4*der4[i]+dc5*der5[i]+dc6*der6[i]);

  return;
}




/*==========================================================================*/

double	  IntegrationStep(double del_tim, double del_max, int recurs)

  /* 
   * IntegrationStep - Performs an integration with adaptable step size but 
   *                   maximum "del_max". Step size control and order 
   *                   increase using Fehlberg's method as implemented by 
   *                   Watts & Shampine (see Forsythe et al., 1977,
   *		       Computer methods for mathematical computations,
   *		       Chapter 6). 
   */
  
{
  register int		i, ierr = -1;
  register double	*pin, *perr, *pout;
  double		del_h, ss;
  double		errmax, err;
  int			adjust = 1;
  
  del_h = del_tim;				/* Adjust stepsize to hit   */
  if(del_max < (2*del_tim))			/* cohort end, look ahead   */
    {						/* two steps to avoid too   */
      del_h = 0.5*del_max;			/* drastic step changes	    */
      if(del_max < del_tim) del_h = del_max;
      adjust = 0;
    }
  if(del_h < SMALLEST_STEP)
    {
#if (POPULATION_NR > 0)
      TransBcohorts();
#endif // (POPULATION_NR > 0)
      ErrorExit(0, SSS);
    }
  recur_no = recurs;

  rkck(del_h);					/* Do an integration step   */

  pin = xin; perr = der2; pout = xtemp; errmax=0.0;

  // Determine relative error according to Watts & Shampine (see Forsythe)
  for(i=0; i<SystemSize; i++)
    {
      err    = fabs(perr[i])/(fabs(pin[i])+fabs(pout[i])+abs_err);
      if (EBTDEBUG(4))
	{
	  if (err > errmax) ierr = i;
	}
      errmax = max(err, errmax);
    }
  errmax *= 2.0*del_h/accuracy;
  if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "Largest error %15.8E in component %2d\n", errmax, ierr);
	  fflush(dbgfil);
	}
						/* If bigger than accuracy  */
  if (errmax > 1.0)				/* take smaller step and    */
    {						/* restart. Stepdecrease    */
      recur_no++; step_failed=1;		/* is limited to 0.1.	    */

      if (recur_no > 25)
	{
#if (POPULATION_NR > 0)
	  TransBcohorts();
#endif // (POPULATION_NR > 0)
	  ErrorExit(0, REC);
	}
						/* This part is adapted	    */
      if(errmax < 59049.0)			/* from Watts & Shampine    */
	del_h *= max(SAFETY*pow(errmax, PSHRINK), 0.1);
      else del_h *= 0.1;

      if (EBTDEBUG(3))
	{
	  fprintf(dbgfil, "Step failed: T = %15.8f dt = %12.7E recurs = %2d\n",
		  env[0], del_h, recur_no);
	  fflush(dbgfil);
	}
      step_size = del_h;
      del_h=IntegrationStep(del_h, del_max, recur_no);
    }						/* Otherwise compute new    */
  else						/* stepsize. Increase is    */
    {						/* limited to factor 5.0    */
      if (adjust && !step_failed)		/* No increase if failed    */
	{					/* just before		    */
	  if(errmax > 1.889568E-4) ss = min(SAFETY*pow(errmax, PGROW), 5.0);
	  else ss = 5.0;
          step_size=min(ss*del_h, cohort_limit);
        }
      step_failed=0;

						/* Update basic data copy   */
      (void)memcpy((DEF_TYPE *)env,		/* Copy environment vars.   */
                   (DEF_TYPE *)xtemp,
		   ENVIRON_DIM*sizeof(double));

#if (POPULATION_NR > 0)
      int			len = ENVIRON_DIM;

      for(i=0; i<POPULATION_NR; i++)
	{
	  (void)memcpy((DEF_TYPE *)pop[i],	/* Copy other populations   */
		       (DEF_TYPE *)(xtemp+len),
		       (table_size[i]*COHORT_SIZE)*sizeof(double));
	  len += (table_size[i]*COHORT_SIZE);
	}
#endif						/* Update local data copy   */
      (void)memcpy((DEF_TYPE *)xin,(DEF_TYPE *)xtemp,
		   SystemSize*sizeof(double));
      if (EBTDEBUG(4))
	{
	  fprintf(dbgfil, "Step OK: T = %15.8f dt = %12.7E recurs = %2d\n",
		  env[0], del_h, recur_no);
	  fflush(dbgfil);
	}
    }
  
  return del_h;
}



/*==========================================================================*/


<|start_filename|>docs/DEBtool_contents.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>DEBtool_contents</TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>Contents</H1>

  The routines are organized in the subdirectories (here called "toolboxes")
  <ul>
    <li> <A HREF="index_lib.html" TARGET="_top"><code>lib</code></A>: 
         general purpose routines,<BR>
         called by other routines in sister subdirectories<BR>
         regression routines </li>
    <li> <A HREF="index_enzyme.html" TARGET="_top"><code>enzyme</code></A>: 
         enzyme kinetics<BR>
         compares enzyme performance in reactions 
         between two complementary compounds </li>
    <li> <A HREF="index_microbe.html" TARGET="_top"><code>microbe</code></A>: 
         micro-organisms in reactors<BR> 
         1 reserve, 1 structure, V1-morph </li>
    <li> <A HREF="index_alga.html" TARGET="_top"><code>alga</code></A>: 
         nutrient-limited growth of algae in reactors<BR> 
         more reserves, 1 structure, V1-morph </li>
    <li> <A HREF="index_animal.html" TARGET="_top"><code>animal</code></A>: 
         animal physiology<BR>
         1 reserve, 1 structure, isomorph (iso_11)</li>
    <li> <A HREF="index_taxa.html" TARGET="_top"><code>taxa</code></A>: 
         taxa in the add_my_pet collection<BR>
         support files and functions for overview and selection</li>
    <li> <A HREF="index_iso_21.html" TARGET="_top"><code>iso_21</code></A>: 
         animal physiology<BR>
         2 reserves, 1 structure, isomorph </li>
    <li> <A HREF="index_plant.html" TARGET="_top"><code>plant</code></A>: 
         plant physiology<BR> 
         6 reserves, 2 structures, generalized morphology </li>
    <li> <A HREF="index_community.html" TARGET="_top"><code>community</code></A>: 
         1 species community of mixotrophs<BR> 
         0,1,3 reserves, 1 structure, V1-morph </li>
    <li> <A HREF="index_symbi.html" TARGET="_top"><code>symbi</code></A>: 
         interaction between hosts and symbionts in reactors<BR> 
         host: 1 reserve, 1 structure, V1-morph<BR> 
         symbiont: 2 reserves, 1 structure, V1-morph </li>
    <li> <A HREF="index_tox.html" TARGET="_top"><code>tox</code></A>: 
         toxicokinetics, and effects of chemical compounds on organisms and populations </li>
    <li> <A HREF="index_degrad.html" TARGET="_top"><code>degrad</code></A>: 
         biodegradation of chemical compounds in batch cultures </li>
    <li> <A HREF="index_fig_3.html" TARGET="_top"><code>fig_3</code></A>: 
         script files for figures of the 
         <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2009.html">DEB-book third edition</A> </li>
  </ul>

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/ebtstop.h<|end_filename|>
/***
   NAME
     ebtstop.h
   PURPOSE
     Interface header file to the functions defined in ebtstop.c
   NOTES
     
   HISTORY
     AMdR - Jul 19, 1995 : Created.
     AMdR - Nov 15, 2015 : Revised last.
***/

/*==========================================================================*/
#ifndef EBTSTOP_H
#define EBTSTOP_H

#ifdef	EBTSTOP_C
#undef	EXTERN
#define EXTERN
#else
#undef	EXTERN
#define EXTERN	extern
#endif
EXTERN   void	WriteReport(int, char **);

#ifndef MODULE
EXTERN_C void	ShutDown(int);
#else
EXTERN_C int	ShutDown(int);
#endif

/*==========================================================================*/
#endif /* EBTSTOP_H */


<|start_filename|>docs/DEBtool.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>DEBtool</TITLE>

  <META 
    NAME ="keywords" CONTENT="DEBtool, Dynamic Energy Budget theory, Dynamic Energy Budgets, DEB theory, DEB theorie, DEB" >
  <META 
    NAME="description" CONTENT="Software package DEBtool">
  <META NAME="distribution" CONTENT="global">
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>
  software package DEBtool
  <a href="https://youtu.be/pwxZWx8WTpQ" target="_blank"><img src="https://www.bio.vu.nl/thb/deb/deblab/add_my_pet/img/YouTube.png"  height = "50px" align="right" title="10:22"></a>
</H1>

<P ALIGN="center"> by <A HREF="mailto:<EMAIL>"><NAME></A>,
16 Feb 2021

<H2><A HREF="index_contents.html" TARGET="_top"> Contents</A></H2>


<H2><A NAME="Purpose">Purpose</A></H2> 
 
  DEBtool is a software package written in Matlab (version DEBtool_M) and  Octave (version DEBtool_O, which is no longer maintained) and 
    that can be used to illustrate some implications of the <A HREF="http://www.bio.vu.nl/thb/deb/" TARGET="_top">Dynamic Energy Budget theory</A> and 
    to apply this theory in the analysis of eco-physiological data.
  The manual and the code follow the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010_n.pdf" TARGET="_top">DEB notation</A>.
  It has script-files for almost all figures of the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010.html" TARGET="_top">
  DEB book</A>, with many references to the formulae in the book, and explaining remarks.
  <a href="https://add-my-pet.github.io/AmPtool/docs/index.html" TARGET="_top">AmPtool</a>, as used to support the
  <a href="http://www.bio.vu.nl/thb/deb/deblab/add_my_pet/index.html" TARGET="_top">Add-my-Pet (AmP)</a> collection is an example of application of DEBtool.
  DEBtool has a function <a href="https://www.bio.vu.nl/thb/deb/deblab/add_my_pet/AmPeps.html" TARGET="_top">AmPeps</a> to produce Matlab source files for AmP entries, 
    and a library of routines for the (point and interval) estimation of parameter values of 10 related DEB model from entry source files.
  <BR> 
  Although DEBtool continues to expand, many implications of DEB theory will remain beyond the capacities of this package.

  <P>
  DEBtool and AmPtool are freely available via GitHub, see the <A HREF="/thb/deb/deblab/" TARGET="_top">DEB laboratory</A>.

  <P>
  This release focuses on

  <UL>
    <LI> relationships between variables, as modified by parameter values </LI>
    <LI> extracting parameter values from data and testing model predictions </LI>
  </UL>
  
<H2><A NAME="Maintenance"> Maintenance & updates</A></H2>

  New versions of any function are only indicated by the creation date and/or modification dates in the file headers. 
  The changes are visible in GitHub.

<H2><A NAME="Local_manual"> Local manual</A></H2>

  The manual for DEBtool is included in the package in subdirectory DEBtool_M/docs and is written in HTML. 
  To read it, run a browser on file <code>index.html</code>.

<H2><A NAME="Use"> Use and recommendations</A></H2>

<H4>Basic-level use</H4>

  Octave and Matlab have a very similar syntax, but <a href="first_oct_matl.html">small differences do exist</a>.
  The first steps in Octave are explained in separate <A HREF="index_first.html" TARGET="_top"> notes </A>.
  A useful short introduction to Matlab is: 
  <NAME>. 2000 <i>Basics of Matlab and Beyond</i>, Chapman & Hall/CRC, 202 pp.
  A full manual of Octave is:
  <NAME>., <NAME>. and <NAME>. 2008 
  <i>GNU Octave Manual, Version 3</i>, Network Theory Limited, 555 pp.
  <a href="http://www.gnu.org/software/octave/doc/interpreter/" TARGET="_top">An electronic manual is on the web.</a>

<H4>Don't work in DEBtool, but set a path to it</H4>

  It is best to work in the subdirectory that has your own data and routines, and make a path to DEBtool.
  If you have this just besides DEBtool you set the path to DEBtool and all its subdirectories by <code>addpath(genpath('../DEBtool_O/'))</code> in Octave or in the menu-bar in Matlab.
  Use <code>pwd</code> under Octave or Matlab for getting the current prosition in to directory-tree, and <code>ls</code> for the list of files in the current directory.
  Use <code>cd</code> for changing directories, where <code>..</code> means the parent-directory. 
  Example if you are in a sister-directory of DEBtool_M: <code>cd ../DEBtool_M/animal/</code> will bring you to toolbox animal.

  <P>
  The routines in each subdirectory can call other routines from that subdirectory, or from the library DEBtool/lib, which has three subdirectories. 

<H4>Erase variables</H4>

  Do not forget to type <CODE>clear all</CODE> after switching toolboxes.  
  No error messages are given if you do it otherwise, but the effect is not what you want it to be. 
  So if you are in <code>alga</code> and type <CODE>cd ../plant</CODE>, continue with <CODE>clear all; plant</CODE>, for instance.

  <P>
  The plot ranges of DEBtools' plotting routines are set without notice, when you use the routines for the first time. 
  Clear them by either use <code>clear</code>, or the 'default' option in the <code>*_option</code> routines. 
  See under the manual under <code>library</code>.

<H4>Recalculate optimisation results from different start values</H4>

  Always remember that optimization results contain local extremes at best, and that a local extreme might differ from the global extreme. 
  Try different starting values, and check the results by making plots. 
  See instructions under <a href="DEBtool_lib_regr.html#nrregr"><code>DEBtool/lib/nrregr</code></a>.

<H4><A NAME="Nomenclature"> Nomenclature </A></H4>

  <UL>

    <LI> <B>mydata_*.m</B> The practical application of many DEBtool functions is illustrated with mydata-files, i.e. script files with the name mydata_filename.m. 
    This information is supplementary to that in this manual. You can change these files according to your own needs. </LI>
    <LI> <B>sh*.m</B> Routines that produce and show plots are called shfilename.m files. </LI>
    <LI> <B>d*.m</B> Routines that specify differential equations are called d*.m; they are frequently subroutines of *. </LI> 
    <LI> <B>pars_*.m</B> Parameter values that are use in de demo's are specified in pars.m files; 
         the <A HREF="http://www.bio.vu.nl/thb/research/bib/Kooy2010_n.html"> notation</A> follows the DEB-book, and explanations are given in the file. 
         A demo is a script-file with a name equal to its toolbox (i.e. directory).
  </UL>

<H2><A NAME="Logo"> Logo</A></H2>

  The logo, designed by <NAME>, represents a three-dimensional object, such that the projections in three directions give the symbols A, M and G. 
  These symbols stand for the three basic energy fluxes Assimilation, Maintenance and Growth, which together organize all mass fluxes. 
  Later in the development of the DEB theory, maintenance was replaced by dissipation to include development and other dissipating fluxes.

<HR>
<P>
Go to the <A HREF="/thb/deb/" TARGET="_top"> DEB information page</A> or the <A HREF="/thb/deb/deblab/" TARGET="_top"> DEB laboratory</A>

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/ebttune.h<|end_filename|>
/***
   NAME
     ebttune
   PURPOSE
     Include file to tailor the EBT to the current system
   NOTES
     
   HISTORY
     AMdR - Feb 25, 1998 : Created.
     AMdR - Nov 15, 2015 : Last revision.

     Explicit support include for

				__linux__
				MS Windows (WIN64 || _WIN64 || __WIN64__ || WIN32 || _WIN32 || __WIN32__ || __NT__)

     See the sections for these systems at the bottom of the file. 
***/

#ifndef EBTTUNE_H
#define EBTTUNE_H

/*
 * _GNU_SOURCE determines whether to use the GNU extensions to the C language.
 *
 * Default: yes, if __GNUC__ is defined, otherwise no.
 *
 */
#ifndef _GNU_SOURCE
#if defined(__GNUC__)
#define _GNU_SOURCE
#endif
#endif


/*
 * HAS_FLOAT_H determines whether the include file "float.h" is present 
 * on this system. Usually present when using gcc.
 *
 * Default: yes, if using gcc, otherwise no.
 *
 */
#ifndef HAS_FLOAT_H
#if defined(__GNUC__)
#define HAS_FLOAT_H		1
#else
#define HAS_FLOAT_H		0
#endif
#endif

/*
 * HAS_SIGNALS determines whether signal handling is fully functional
 * on this system. Usually present when using an ANSI C compiler.
 *
 * Default: yes, if using an ANSI C compiler.
 *
 */
#ifndef HAS_SIGNALS
#define HAS_SIGNALS		1
#endif

/*
 * HAS_MALLINFO determines whether the mallinfo structure is available
 * on this system.
 *
 * Default: no, unless Linux is the operating system
 *
 */
#ifndef HAS_MALLINFO
#define HAS_MALLINFO	0
#endif
/*
 * To avoid name mangling of exported function when compiling with a C++ 
 * compiler:
 */
#if defined(__cplusplus)
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif

/*
 * The following settings are valid for a Linux system using 
 * the gcc compiler.
 */
#if defined(__linux__)
#undef  HAS_FLOAT_H
#define HAS_FLOAT_H		1
#undef  HAS_SIGNALS
#define HAS_SIGNALS		1
typedef 			void (*sighandler)(int);     
#undef  HAS_MALLINFO
#define HAS_MALLINFO		1
/*
 * The following settings are supposed to be valid for MS Windows systems
 */
#elif defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
#undef  HAS_FLOAT_H
#define HAS_FLOAT_H		1
#undef  HAS_SIGNALS
#define HAS_SIGNALS		1
#define LIMITED_SIGNALS		1
#undef  EXPORTING
#define EXPORTING   __declspec(dllexport)
#undef EXTERN_C
#if defined(__cplusplus)
#define EXTERN_C extern "C" __declspec(dllexport)
#define NOMINMAX		1
#else
#define EXTERN_C extern __declspec(dllexport)
#endif

// When using MSVC disable the warning about the unsafe functions like sprinf(), sscanf(), etc.
#if defined(_MSC_VER)
#define _CRT_SECURE_NO_DEPRECATE
#define _SCL_SECURE_NO_DEPRECATE
#endif

#endif	/* different os's */

#endif /* EBTTUNE_H */


<|start_filename|>animal/html/mydata_get_pars_9.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_get_pars_9</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="mydata_get_pars_9.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><pre class="codeinput"><span class="comment">% created 2013/07/08 by <NAME>; modified 2013/09/26</span>
<span class="comment">% runs get_pars_9 and its inverse iget_pars_9</span>
<span class="comment">% consider increase of numerical accuracy in the case of large relative errors</span>

<span class="comment">% set parameters according to generalised animal (see mydata_my_pet, but kap_G = 0.8)</span>
<span class="comment">%  assume T = T_ref; f = 1</span>
d_V = 0.1;           <span class="comment">% g/cm^3, specific density of structure</span>
z = 10;              <span class="comment">%  -, zoom factor</span>
v = 0.02;            <span class="comment">% 2 cm/d, energy conductance</span>
kap = 0.8;           <span class="comment">% 3 -, allocation fraction to soma = growth + somatic maintenance</span>
p_M = 18;            <span class="comment">% 4 J/d.cm^3, [p_M], vol-specific somatic maintenance</span>
p_Am = z * p_M/ kap; <span class="comment">% 1 J/d.cm^2, max specific assimilation rate</span>
E_G = 2.6151e4 * d_V;<span class="comment">% 5 J/cm^3, [E_G], spec cost for structure</span>
E_Hb = z^3 * .275;   <span class="comment">% 6 J, E_H^b, maturity at birth</span>
E_Hj = 10 * E_Hb;    <span class="comment">% 7 J, E_H^j, maturity at metamorphosis</span>
E_Hp = z^3 * 50;     <span class="comment">% 8 J, E_H^p, maturity at puberty</span>
h_a = 1e-6;          <span class="comment">% 9 1/d^2, Weibull aging acceleration</span>

<span class="comment">% pack par</span>
par = [p_Am; v; kap; p_M; E_G; E_Hb; E_Hj; E_Hp; h_a];

<span class="comment">% run iget_pars_9 and get_pars_9</span>
data = iget_pars_9(par);   <span class="comment">% map par to data</span>
Epar = get_pars_9(data);   <span class="comment">% map data to par</span>
Edata = iget_pars_9(Epar); <span class="comment">% map par to data</span>

txt_par = { <span class="keyword">...</span>
 <span class="string">'1 p_Am, J/d.cm^2, max specific assimilation rate'</span>;
 <span class="string">'2 v, cm/d, energy conductance'</span>;
 <span class="string">'3 kap, -, allocation fraction to soma'</span>;
 <span class="string">'4 p_M, J/d.cm^3, [p_M], vol-specific somatic maintenance'</span>;
 <span class="string">'5 E_G, J/cm^3, [E_G], spec cost for structure'</span>;
 <span class="string">'6 E_Hb, J, E_H^b, maturity at birth'</span>;
 <span class="string">'7 E_Hj, J, E_H^j, maturity at metamorphosis'</span>;
 <span class="string">'8 E_Hp, J, E_H^p, maturity at puberty'</span>;
 <span class="string">'9 h_a, 1/d^2, Weibull aging acceleration'</span>};

txt_data = { <span class="keyword">...</span>
 <span class="string">'1 d_V, g/cm^3, specific density of structure'</span>;
 <span class="string">'2 a_b, d, age at birth'</span>;
 <span class="string">'3 a_p, d, age at puberty'</span>;
 <span class="string">'4 a_m, d, age at death due to ageing'</span>;
 <span class="string">'5 W_b, g, wet weight at birth'</span>;
 <span class="string">'6 W_j, g, wet weight at metamorphosis'</span>;
 <span class="string">'7 W_p, g, wet weight at puberty'</span>;
 <span class="string">'8 W_m, g, maximum wet weight'</span>;
 <span class="string">'9 R_m, #/d, maximum reproduction rate'</span>};

printpar(txt_par, par, Epar, <span class="string">'name, pars, back-estimated pars'</span>)
fprintf(<span class="string">'\n'</span>); <span class="comment">% insert blank line</span>
printpar(txt_data, data, Edata, <span class="string">'name, data, back-estimated data'</span>)

MRE_par = sum(abs(par - Epar) ./ par)/9;
MRE_data = sum(abs(data - Edata) ./ data)/9;
fprintf(<span class="string">'\n'</span>); <span class="comment">% insert blank line</span>
printpar({<span class="string">'mean relative error of par and data'</span>}, MRE_par, MRE_data, <span class="string">''</span>)
</pre><pre class="codeoutput">name, pars, back-estimated pars 
1 p_Am, J/d.cm^2, max specific assimilation rate      225      225 
2 v, cm/d, energy conductance     0.02     0.02 
3 kap, -, allocation fraction to soma      0.8      0.8 
4 p_M, J/d.cm^3, [p_M], vol-specific somatic maintenance       18       18 
5 E_G, J/cm^3, [E_G], spec cost for structure     2615     2615 
6 E_Hb, J, E_H^b, maturity at birth      275      275 
7 E_Hj, J, E_H^j, maturity at metamorphosis     2750     2750 
8 E_Hp, J, E_H^p, maturity at puberty    5e+04 5.001e+04 
9 h_a, 1/d^2, Weibull aging acceleration    1e-06 9.995e-07 

name, data, back-estimated data 
1 d_V, g/cm^3, specific density of structure      0.1      0.1 
2 a_b, d, age at birth    115.8    115.8 
3 a_p, d, age at puberty    464.1    464.1 
4 a_m, d, age at death due to ageing     1288     1288 
5 W_b, g, wet weight at birth    2.156    2.156 
6 W_j, g, wet weight at metamorphosis    20.39     20.4 
7 W_p, g, wet weight at puberty      316    316.1 
8 W_m, g, maximum wet weight 5.57e+04 5.571e+04 
9 R_m, #/d, maximum reproduction rate     7.23    7.231 

 
mean relative error of par and data 0.0001039 0.0001122 
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
% created 2013/07/08 by <NAME>; modified 2013/09/26
% runs get_pars_9 and its inverse iget_pars_9
% consider increase of numerical accuracy in the case of large relative errors

% set parameters according to generalised animal (see mydata_my_pet, but kap_G = 0.8)
%  assume T = T_ref; f = 1
d_V = 0.1;           % g/cm^3, specific density of structure
z = 10;              %  -, zoom factor
v = 0.02;            % 2 cm/d, energy conductance
kap = 0.8;           % 3 -, allocation fraction to soma = growth + somatic maintenance
p_M = 18;            % 4 J/d.cm^3, [p_M], vol-specific somatic maintenance
p_Am = z * p_M/ kap; % 1 J/d.cm^2, max specific assimilation rate
E_G = 2.6151e4 * d_V;% 5 J/cm^3, [E_G], spec cost for structure
E_Hb = z^3 * .275;   % 6 J, E_H^b, maturity at birth
E_Hj = 10 * E_Hb;    % 7 J, E_H^j, maturity at metamorphosis
E_Hp = z^3 * 50;     % 8 J, E_H^p, maturity at puberty
h_a = 1e-6;          % 9 1/d^2, Weibull aging acceleration

% pack par
par = [p_Am; v; kap; p_M; E_G; E_Hb; E_Hj; E_Hp; h_a];

% run iget_pars_9 and get_pars_9
data = iget_pars_9(par);   % map par to data
Epar = get_pars_9(data);   % map data to par
Edata = iget_pars_9(Epar); % map par to data

txt_par = { ...
 '1 p_Am, J/d.cm^2, max specific assimilation rate';
 '2 v, cm/d, energy conductance';
 '3 kap, -, allocation fraction to soma';
 '4 p_M, J/d.cm^3, [p_M], vol-specific somatic maintenance';
 '5 E_G, J/cm^3, [E_G], spec cost for structure';
 '6 E_Hb, J, E_H^b, maturity at birth';
 '7 E_Hj, J, E_H^j, maturity at metamorphosis';
 '8 E_Hp, J, E_H^p, maturity at puberty';
 '9 h_a, 1/d^2, Weibull aging acceleration'};

txt_data = { ...
 '1 d_V, g/cm^3, specific density of structure';
 '2 a_b, d, age at birth';
 '3 a_p, d, age at puberty';
 '4 a_m, d, age at death due to ageing';
 '5 W_b, g, wet weight at birth';
 '6 W_j, g, wet weight at metamorphosis';
 '7 W_p, g, wet weight at puberty';
 '8 W_m, g, maximum wet weight';
 '9 R_m, #/d, maximum reproduction rate'};
   
printpar(txt_par, par, Epar, 'name, pars, back-estimated pars')
fprintf('\n'); % insert blank line
printpar(txt_data, data, Edata, 'name, data, back-estimated data')

MRE_par = sum(abs(par - Epar) ./ par)/9;
MRE_data = sum(abs(data - Edata) ./ data)/9;
fprintf('\n'); % insert blank line
printpar({'mean relative error of par and data'}, MRE_par, MRE_data, '')

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebtinit.c<|end_filename|>
/***
   NAME
     ebtinit.c
   PURPOSE
     This file contains the Initialize() routine and all functions that are
     used by it to initialize global variables, to read the input file with
     the initial state values of the environment and the populations and to
     read the control variable file. 
   NOTES
     
   HISTORY
     AMdR - Jul 21, 1995 : Created.
     AMdR - Dec 27, 2012 : Revised last.
***/

#define	EBTINIT_C				/* Identification of file   */
#define	EBTLIB					/* and file grouping	    */

#include "escbox.h"				/* Include general header   */
#include "ebtinit.h"
#include "ebtmain.h"
#include "ebtcohrt.h"
#include "ebtutils.h"

/* <NAME> 2020/04/02 */
#include "ebttint.h"

/*==========================================================================*/
/*
 * Defining all constants that are local to this specific file.
 */
						/* The maximum length of    */
#define	  MAX_INPUT_LINE 2048			/* a line of input	    */




/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define DBG  "Unable to open DBG file for event location information!"
#define CVF  "Unable to open CVF file with control variables for program!"
#define EACC "Error during input of accuracy value from CVF file!"
#define EATL "Error during input of absolute tolerances from the CVF file!"
#define EBIF "Error during input of bifurcation control variables from the CVF file!"
#define ECL  "Error during input of cohort time limit from CVF file!"
#define ECSO "Error during reading of state output interval from CVF file!"
#define ECVF "Unexpected end/error while reading CVF file!"
#define EENV "Unexpected end/error while reading environment from ISF file!"
#define EISF "Unexpected end/error while reading populations from ISF file!"
#define EIZ  "Error during input of zero comparison value from CVF file!"
#define EMIN "Error during input of the cohort minima from the CVF file!"
#define EMT  "Error during input of maximum integration time from CVF file!"
#define EOUT "Error during reading of output time interval from CVF file!"
#define ERTL "Error during input of relative tolerances from the CVF file!"
#define FISF "ESF file not found for resuming; Using ISF file instead!"
#define ICS  "Incomplete cohort specification(s) encountered in ISF file!"
#define ISF  "Unable to open ISF file! Expecting initialization in UserInit()!"
#define MAFC "Memory allocation failure for cohort variables!"
#define MAFI "Memory allocation failure for cohort constants!"
#define NEA  "Not enough arguments : Usage '<program name> <run name>'"
#define OUT  "Failure in opening OUT file for writing!"
#define RETS "Relative accuracy required too small. Use accuracy > 1.0E-12!"
#define WNEV "Incomplete environment specification encountered in ISF file! Expecting initialization in UserInit()!"


/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==========================================================================*/

static char	*ReadDouble(double *val, char *cpnt)

  /* 
   * ReadDouble - Routine reads a double value from the string pointed to
   *		  by "cpnt". Invalid characters are skipped. It returns a 
   *		  pointer to the rest of the string or NULL on error.
   */

{
  register char		*ch, *end=NULL;
  int			dot_start=0;

  ch=cpnt; while((!isdigit(*ch)) && *ch) ch++;	/* Skip non digits          */
  if(isdigit(*ch))
    {
      end=ch;
      if((ch!=cpnt) && (*(ch-1)=='.'))		/* Is previous a dot?	    */
	{
	  ch--; dot_start=1;
	}
      if((ch!=cpnt) && (*(ch-1)=='-')) ch--;	/* Is previous a minus?	    */

      while(isdigit(*end)) end++;		/* Skip digits		    */
      if((!dot_start) && (*end=='.'))		/* Dot starts mantissa	    */
	{
	  end++; while(isdigit(*end)) end++;
	}

      if((*end=='e') || (*end=='E'))		/* Possible exponent        */
	{
	  end++; if((*end=='+') || (*end=='-')) end++;
	  while(isdigit(*end)) end++;
	}
      *val = 0.0;
      (void)sscanf(ch, "%lg", val);
    }

  return end;
}



/*==========================================================================*/

static int	ScanLineDouble(FILE *infile, char *descr, double *value, int var_nr)

  /* 
   * ScanLineDouble - Routine reads one line from the control variable file, 
   *		      splits it up in the description and the value part and 
   *		      returns the number of values read. "var_nr" is the number
   *		      of variables to be read.
   */

{
  register char		*ch=NULL, *dsp;
  char			input[MAX_INPUT_LINE], tmp_str[MAX_INPUT_LINE];
  int			read_no=0, desclen = 0;

  // Input a single line. Skip empty lines and lines starting with a hatch (#) sign
  while((!feof(infile)) && (!ferror(infile)) && (!ch))
    {
      if ((ch=fgets(input, MAX_INPUT_LINE, infile)))
	{
	  while(*ch==' ') ch++;
	  if ((*ch == '#') || (*ch == '\n')) ch=NULL;
	}
    }
  if(feof(infile) || ferror(infile)) ErrorAbort(ECVF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return read_no;
#endif

  dsp=descr;
  if(*ch == '"')				/* Comment is in quotes	    */
    {
      ch++;					/* Skip the first quote	    */
      while(*ch != '"')				/* Search for the closing   */
	{					/* quotes, storing string   */
	  if(desclen<DESCRIP_MAX) (*dsp)=(*ch); /* between them		    */
	  dsp++; ch++; desclen++;
	}
      ch++;					/* Skip closing quotes	    */
    }
  else						/* Comment is not quoted    */
    {
      while((!isdigit(*ch)) && *ch)		/* Skip non-digits and put  */
	{					/* them in description	    */
	  if(desclen<DESCRIP_MAX) (*dsp)=(*ch);
	  dsp++; ch++; desclen++;
	}					/* Remove trailing blanks   */
						/* and tabs                 */
      while((*(dsp-1)==' ') || (*(dsp-1)=='\t')) *(--dsp)='\0';
    }
  descr[DESCRIP_MAX-1] = '\0';

  ch=strcpy(tmp_str, ch);			/* Copy rest to string      */

  while(ch)
      if((ch=ReadDouble(value+read_no, ch)) != NULL)
	  if((++read_no)==var_nr) return read_no;

  return read_no;
}



/*==========================================================================*/
#if (BIFURCATION == 1)

static char	*ReadInt(int *val, char *cpnt)

  /* 
   * ReadInt - Routine reads an integer value from the string pointed to
   *	       by "cpnt". Invalid characters are skipped. It returns a 
   *	       pointer to the rest of the string or NULL on error.
   */

{
  register char		*ch, *end=NULL;

  ch=cpnt; while((!isdigit(*ch)) && *ch) ch++;	/* Skip non digits          */

  if(isdigit(*ch))
    {
      end=ch;

      // Locate all consecutive digits
      while(isdigit(*end)) end++;

      // Turn into integer value
      *val = 0;
      (void)sscanf(ch, "%d", val);
    }

  return end;
}



/*==========================================================================*/

static int	ScanLineInt(FILE *infile, char *descr, int *value, int var_nr)

  /* 
   * ScanLineInt - Routine reads one line from the control variable file, 
   *		   splits it up in the description and the value part and 
   *		   returns the number of values read. "var_nr" is the number
   *		   of variables to be read.
   */

{
  register char		*ch=NULL, *dsp;
  char			input[MAX_INPUT_LINE], tmp_str[MAX_INPUT_LINE];
  int			read_no=0, desclen = 0;
						/* Input line		    */
  dsp=descr;					/* Skip empty lines	    */
  while((!feof(infile)) && (!ferror(infile)) && (!ch))
    {
      if ((ch=fgets(input, MAX_INPUT_LINE, infile)))
	{
	  while(*ch==' ') ch++;
	  if(*ch == '\n') ch=NULL;
	}
    }
  if(feof(infile) || ferror(infile)) ErrorAbort(ECVF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return read_no;
#endif

  if(*ch == '"')				/* Comment is in quotes	    */
    {
      ch++;					/* Skip the first quote	    */
      while(*ch != '"')				/* Search for the closing   */
	{					/* quotes, storing string   */
	  if(desclen<DESCRIP_MAX) (*dsp)=(*ch); /* between them		    */
	  dsp++; ch++; desclen++;
	}
      ch++;					/* Skip closing quotes	    */
    }
  else						/* Comment is not quoted    */
    {
      while((!isdigit(*ch)) && *ch)		/* Skip non-digits and put  */
	{					/* them in description	    */
	  if(desclen<DESCRIP_MAX) (*dsp)=(*ch);
	  dsp++; ch++; desclen++;
	}					/* Remove trailing blanks   */
						/* and tabs                 */
      while((*(dsp-1)==' ') || (*(dsp-1)=='\t')) *(--dsp)='\0';
    }
  descr[DESCRIP_MAX-1] = '\0';

  ch=strcpy(tmp_str, ch);			/* Copy rest to string      */

  while(ch)
    if((ch=ReadInt(value+read_no, ch)) != NULL)
      if((++read_no)==var_nr) return read_no;

  return read_no;
}
#endif // (BIFURCATION == 1)



/*==========================================================================*/

static void	  InitVars()

  /* 
   * InitVars - Routine initializes all global variables to 0.
   */

{
  register int		i;

  step_size=DEFAULT_STEP;
  usernotes = NULL;

  for(i=0; i<ENVIRON_DIM; i++) env[i] = 0.0;	/* Create zero environment   */

  initState = NULL;
  currentState = NULL;
  for (i=0; i<MAXDERS; i++) currentDers[i] = NULL;
  ForcedRunEnd = 0;

#if (POPULATION_NR > 0)
  for(i=0; i<POPULATION_NR; i++)
    {
      CohortNo[i]=0;
      BpointNo[i]=0;
      tol_zero[i]= ((I_STATE_DIM > 0) ? 0:1);
      pop_extinct[i]=0;
      pop[i] = NULL;
      DataMemAllocated[i] = 0;
#if (I_CONST_DIM > 0)
      popIDcard[i]	= NULL;
      IDMemAllocated[i] = 0;
#endif

      strcpy(statelabels[i], "");		/* Create empty state labels */
    }
#endif // (POPULATION_NR > 0)

  return;
}



/*==========================================================================*/

static void	  ReadCvf(FILE *infile)

  /* 
   * ReadCvf - Routine reads all the values of the control variables from 
   *	       the already opened .cvf file.
   */

{
  register int		i;
  char			msg[MAX_INPUT_LINE];
  int			read_no;

  read_no=ScanLineDouble(infile, description.accuracy, &accuracy, 1);
  if(read_no != 1) ErrorAbort(EACC);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  if(accuracy < MIN_ACCURACY) ErrorAbort(RETS);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  read_no=ScanLineDouble(infile, description.cohort_limit, &cohort_limit, 1);
  if(read_no != 1) ErrorAbort(ECL);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  read_no=ScanLineDouble(infile, description.identical_zero, &identical_zero, 1);
  if(read_no != 1) ErrorAbort(EIZ);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  equal2zero = identical_zero;

  read_no=ScanLineDouble(infile, description.max_time, &max_time, 1);
  if(read_no != 1) ErrorAbort(EMT);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  read_no=ScanLineDouble(infile, description.delt_out, &delt_out, 1);
  if(read_no != 1) ErrorAbort(EOUT);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

#if (POPULATION_NR > 0)
  register int		j;
  double		tmp[POPULATION_NR];

  read_no=ScanLineDouble(infile, description.state_out, &state_out, 1);
  if(read_no != 1) ErrorAbort(ECSO);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

  read_no=ScanLineDouble(infile, description.abs_tols[0], tmp, POPULATION_NR);
  if(read_no != POPULATION_NR) ErrorAbort(EMIN);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  for(i=0; i<POPULATION_NR; i++) abs_tols[i][0] = tmp[i];
  
  for(j=1; j<COHORT_SIZE; j++)
    {
      read_no=ScanLineDouble(infile, description.rel_tols[j], tmp, POPULATION_NR);
      if(read_no != POPULATION_NR) ErrorAbort(ERTL);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
      for(i=0; i<POPULATION_NR; i++) rel_tols[i][j] = tmp[i];
    }
  for(j=1; j<COHORT_SIZE; j++)
    {
      read_no=ScanLineDouble(infile, description.abs_tols[j], tmp, POPULATION_NR);
      if(read_no != POPULATION_NR) ErrorAbort(EATL);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
      for(i=0; i<POPULATION_NR; i++) abs_tols[i][j] = tmp[i];
    }

  for(i=0; i<POPULATION_NR; i++) 
      for(j=1; j<COHORT_SIZE; j++) 
	  tol_zero[i] = (tol_zero[i] ||
			 ((rel_tols[i][j]<=0.0) && (abs_tols[i][j]<=0.0)));
#endif // (POPULATION_NR > 0)

#if PARAMETER_NR
  for(i=0; i<PARAMETER_NR; i++)
    {
      read_no=ScanLineDouble(infile, description.parameter[i], parameter+i, 1);
      if(read_no != 1)
	{
	  (void)sprintf(msg,
			"Error while reading parameter %d from CVF file!",
			i);
	  ErrorAbort(msg);
#ifdef MODULE
	  if (error_code & FATAL_ERROR) return;
#endif
	}
    }
#endif

#if (BIFURCATION == 1)
  read_no=ScanLineInt(infile, description.bifparindex, &BifParIndex, 1);
  if(read_no != 1) ErrorAbort(EBIF);

  if ((BifParIndex < 0) || (BifParIndex > PARAMETER_NR)) ErrorAbort(EBIF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

  read_no=ScanLineDouble(infile, description.bifparstep, &BifParStep, 1);
  if(read_no != 1) ErrorAbort(EBIF);

  // Sanitize the bifurcation control variable: Make it absolute
  BifParStep = fabs(BifParStep);
  if (BifParStep < SMALLEST_STEP) ErrorAbort(EBIF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

  read_no=ScanLineDouble(infile, description.bifparlastval, &BifParLastVal, 1);
  if(read_no != 1) ErrorAbort(EBIF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

  read_no=ScanLineInt(infile, description.bifparlogstep, &BifParLogStep, 1);
  if(read_no != 1) ErrorAbort(EBIF);

  // Sanitize the bifurcation control variable:
  // Check inappropriate values for log scale
  if (BifParLogStep &&
      ((fabs(parameter[BifParIndex]) < SMALLEST_STEP) || (fabs(BifParLastVal) < SMALLEST_STEP) ||
       (parameter[BifParIndex]*BifParLastVal < 0.0))) ErrorAbort(EBIF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  // Set the sign of bifurcation step size
  if (parameter[BifParIndex] > BifParLastVal) BifParStep *= -1;

  read_no=ScanLineDouble(infile, description.bifoutput, &BifOutput, 1);
  if(read_no != 1) ErrorAbort(EBIF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
  // Sanitize the bifurcation control variable
  BifOutput = max(BifOutput, 0.0);
  BifOutput = min(BifOutput, max_time);

#if (POPULATION_NR > 0)
  read_no=ScanLineDouble(infile, description.bifstateoutput, &BifStateOutput, 1);
  if(read_no != 1) ErrorAbort(EBIF);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
#endif // (POPULATION_NR > 0)

  // Sanitize the bifurcation control variable
  BifStateOutput = max(BifStateOutput, 0.0);
  BifStateOutput = min(BifStateOutput, max_time);
#endif // (BIFURCATION == 1)

  return;
}



/*==========================================================================*/

static int	ReadInputEnv(FILE *infile)

  /* 
   * ReadInputEnv - Read the initial values of the environment variables 
   *		    from the already opened .isf file.
   */

{
  char			*ch, input[MAX_INPUT_LINE];
  int			read_no;
						/* Number of variables	    */
  read_no=0;					/* already read into array  */
  while((!feof(infile)) && (!ferror(infile)))
    {
      ch=fgets(input, MAX_INPUT_LINE, infile);	/* Input line		    */

						/* Read double from string, */
      while(ch)					/* stop on line end	    */
	  if((ch=ReadDouble(env+read_no, ch)) != NULL)
	      if((++read_no)==ENVIRON_DIM) return read_no;
    }						/* Stop loop if array	    */
						/* contains enough  data    */

  if(feof(infile) || ferror(infile)) Warning(EENV);

  return read_no;
}




/*==========================================================================*/
#if (POPULATION_NR > 0)

static void	  ReadInputPop(FILE *infile)

  /* 
   * ReadInputPop - Routine reads the initial values for the state of all 
   *		    populations from the already opened .isf file.
   */

{
  register int		i, j;
  char			*ch, input[MAX_INPUT_LINE];
  int			done, read_no, warnics = 1;
  double		val_tmp[COHORT_SIZE+I_CONST_DIM];
  long			mem_req;

  for(i=0; i<POPULATION_NR; i++)
    {						/* Flag indicating end of   */
      done=0;					/* population data	    */
      while((!feof(infile)) && (!ferror(infile)) && (!done))
	{					/* Input line		    */
	  ch=fgets(input, MAX_INPUT_LINE, infile);
						/* Initialize all data to   */
						/* default: MISSING_VALUE   */
	  for(j=0; j<(COHORT_SIZE+I_CONST_DIM); j++)
	    val_tmp[j] = MISSING_VALUE;
						/* Read complete cohort	    */
						/* from one line. Stop on   */
						/* line end or full cohort  */
	  for(j=0, read_no=0; (j<(COHORT_SIZE+I_CONST_DIM)) && (ch); j++)
	      if((ch=ReadDouble(val_tmp+j, ch)) != NULL) read_no++;
						/* End of population reached*/
          if ((read_no == 0) && CohortNo[i]) done = 1;
	  else if (read_no > 0)			/* Store cohort read        */
	    {
						/* Warn of incomplete cohort*/
	      if ((read_no != (COHORT_SIZE+I_CONST_DIM)) && warnics)
		{
		  Warning(ICS);
		  warnics =0;
		}
	      mem_req = (CohortNo[i]+1)*COHORT_SIZE;
	      if (!(mem_req < DataMemAllocated[i]))
		{
		  DataMemAllocated[i] = MemBlocks(mem_req);
		  pop[i] =
		      (population)Myalloc((void *)pop[i],
					  (size_t)DataMemAllocated[i],
					  sizeof(double));
		  if(!(pop[i])) ErrorAbort(MAFC);
#ifdef MODULE
		  if (error_code & FATAL_ERROR) return;
#endif
		}
#if (I_CONST_DIM > 0)
	      mem_req = (CohortNo[i]+1)*I_CONST_DIM;
	      if (!(mem_req < IDMemAllocated[i]))
		{
		  IDMemAllocated[i] = MemBlocks(mem_req);
		  popIDcard[i] =
		      (popID)Myalloc((void *)popIDcard[i],
				     (size_t)IDMemAllocated[i],
				     sizeof(double));
		  if(!(popIDcard[i])) ErrorAbort(MAFI);
#ifdef MODULE
		  if (error_code & FATAL_ERROR) return;
#endif
		}
#endif
	      if (CohortNo[i])
		  CohortNo[i] = InsCohort(val_tmp,
#if (I_CONST_DIM > 0)
					  val_tmp+COHORT_SIZE,
#endif
					  i);
	      else
		{
		  for (j=0; j<COHORT_SIZE; j++)
		      pop[i][CohortNo[i]][j] = val_tmp[j]; 
#if (I_CONST_DIM > 0)
		  for (j=0; j<I_CONST_DIM; j++)
		      popIDcard[i][CohortNo[i]][j] = val_tmp[j+COHORT_SIZE]; 
#endif
		  CohortNo[i]++;
		}
	    }
	}
      if(ferror(infile) || (feof(infile) && !CohortNo[POPULATION_NR-1]))
	  Warning(EISF);			/* On read error exit	    */
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
    }

  for(i=0; i<POPULATION_NR; i++)
    {
      (void)sprintf(input, "Initial population %d is empty! %s",
		    i, "Expecting initialization in UserInit()!");
      if(!CohortNo[i]) Warning(input);
      cohort_no[i] = CohortNo[i];
    }

  return;
}

#endif // (POPULATION_NR > 0)


/*==========================================================================*/

void	  Initialize(int argc, char **argv)

  /* 
   * Initialize - Routine initializes the global variables, reads the 
   *		  constants from the .cvf file and the initial state from
   *		  the .isf file and takes care of the output at start up.
   */

{
  char			filename[MAXFILENAMELEN], *ch;
  FILE			*isf, *cvf;

  InitVars();
  if (argc < 2) ErrorAbort(NEA);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif

  ch=strcpy(progname, argv[0]);			/* Store name of  program   */

  ch=strcpy(runname, argv[1]);			/* Store name of the run    */
  while((*ch!='\0')) ch++;
  *ch='.'; ch++; *ch='\0';
						/* Open CVF file with	    */
						/* lower case extension	    */
  ch=strcpy(filename, runname); ch=strcat(filename, "cvf");
  cvf=fopen(filename, "r");

  if(!cvf)					/* On error try upper casee */
    {
      ch=strcpy(filename, runname); ch=strcat(filename, "CVF");
      cvf=fopen(filename, "r");
      if(!cvf) ErrorAbort(CVF);			/* On repeated error exit   */
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
    }
  ReadCvf(cvf); (void)fclose(cvf);
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif
						/* Open ISF file with	    */
						/* lower case extension	    */
  ch=strcpy(filename, runname);			/* or ESF file if resuming  */
  if (Resume) ch=strcat(filename, "esf");
  else ch=strcat(filename, "isf");
  isf=fopen(filename, "r");
  if(!isf)					/* On error try upper case  */
    {
      ch=strcpy(filename, runname);
      if (Resume) ch=strcat(filename, "ESF");
      else ch=strcat(filename, "ISF");
      isf=fopen(filename, "r");
    }
  if (Resume && !isf)				/* ESF not found: restart   */
    {
      Warning(FISF);
      ch=strcpy(filename, runname);
      ch=strcat(filename, "isf");
      isf=fopen(filename, "r");
      if(!isf)					/* On error try upper case  */
	{
	  ch=strcpy(filename, runname);
	  ch=strcat(filename, "ISF");
	  isf=fopen(filename, "r");
	}
    }
  if(isf)					/* Read initial state	    */
    {						/* of environment	    */
      if(ReadInputEnv(isf) != ENVIRON_DIM) Warning(WNEV);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif

#if (POPULATION_NR > 0)
      ReadInputPop(isf);			/* Read initial state	    */
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
#endif // (POPULATION_NR > 0)

      (void)fclose(isf);
    }
#ifndef MODULE					/* Expect initial state in  */
  else Warning(ISF);				/* UserInit()               */
#endif
						/* Open OUT file with	    */
						/* lower case extension	    */
  ch=strcpy(filename, runname); ch=strcat(filename, "out");
  resfil=fopen(filename, "a");
  if(!resfil)					/* On error try upper case  */
    {
      ch=strcpy(filename, runname); ch=strcat(filename, "OUT");
      resfil=fopen(filename, "a");
      if(!resfil) ErrorAbort(OUT);		/* On repeated error exit   */
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif
    }

  if (debug_level)				/* Open DBG file with	  */
    {						/* lower case extension	  */
      (void)strcpy(filename, runname); (void)strcat(filename, "dbg");
      dbgfil=fopen(filename, "a");
      if(!dbgfil)				/* On error try upper case  */
	{
	  (void)strcpy(filename, runname); (void)strcat(filename, "DBG");
	  dbgfil=fopen(filename, "a");
	  if(!dbgfil) Warning(DBG);		/* On repeated error warn   */
	}
    }
  else dbgfil = NULL;

  csbnew = 0;
#if (POPULATION_NR > 0)
  struct stat           st;

  if (!csbfil)
    {						/* Open CSB file	    */
      (void)strcpy(filename, runname); (void)strcat(filename, "csb");
      if ((stat(filename, &st) != 0) || (st.st_size == 0))
	{
	  csbfil=fopen(filename, "wb");		// New CSB file
	  if (csbfil) csbnew = 1;
	}
      else csbfil=fopen(filename, "ab");
      if(!csbfil)				/* On error try upper case  */
	{
	  (void)strcpy(filename, runname); (void)strcat(filename, "CSB");
	  if ((stat(filename, &st) != 0) || (st.st_size == 0))
	    {
	      csbfil=fopen(filename, "wb");	// New CSB file
	      if (csbfil) csbnew = 1;
	    }
	  else csbfil=fopen(filename, "ab");
	}
      if(csbfil) return;
    }
#endif // (POPULATION_NR > 0)
  csbfil=NULL;

  return;
}



/*==========================================================================*/


<|start_filename|>lib/MultiCalib4DEB/examples/Heterobranchus_longifilis_res.html<|end_filename|>
<!DOCTYPE html>
<HTML>
<HEAD>
  <TITLE>Heterobranchus_longifilis</TITLE>
  <style>
    div.prd {
      width: 50%;
      float: left;
    }

    div.par {
      width: 50%;
      float: right;
    }

    p.clear {
      clear: both;
    }

    .head {
      background-color: #FFE7C6
    }

    .psd {
      color: blue
    }

    #prd {
      border-style: solid hidden solid hidden;
    }

    #par {
      border-style: solid hidden solid hidden;
    }

    tr:nth-child(even){background-color: #f2f2f2}
  </style>
</HEAD>

<BODY>

  <div class="prd">
  <h1>Heterobranchus longifilis</h1>
  </div>

  <div class="par">
  <h4>COMPLETE = 2.5; MRE =    0.013; SMSE =    0.016 </h4>
  </div>

  <p class="clear"></p>

  <div class="prd">
  <h2>Data & predictions</h2>
  <TABLE id="prd">
    <TR  class="head"><TH>data</TH> <TH>prd</TH> <TH>RE</TH>  <TH>symbol</TH> <TH>units</TH> <TH>description</TH> </TR>
    <TR><TD>1.25</TD> <TD>1.286</TD> <TD>0.02855</TD> <TD>ab25</TD> <TD>d</TD> <TD>age at birth</TD></TR>
    <TR><TD>0.58</TD> <TD>0.5842</TD> <TD>0.007249</TD> <TD>ab33</TD> <TD>d</TD> <TD>age at birth</TD></TR>
    <TR><TD>4380</TD> <TD>4377</TD> <TD>0.0007768</TD> <TD>am</TD> <TD>d</TD> <TD>life span</TD></TR>
    <TR><TD>150</TD> <TD>150.1</TD> <TD>0.0006471</TD> <TD>Li</TD> <TD>cm</TD> <TD>ultimate total length</TD></TR>
    <TR><TD>0.0014</TD> <TD>0.001381</TD> <TD>0.01386</TD> <TD>Wwb</TD> <TD>g</TD> <TD>wet weight at birth</TD></TR>
    <TR><TD>700</TD> <TD>690.9</TD> <TD>0.013</TD> <TD>Wwp</TD> <TD>g</TD> <TD>wet weight at puberty</TD></TR>
    <TR><TD>5.5e+04</TD> <TD>5.512e+04</TD> <TD>0.002243</TD> <TD>Wwi</TD> <TD>g</TD> <TD>ultimate wet weight</TD></TR>
    <TR><TD>0.077</TD> <TD>0.07699</TD> <TD>8.141e-05</TD> <TD>GSI</TD> <TD>g/g</TD> <TD>gonado somatic index</TD></TR>
    <TR><TD colspan="2">see figure</TD> <TD>0.04713</TD> <TD>tW</TD> <TD colspan="2">time, <font color="blue"><i>vs.</i></font> wet weight</TD>
    <TR class="psd"><TD>0.02</TD> <TD>0.03475</TD> <TD>0.7376</TD> <TD>psd.v</TD> <TD>cm/d</TD> <TD>energy conductance</TD></TR>
    <TR class="psd"><TD>0.8</TD> <TD>0.9551</TD> <TD>0.1939</TD> <TD>psd.kap</TD> <TD>-</TD> <TD>allocation fraction to soma</TD></TR>
    <TR class="psd"><TD>0.95</TD> <TD>0.95</TD> <TD>  0</TD> <TD>psd.kap_R</TD> <TD>-</TD> <TD>reproduction efficiency</TD></TR>
    <TR class="psd"><TD> 18</TD> <TD>1971</TD> <TD>108.5</TD> <TD>psd.p_M</TD> <TD>J/d.cm^3</TD> <TD>vol-spec som maint</TD></TR>
    <TR class="psd"><TD>0.002</TD> <TD>0.002</TD> <TD>  0</TD> <TD>psd.k_J</TD> <TD>1/d</TD> <TD>maturity maint rate coefficient</TD></TR>
    <TR class="psd"><TD>0.8</TD> <TD>0.8002</TD> <TD>0.0002029</TD> <TD>psd.kap_G</TD> <TD>-</TD> <TD>growth efficiency</TD></TR>
  </TABLE>
  </div>

  <div class="par">
  <h2>abj parameters at 20.0&deg;C</h2>
  <TABLE id="par">
    <TR class="head"><TH>symbol</TH> <TH>units</TH> <TH>value</TH>  <TH>free</TH> <TH>description</TH> </TR>
    <TR><TD>T_ref</TD> <TD>K</TD> <TD>293.1</TD> <TD>0</TD> <TD>Reference temperature</TD></TR>
    <TR><TD>T_A</TD> <TD>K</TD> <TD>9000</TD> <TD>0</TD> <TD>Arrhenius temperature</TD></TR>
    <TR><TD>z</TD> <TD>-</TD> <TD>6.92</TD> <TD>1</TD> <TD>zoom factor</TD></TR>
    <TR><TD>F_m</TD> <TD>l/d.cm^2</TD> <TD>6.5</TD> <TD>0</TD> <TD>{F_m}, max spec searching rate</TD></TR>
    <TR><TD>kap_X</TD> <TD>-</TD> <TD>0.8</TD> <TD>0</TD> <TD>digestion efficiency of food to reserve</TD></TR>
    <TR><TD>kap_P</TD> <TD>-</TD> <TD>0.1</TD> <TD>0</TD> <TD>faecation efficiency of food to faeces</TD></TR>
    <TR><TD>v</TD> <TD>cm/d</TD> <TD>0.03475</TD> <TD>1</TD> <TD>energy conductance</TD></TR>
    <TR><TD>kap</TD> <TD>-</TD> <TD>0.9551</TD> <TD>1</TD> <TD>allocation fraction to soma</TD></TR>
    <TR><TD>kap_R</TD> <TD>-</TD> <TD>0.95</TD> <TD>0</TD> <TD>reproduction efficiency</TD></TR>
    <TR><TD>p_M</TD> <TD>J/d.cm^3</TD> <TD>1971</TD> <TD>1</TD> <TD>[p_M], vol-spec somatic maint</TD></TR>
    <TR><TD>p_T</TD> <TD>J/d.cm^2</TD> <TD>  0</TD> <TD>0</TD> <TD>{p_T}, surf-spec somatic maint</TD></TR>
    <TR><TD>k_J</TD> <TD>1/d</TD> <TD>0.002</TD> <TD>0</TD> <TD>maturity maint rate coefficient</TD></TR>
    <TR><TD>E_G</TD> <TD>J/cm^3</TD> <TD>5229</TD> <TD>1</TD> <TD>[E_G], spec cost for structure</TD></TR>
    <TR><TD>E_Hb</TD> <TD>J</TD> <TD>0.004633</TD> <TD>1</TD> <TD>maturity at birth</TD></TR>
    <TR><TD>E_Hj</TD> <TD>J</TD> <TD>0.008661</TD> <TD>1</TD> <TD>maturity at metamorphosis</TD></TR>
    <TR><TD>E_Hp</TD> <TD>J</TD> <TD>1.805e+07</TD> <TD>1</TD> <TD>maturity at puberty</TD></TR>
    <TR><TD>h_a</TD> <TD>1/d^2</TD> <TD>5.625e-10</TD> <TD>1</TD> <TD>Weibull aging acceleration</TD></TR>
    <TR><TD>s_G</TD> <TD>-</TD> <TD>0.0001</TD> <TD>0</TD> <TD>Gompertz stress coefficient</TD></TR>
    <TR><TD>del_M</TD> <TD>-</TD> <TD>0.05653</TD> <TD>1</TD> <TD>shape coefficient for total length</TD></TR>
    <TR><TD>f</TD> <TD>-</TD> <TD>  1</TD> <TD>0</TD> <TD>scaled functional response for 0-var data</TD></TR>
    <TR><TD>f_tW</TD> <TD>-</TD> <TD>0.3427</TD> <TD>1</TD> <TD>scaled functional response for tW data</TD></TR>
  </TABLE>
  </div>

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/ebtbifstats.c<|end_filename|>
/***
  NAME
    ebtbifstats.c
  DESCRIPTION
    Collects and outputs summary statistics over bifurcation runs. Apart from
    averages, minimum/maximum and variances over the output qunatities
    defined in the DefineOutput() routine, the following additional statistics
    are written to file:

        column OUTPUT_VAR_NR      : Bifurcation parameter
        column OUTPUT_VAR_NR+1    : Periodicity of oscillations in stored variable 1
        .
        .
        column OUTPUT_VAR_NR+N    : Periodicity of oscillations in stored variable N
        column OUTPUT_VAR_NR+N+1  : Average number of cohorts during bifurcation period
        column OUTPUT_VAR_NR+N+2  : cohort_limit (if adjusted during run)

  Last modification: AMdR - May 28, 2019
***/

// If not explicitly requested, output variances as CV
//    0: No output of variances
//    1: Variances as output
//    2: Variances as CV
#ifndef VARIANCES
#define VARIANCES  2
#endif
#if (VARIANCES == 0)
#if !defined(_MSC_VER)
#warning "Not generating any output on variances"
#endif
#endif
#ifndef PERIODICITY_OUTPUT_NR
#define PERIODICITY_OUTPUT_NR     0
#endif
#ifndef ADJUST_COH_LIMIT
#define ADJUST_COH_LIMIT          0                                                 // Do not adjust cohort limit by default
#endif
#ifndef TARGET_COHORTS
#define TARGET_COHORTS            500
#endif
#ifndef MIN_COH_LIMIT
#define MIN_COH_LIMIT             0.001
#endif
#ifndef MAX_COH_LIMIT
#define MAX_COH_LIMIT             1.0
#endif
#ifndef ZERO_CV
#define ZERO_CV                   0.001                                             // Threshold for positive coeff. of variation
#endif
#ifndef MAXFFT
#define MAXFFT                    65536                                             // Maximum points in FFT: 2^16
#endif
#ifndef TRANSFRAC
#define TRANSFRAC                 0.4
#endif
#ifndef M_PI
#define M_PI                      3.14159265358979323846
#endif
#ifndef HAS_FFTW3
#define HAS_FFTW3                 0
#endif

#ifndef NANO
#define NANO                      1.0E-9
#endif

static double                     stored[MAXFFT], wrapped[MAXFFT];
static int                        indexStored;
static double                     periodFFT;

static char                       fn[1024], currun[1024];

#define Sigma(ss, n)              sqrt((ss)/((double)(n - 1)))

static int                        Observation = 0;

static int                        PreventRecursion = 0;

static double                     delt_out_target;
extern double                     delt_out;

static double                     BifOutputVar[OUTPUT_VAR_NR];
static double                     AllAve[OUTPUT_VAR_NR];
static double                     AllGAve[OUTPUT_VAR_NR];
static double                     AllVar[OUTPUT_VAR_NR];
static double                     AllMax[OUTPUT_VAR_NR];
static double                     AllMin[OUTPUT_VAR_NR];
static double                     AveCohno[POPULATION_NR];

static void                       initMeasureBifstats(char *rn);
static void                       UpdateStats(double value, double *mean, double *gmean, double *sum_sq, int n);
static double                     dofft(double *source, double *tm, int obs);

#if (ADJUST_COH_LIMIT == 1)
#define COHORTLIMITS              13
static double                     CohLimits[COHORTLIMITS] = {0.001, 0.002, 0.0025, 0.005,
                                                             0.01,  0.02,  0.025,  0.05,
                                                             0.1,   0.2,   0.25,   0.5,
                                                             1.0};
static int                        CLindex = 0, minCLindex, maxCLindex;
static void                       setCohortLimit(double targetval);
#endif


/*
 *====================================================================================================================================
 *
 *    Implementation of globally aceesible routines
 *
 *====================================================================================================================================
 */

void  measureBifstats(double *env, population *pop)

{
  int     i, nr;
  static double   lastCallT = -HUGE_VAL;
  static int    first = 1;

  if (first) initMeasureBifstats(runname);
  first = 0;

  // If DefineOutput() is called from another routine in this file
  // return immediately
  if ((PreventRecursion) || (lastCallT > env[0]-0.5*cohort_limit)) return;

  // Measure over the last 60% of the bifurcation period.
  if ((env[0] < (next_bif_output - TRANSFRAC*BifPeriod)) && (!DoBifOutput)) return;

  memset(BifOutputVar, 0, OUTPUT_VAR_NR*sizeof(double));
  PreventRecursion = 1;
  if (outputDefined)
    for (i=0; i<OUTPUT_VAR_NR; i++) BifOutputVar[i] = output[i+1];                  // Output is shifted at end of FileOut()
  else DefineOutput(env, pop, BifOutputVar);
  PreventRecursion = 0;

  // Measure over the last 60% of the bifurcation period. With 2000 time units
  // as BifPeriod this allows for an FFT on 1024 data points.
  // Limit the storage to MAXFFT points. Wrap around the array if more
  nr = Observation % MAXFFT;

  // Store output variables
  stored[nr] = BifOutputVar[indexStored];

  Observation++;

  for (i=0; i<OUTPUT_VAR_NR; i++)
    {
      if (isnan(BifOutputVar[i]) || ismissing(BifOutputVar[i])) continue;

      AllMax[i] = max(BifOutputVar[i], AllMax[i]);
      AllMin[i] = min(BifOutputVar[i], AllMin[i]);

      UpdateStats(BifOutputVar[i], AllAve+i, AllGAve+i, AllVar+i, Observation);
    }

#if (POPULATION_NR > 0)
  for (i=0; i<POPULATION_NR; i++) UpdateStats(cohort_no[i], AveCohno+i, NULL, NULL, Observation);
#endif
  lastCallT = env[0];

  return;
}


/*==================================================================================================================================*/

void  outputMeasureBifstats(double *env, population *pop)

{
  int       i, j, nr;

  // If DefineOutput() is called from another routine in this file
  // or output is not required at this time return immediately
  if ((PreventRecursion) || (!DoBifOutput)) return;

#if (POPULATION_NR > 0)
  measureBifstats(env, pop);
#else
  measureBifstats(env, NULL);
#endif

  if (Observation < 2)                                                              // This should not happen
    ErrorExit(1, "Less than 2 observations stored at the end of BifPeriod, measuring not possible!");

  // If time equal to integer multiple of BifPeriod output all averages
  nr = imin(Observation, MAXFFT);
  if (Observation > MAXFFT)
    {
      // More points have been stored than the array allows
      // and hence the data are wrapped around. Unwrap!
      // First copy stored to wrapped
      memcpy(wrapped, stored, MAXFFT*sizeof(double));
      // What is stored at Observation % MAXFFT (which would be the
      // place of next storage) is in fact the first observation
      // and should end up in stored[0]. Similarly, what is stored at
      // (Observation+i) % MAXFFT should end up in stored[i].
      for (i=0; i<MAXFFT; i++)
        {
          j = (Observation + i) % MAXFFT;
          stored[i] = wrapped[j];
        }
    }
  periodFFT = dofft(stored, wrapped, nr);

  if (averages)
    {
      PrettyPrint(averages, env[0]);

      for (i=0; i<OUTPUT_VAR_NR; i++)
        {
          fprintf(averages, "\t");
          PrettyPrint(averages, AllAve[i]);
        }
      fprintf(averages, "\t");
      PrettyPrint(averages, parameter[BifParIndex]);

      fprintf(averages, "\t");
      PrettyPrint(averages, periodFFT);
      for (i=0; i<POPULATION_NR; i++)
        {
          fprintf(averages, "\t");
          PrettyPrint(averages, AveCohno[i]);
        }
#if (ADJUST_COH_LIMIT == 1)
      fprintf(averages, "\t");
      PrettyPrint(averages, cohort_limit);
#endif
      (void)fprintf(averages, "\n");
      (void)fflush(averages);
    }

  if (gaverages)
    {
      PrettyPrint(gaverages, env[0]);

      for (i=0; i<OUTPUT_VAR_NR; i++)
        {
          fprintf(gaverages, "\t");
          PrettyPrint(gaverages, exp(AllGAve[i]));
        }
      fprintf(gaverages, "\t");
      PrettyPrint(gaverages, parameter[BifParIndex]);

      fprintf(gaverages, "\t");
      PrettyPrint(gaverages, periodFFT);

      for (i=0; i<POPULATION_NR; i++)
        {
          fprintf(gaverages, "\t");
          PrettyPrint(gaverages, AveCohno[i]);
        }
#if (ADJUST_COH_LIMIT == 1)
      fprintf(gaverages, "\t");
      PrettyPrint(gaverages, cohort_limit);
#endif
      (void)fprintf(gaverages, "\n");
      (void)fflush(gaverages);
    }

  if (extrema)
    {
      PrettyPrint(extrema, env[0]);

      for (i=0; i<OUTPUT_VAR_NR; i++)
        {
          fprintf(extrema, "\t");
          PrettyPrint(extrema, AllMin[i]);
        }
      fprintf(extrema, "\t");
      PrettyPrint(extrema, parameter[BifParIndex]);

      fprintf(extrema, "\t");
      PrettyPrint(extrema, periodFFT);

      for (i=0; i<POPULATION_NR; i++)
        {
          fprintf(extrema, "\t");
          PrettyPrint(extrema, AveCohno[i]);
        }
#if (ADJUST_COH_LIMIT == 1)
      fprintf(extrema, "\t");
      PrettyPrint(extrema, cohort_limit);
#endif
      (void)fprintf(extrema, "\n");

      PrettyPrint(extrema, env[0]);

      for (i=0; i<OUTPUT_VAR_NR; i++)
        {
          fprintf(extrema, "\t");
          PrettyPrint(extrema, AllMax[i]);
        }
      fprintf(extrema, "\t");
      PrettyPrint(extrema, parameter[BifParIndex]);

      fprintf(extrema, "\t");
      PrettyPrint(extrema, periodFFT);

      for (i=0; i<POPULATION_NR; i++)
        {
          fprintf(extrema, "\t");
          PrettyPrint(extrema, AveCohno[i]);
        }
#if (ADJUST_COH_LIMIT == 1)
      fprintf(extrema, "\t");
      PrettyPrint(extrema, cohort_limit);
#endif
      (void)fprintf(extrema, "\n");
      (void)fflush(extrema);
    }

  if (variances)
    {
      PrettyPrint(variances, env[0]);

#if (VARIANCES == 2)
      for (i=0; i<OUTPUT_VAR_NR; i++)
        {
          fprintf(variances, "\t");
          if (AllAve[i] > NANO)
            PrettyPrint(variances, Sigma(AllVar[i], Observation)/AllAve[i]);
          else
            PrettyPrint(variances, 0.0);
        }
#else
      for (i=0; i<OUTPUT_VAR_NR; i++)
        {
          fprintf(variances, "\t");
          PrettyPrint(variances, Sigma(AllVar[i], Observation));
        }
#endif
      fprintf(variances, "\t");
      PrettyPrint(variances, parameter[BifParIndex]);

      fprintf(variances, "\t");
      PrettyPrint(variances, periodFFT);

      for (i=0; i<POPULATION_NR; i++)
        {
          fprintf(variances, "\t");
          PrettyPrint(variances, AveCohno[i]);
        }
#if (ADJUST_COH_LIMIT == 1)
      fprintf(variances, "\t");
      PrettyPrint(variances, cohort_limit);
#endif
      (void)fprintf(variances, "\n");
      (void)fflush(variances);
    }

#if ((ADJUST_COH_LIMIT == 1) && (POPULATION_NR > 0))
  double    avecn = 0.0;

  for (i=0; i<POPULATION_NR; i++) avecn +=AveCohno[i];
  avecn /= POPULATION_NR;
  setCohortLimit((avecn/TARGET_COHORTS)*cohort_limit);
#endif

  for (i=0; i<OUTPUT_VAR_NR; i++)
    {
      AllAve[i]    =  0.0;
      AllGAve[i]   =  0.0;
      AllVar[i]    =  0.0;
      AllMin[i]    =  HUGE_VAL;
      AllMax[i]    = -HUGE_VAL;
    }
  memset(stored, 0, MAXFFT*sizeof(double));

  for (i=0; i<POPULATION_NR; i++) AveCohno[i] = 0;

  DoBifOutput = 0;
  Observation = 0;

  return;
}


/*
 *====================================================================================================================================
 *
 *    Implementation of static routines
 *
 *====================================================================================================================================
 */

static void initMeasureBifstats(char *rn)

{
  int     i;

  strcpy(currun, rn);

  ReportNote(" ");
  ReportNote("%-57s:  %-10.6f", "Zero CV threshold", ZERO_CV);
#if (VARIANCES == 2)
  ReportNote("%-57s", "Variances of output variables expressed as coefficients of variation");
#else
  ReportNote("%-57s", "Variances of output variables expressed as standard deviation");
#endif

  Observation = 0;
  for (i=0; i<OUTPUT_VAR_NR; i++)
    {
      AllAve[i]    =  0.0;
      AllGAve[i]   =  0.0;
      AllVar[i]    =  0.0;
      AllMin[i]    =  HUGE_VAL;
      AllMax[i]    = -HUGE_VAL;
    }
  for (i=0; i<POPULATION_NR; i++) AveCohno[i] = 0;

  delt_out_target = delt_out;
#if (ADJUST_COH_LIMIT == 1)
  for (minCLindex = 0; (minCLindex <  COHORTLIMITS) && (CohLimits[minCLindex] < MIN_COH_LIMIT); minCLindex++);
  minCLindex = imin(minCLindex, COHORTLIMITS-1);

  for (maxCLindex = COHORTLIMITS-1; (maxCLindex >= 0) && (CohLimits[maxCLindex] > MAX_COH_LIMIT); maxCLindex--);
  maxCLindex = imax(maxCLindex, 0);

  setCohortLimit(cohort_limit);
#endif

  memset(stored, 0, MAXFFT*sizeof(double));
  indexStored = PERIODICITY_OUTPUT_NR;

  averages  = NULL;
  gaverages = NULL;
  extrema   = NULL;
  variances = NULL;

  strcpy(fn, currun);                                                               // Open additional file for averages output 
  strcat(fn, "avg.out");
  averages = fopen(fn, "a");
  if (!averages)
    fprintf(stderr, "Failed to open file %s\n", fn);

  strcpy(fn, currun);                                                               // Open additional file for geometric averages output
  strcat(fn, "gavg.out");
  gaverages = fopen(fn, "a");
  if (!gaverages)
    fprintf(stderr, "Failed to open file %s\n", fn);

  strcpy(fn, currun);                                                               // Open additional file for minima/maxima output
  strcat(fn, "minmax.out");
  extrema  = fopen(fn, "a");
  if (!extrema)
    fprintf(stderr, "Failed to open file %s\n", fn);

#if (VARIANCES != 0)
  strcpy(fn, currun);                                                               // Open additional file for variances output
  strcat(fn, "var.out");
  variances = fopen(fn, "a");
  if (!variances)
    fprintf(stderr, "Failed to open file %s\n", fn);
#endif

  return;
}


/*==================================================================================================================================*/
#if (ADJUST_COH_LIMIT == 1)

static void setCohortLimit(double targetval)

{
  double    ratio, testfun, maxtest;

  if (minCLindex > maxCLindex) return;

  // Determine the cohort limit index
  if (minCLindex == maxCLindex) CLindex = minCLindex;
  else if (targetval < CohLimits[minCLindex])
    CLindex = minCLindex;
  else if (targetval > CohLimits[maxCLindex])
    CLindex = maxCLindex;
  else
    {
      for (CLindex=maxCLindex, maxtest = 0.0; CLindex>=minCLindex; CLindex--)
        {
          ratio   = targetval/CohLimits[CLindex];
          testfun = ratio*exp(-ratio);
          if (testfun < maxtest) break;

          maxtest = testfun;
        }
    }

  cohort_limit = CohLimits[CLindex + 1];
  delt_out = max(delt_out_target, cohort_limit);

  return;
}

#endif

/*==================================================================================================================================*/

static void    UpdateStats(double value, double *mean, double *gmean, double *sum_sq, int n)

  /*
   * UpdateStats -  Routine that updates the value of the mean and the sum of
   *                the squared deviations from the mean for a series of number
   *                of which "value" is the next element.
   *
   * Arguments -  value : The current element in the series of numbers.
   *              mean  : The mean value of all preceding number in the series.
   *              sum_sq: The sum of the squared deviations of all preceding numbers.
   *              n     : The order number of the current value in the series.
   *                      It hence equals the number of observations on which
   *                      the resulting (!!) statistics are based.
   */

{
  double    deviation;

  // Very clever! Writing out the expressions for mean and variance shows that
  // it is indeed correct.

  // Compute arithmetic mean
  deviation  = value - *mean;
  *mean     += (deviation / n);

  // Compute the variance if requested
  if (sum_sq)
    *sum_sq += (deviation * (value - *mean));

  // Compute geometric mean: Ignore negative values completely, the mean is
  // only computed over all positive observations
  if (gmean && (value > 0))
    {
      deviation  = log(value) - *gmean;
      *gmean    += (deviation / n);
    }

  return;
}




/*==================================================================================================================================*/
#if (HAS_FFTW3 == 1)
#include <fftw3.h>

static void fft(double *jr, double *ji, int n)

{
  int     i, nc;
  double    *in;
  fftw_complex    *out;
  fftw_plan   plan_forward;

  // Set up an array to hold the transformed data, get a "plan", and execute
  // the plan to transform the IN data to the OUT FFT coefficients.
  nc = (n / 2) + 1;

  in  = (double *)fftw_malloc(sizeof(double) * n);
  out = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * nc);

  plan_forward = fftw_plan_dft_r2c_1d(n, in, out, FFTW_ESTIMATE);

  for (i = 0; i < n; i++) in[i] = jr[i];

  fftw_execute(plan_forward);

  for (i = 0; i < nc; i++)
    {
      jr[i]=out[i][0]; ji[i]=out[i][1];
    }

  // Release the memory associated with the plans.
  fftw_destroy_plan(plan_forward);
  fftw_free(in);
  fftw_free(out);

  return;
}

#else
static int bit_swap(int i, int nu)

/*
 * Bit swapping routine in which the bit pattern of the integer i is reordered.
 * See Brigham's book for details
 */

{
  int   ib, i1, i2;

  ib = 0;

  for (i1 = 0; i1 != nu; i1++)
    {
      i2 = i / 2;
      ib = ib * 2 + i - 2 * i2;
      i  = i2;
    }

  return (ib);
}


/*==================================================================================================================================*/

static void fswap(double *a, double *b)

{
  double  temp;

  temp = (*a);
  (*a) = (*b);
  (*b) = temp;

  return;
}


/*==================================================================================================================================*/

static void fft(double *real_data, double *imag_data, int n_pts)

/*
 * Carry out a FORWARD Fourier transform on data. Real and imaginary part of
 * the data points are stored in real_data and imag_data, respectively. These
 * arrays are of length n_pnts, which MUST be an integer power of 2 (this is
 * not checked for!).
 *
 * Routine is adapted from the routine implemented in the source code of
 * Grace.
 */

{
  int                             n2, i, ib, mm, k, nu;
  int                             tstep;
  double                          tr, ti, arg;                                      // intermediate values in calcs.
  double                          c, s;                                             // cosine & sine components of Fourier trans.
  static double                   *sintab = NULL;
  static int                      last_n = 0;

  // nu ...... logarithm in base 2 of n_pts e.g. nu = 5 if n_pts = 32.
  n2 = n_pts;
  nu = 0;
  while (n2 > 1)
    {
      nu++;
      n2 /= 2;
    }

  // n2 is the size of half the data array
  n2 = n_pts / 2;

  // just deallocate memory if called with zero points
  if (n_pts==0)
    {
      if (sintab) free(sintab);
      sintab = NULL;
      last_n = 0;
      return;
    }
  else if (n_pts != last_n)
    {
      /// allocate new sin table
      arg    = 2*M_PI/n_pts;
      last_n = 0;
      if (sintab) free(sintab);
      sintab = (double *) calloc(n_pts, sizeof(double));

      if (sintab == NULL) return;   // out of memory!

      for (i=0; i<n_pts; i++) sintab[i] = sin(arg*i);
      last_n = n_pts;
    }

  // do bit reversal of data in advance
  for (k = 0; k != n_pts; k++)
    {
      ib = bit_swap(k, nu);
      if (ib > k)
        {
          fswap((real_data + k), (real_data + ib));
          fswap((imag_data + k), (imag_data + ib));
        }
    }

  // Calculate the componets of the Fourier series of the function
  tstep = n2;
  for (mm = 1; mm < n_pts; mm*=2)
    {
      int sinidx=0, cosidx=n_pts/4;
      for (k=0; k<mm; k++)
        {
          c = sintab[cosidx];
          s = sintab[sinidx];

          sinidx += tstep; cosidx += tstep;
          if (sinidx >= n_pts) sinidx -= n_pts;
          if (cosidx >= n_pts) cosidx -= n_pts;

          for (i = k; i < n_pts; i+=mm*2)
            {
              double re1, re2, im1, im2;

              re1=real_data[i]; re2=real_data[i+mm];
              im1=imag_data[i]; im2=imag_data[i+mm];

              tr = re2 * c + im2 * s;
              ti = im2 * c - re2 * s;
              real_data[i+mm] = re1 - tr;
              imag_data[i+mm] = im1 - ti;
              real_data[i] = re1 + tr;
              imag_data[i] = im1 + ti;
            }
        }
      tstep /= 2;
    }

  return;
}

#endif

/*==================================================================================================================================*/

static double dofft(double *source, double *dummy, int obs)

{
  int     i, maxi, obs2;
  double    dt, *data, timespan, mean, variance;
  double    maxpower, x[3], y[3], period, a, b;

  // Data are collected at interval cohort_limit
  dt = cohort_limit;

#if (HAS_FFTW3 == 1)
  // If using FFTW3 we do not need a data length equal to a power of 2
  obs2 = obs;
#else
  // Here we have to find the largest power of 2 that is <= obs
  for (obs2 = MAXFFT; obs2 >= obs; obs2 >>= 1);
#endif

  // obs2 is now the length of the input series
  // Timespan is the number of observations minus 1 times the timestep
  timespan = (obs2-1)*dt;

  // Take the last obs2 data points. Data points are stored in
  // source[0]..source[obs-1]. The one's I need are in source[(obs-obs2)] to
  // source[obs-1].
  data = source + (obs-obs2);

  // Compute mean and variance of the observations
  mean = 0.0;
  for (i=0; i<obs2; i++) mean += data[i];
  mean /= obs2;

  variance = 0.0;
  for (i = 0; i < obs2; i++) variance += (data[i] - mean) * (data[i] - mean);
  variance /= (obs2 - 1);

  // If coefficient of variation is indistinguishable from 0, return

  if (sqrt(variance) < ZERO_CV*mean) return 0.0;

  // Zero-mean the data
  for (i=0; i<obs2; i++) data[i] -= mean;

  // Apply a Hann window to the data for better estimation
  for (i=0; i<obs2; i++)
    data[i] *= (0.5 - 0.5 * cos(2.0 * M_PI * i / (obs2 - 1.0)));

  // for(i=0; i<obs2; i++) printf("%10.4f\t%G\n", i*cohort_limit, data[i]);

  // Now zero the dummy array and use it as the imaginary data array
  memset(dummy, 0, MAXFFT*sizeof(double));

  // Call the FFT
  fft(data, dummy, obs2);

  maxpower = 0.0;
  maxi     = 0;

  // Calculate the power at each frequency
  for (i=0; i<obs2/2; i++)
    {
      if (!i)
        dummy[i] = fabs(data[i]);
      else
        {
          dummy[i]  = sqrt(data[i]*data[i] + dummy[i]*dummy[i]);

          // printf("%6d\t%12G\t", i, dummy[i]);

          dummy[i] += sqrt(data[obs2-i]*data[obs2-i] + dummy[obs2-i]*dummy[obs2-i]);

          // printf("%12G\n", dummy[i]);

          if (dummy[i] > maxpower)
            {
              maxpower = dummy[i];
              maxi     = i;
            }
        }

    }

  // Now we fit a parabola to the maximum peak in the powerspectrum
  for (i=0; i<3; i++)
    {
      x[i] = (maxi+i-1);
      y[i] = dummy[maxi+i-1];
    }

  // I fitted y = a*x*x + b*x + c and used Maple to derive the coefficients
  // a  = -(x[1]*y[0]-x[0]*y[1]-x[2]*y[0]-x[1]*y[2]+x[2]*y[1]+x[0]*y[2]);
  // a /= ((x[2]-x[1])*x[0]*x[0]+(x[0]-x[2])*x[1]*x[1]+(x[1]-x[0])*x[2]*x[2]);
  // b  = ((y[1]-y[0])*x[2]*x[2]+(y[2]-y[1])*x[0]*x[0]+(y[0]-y[2])*x[1]*x[1]);
  // b /= ((x[2]-x[1])*x[0]*x[0]+(x[0]-x[2])*x[1]*x[1]+(x[1]-x[0])*x[2]*x[2]);

  // This equals -b/(2*a), the frequency where the top is located
  // period  = ((y[1]-y[0])*x[2]*x[2]+(y[2]-y[1])*x[0]*x[0]+(y[0]-y[2])*x[1]*x[1]);
  // period /= 2*(x[1]*y[0]-x[0]*y[1]-x[2]*y[0]-x[1]*y[2]+x[2]*y[1]+x[0]*y[2]);
  // period  = timespan/period;

  // Drop the common denominator of both coefficients
  a = -(x[1]*y[0]-x[0]*y[1]-x[2]*y[0]-x[1]*y[2]+x[2]*y[1]+x[0]*y[2]);
  b = ((y[1]-y[0])*x[2]*x[2]+(y[2]-y[1])*x[0]*x[0]+(y[0]-y[2])*x[1]*x[1]);

  if (iszero(b))
    period = 0.0;
  else
    period = -timespan*2*a/b;

  return period;
}


/*==================================================================================================================================*/





<|start_filename|>docs/DEBtool_lib.html<|end_filename|>
<HTML>
<HEAD>

  <TITLE>
    DEBtool_lib
  </TITLE>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H3>Toolbox: lib</H3>

  General purpose routines are parked in this domain. 
  Most of them are called from sister directories (domains), but the routines mentioned on this manual page can be used independently, after setting the
correct path to this subdirectory.

  <P>
  The sub domains are
  <UL>
    <LI> <A HREF="DEBtool_lib_regr.html"><code>regr</code></A> regression routines </LI>
    <LI> <A HREF="DEBtool_lib_prob.html"><code>prob</code></A> probability calculus </LI>
    <LI> <A HREF="DEBtool_lib_misc.html"><code>misc</code></A> miscellaneous routines</LI>
    <LI> <A HREF="DEBtool_lib_pet.html"><code>pet</code></A>  add_my_pet routines</LI>
  </UL>

<HR>
Back to the <A HREF="index.html" TARGET="_top">DEBtool</A> page

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/ebtcohrt.c<|end_filename|>
/***
  NAME
    ebtcohrt.c
  PURPOSE
    This file contains NewCohort() routine and all the functions used by
    it to keep the set of population cohorts organized and to deal with
    their increasing and decreasing number. 
  NOTES
    
  HISTORY
    AMdR - Jul 21, 1995 : Created.
    AMdR - Mar 08, 2018 : Revised last.
***/

#define EBTCOHRT_C                                                                  // Identification of file   
#define EBTLIB                                                                      // and file grouping   

#include "escbox.h"                                                                 // Include general header   
#include "ebtmain.h"
#include "ebtcohrt.h"
#include "ebttint.h"
#include "ebtutils.h"

/* <NAME> 2020/04/02 */
#include "ebttint.h"



/*==================================================================================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define AEXT                      "All populations are extinct!"
#define MAFB                      "Memory allocation failure for boundary points!"
#define MAFC                      "Memory allocation failure for i-state variables!"
#define MAFI                      "Memory allocation failure for cohort constants!"
#define MAFT                      "Memory allocation failure while inserting boundary cohorts!"


/*==================================================================================================================================*/
/*
 * Definitions of static variables, restricted to this file.
 */

#if (POPULATION_NR > 0)
static population                 BPData = NULL;                                    // Pointer to bpoints data  
static long                       BPAllocated = 0L;                                 // # of doubles allocated   
#endif // (POPULATION_NR > 0)
static double                     maxss, minss;


/*==================================================================================================================================*/
/*
 * Start of function implementations.
 */
/*==================================================================================================================================*/
#if (POPULATION_NR > 0)

int   InsCohort(cohort newcoh,
#if (I_CONST_DIM > 0)
                cohortID id,
#endif
                int pop_nr)

  /* 
   * InsCohort -  Routine inserts a new cohort on its appropriate, ordered 
   *              position in the population with number "pop_nr". The 
   *              pointer "new" points to an array of i-state variables of
   *              length COHORT_SIZE, the pointer "id" points to an array
   *              of i-state constants of length I_CONST_DIM.
   */

{
  register int                    found, equal;
  register int                    i, pos;
  cohort_pnt                      p;
#if (I_CONST_DIM > 0)
  cohortID_pnt pid;
#endif
  // Top-down search for appropriate cohort place
  p = pop[pop_nr];
  for (pos = CohortNo[pop_nr] - 1, found = 0; pos >= 0; pos--)
    {
      for (i = 1, equal = 1; (i < COHORT_SIZE) && equal; i++)
        {
          equal = (p[pos][i] == newcoh[i]);
          found = (p[pos][i] > newcoh[i]);
        }
      if (found) break;
    }

  pos++;                                                                             // Shift all entries lying above position upwards
  p = pop[pop_nr] + pos;
  if (pos < CohortNo[pop_nr]) (void)memmove(*(p + 1), *p, (CohortNo[pop_nr] - pos)*COHORT_SIZE*sizeof(double));
  // Place new cohort
  (void)memcpy((DEF_TYPE *)*p, (DEF_TYPE *)newcoh, COHORT_SIZE*sizeof(double));
#if (I_CONST_DIM > 0)
  pid = popIDcard[pop_nr] + pos;
  if (pos < CohortNo[pop_nr]) (void)memmove(*(pid + 1), *pid, (CohortNo[pop_nr] - pos)*I_CONST_DIM*sizeof(double));

  // Place new cohort id
  (void)memcpy((DEF_TYPE *)*pid, (DEF_TYPE *)id, I_CONST_DIM*sizeof(double));
#endif

  return (++CohortNo[pop_nr]);
}


/*==================================================================================================================================*/

static void CreateBcohorts()

  /* 
   * CreateBcohorts - Routine sets up the boundary cohorts and the fixed boundary points.
   */

{
  register int                    i, base;
  long                            mem_req, bp_req;

  for (i = 0; i < POPULATION_NR; i++)
    {
      if (BpointNo[i])
        {
          mem_req = (CohortNo[i] + BpointNo[i])*COHORT_SIZE;
          if (!(mem_req < DataMemAllocated[i]))                                      // Create memory for new cohorts if necessary
            {
              DataMemAllocated[i] = MemBlocks(mem_req);
              pop[i]              = (population)Myalloc((void *)pop[i], (size_t)DataMemAllocated[i], sizeof(double));
              if (!(pop[i])) ErrorAbort(MAFC);
            }
#ifdef MODULE
          if (error_code & FATAL_ERROR) return;
#endif // MODULE

          ofs[i] = pop[i] + CohortNo[i];                                             // set up pointer to offspring cohort
          (void)memset((DEF_TYPE *)(ofs[i][0]), 0, BpointNo[i]*COHORT_SIZE*sizeof(double));
#if (I_CONST_DIM > 0)
          mem_req = (CohortNo[i] + BpointNo[i])*I_CONST_DIM;
          if (!(mem_req < IDMemAllocated[i]))
            {
              IDMemAllocated[i] = MemBlocks(mem_req);
              popIDcard[i]      = (popID)Myalloc((void *)popIDcard[i], (size_t)IDMemAllocated[i], sizeof(double));
              if (!(popIDcard[i])) ErrorAbort(MAFI);
            }
#ifdef MODULE
          if (error_code & FATAL_ERROR) return;
#endif // MODULE

          ofsIDcard[i] = popIDcard[i] + CohortNo[i];
          (void)memset((DEF_TYPE *)(ofsIDcard[i][0]), 0, BpointNo[i]*I_CONST_DIM*sizeof(double));
#endif
        }
      else
        {
          ofs[i] = NULL;
#if (I_CONST_DIM > 0)
          ofsIDcard[i] = NULL;
#endif
        }
    }

  for (i = 0, bp_req = 0; i < POPULATION_NR; i++) bp_req += BpointNo[i];
  bp_req *= COHORT_SIZE;

  if ((bp_req > 0) && !(bp_req < BPAllocated))
    {
      BPAllocated = MemBlocks(bp_req);
      BPData      = (population)Myalloc((void *)BPData, (size_t)BPAllocated, sizeof(double));
      if (!(BPData)) ErrorAbort(MAFB);
    }
#ifdef MODULE
  if (error_code & FATAL_ERROR) return;
#endif // MODULE

  for (i = 0, base = 0; i < POPULATION_NR; i++)
    {
      if (BpointNo[i] > 0)
        bpoints[i] = BPData + base;
      else
        bpoints[i] = NULL;
      bpoint_no[i] = BpointNo[i];
      base += BpointNo[i];
    }

  if (BPData && BPAllocated) (void)memset((DEF_TYPE *)(BPData), 0, BPAllocated*sizeof(double));

  return;
}


/*==================================================================================================================================*/

EXTERN_C void TransBcohorts()

  /* 
   * TransBcohorts - Routine transforms the boundary cohorts into internal cohorts and clears the current boundary points.
   */


{
  register int        i;
  register int        j, k;
  register cohort_pnt p, bp;

  for (i = 0; i < POPULATION_NR; i++)
    {
      if (!bpoints[i]) continue;
      p  = ofs[i];
      bp = bpoints[i];
      for (j = 0; j < BpointNo[i]; j++)
        {
          if (p[j][number] > 0)                                                     // If new cohorts are not empty, transform i-state
            {
              for (k = 1; k < COHORT_SIZE; k++) p[j][k] = bp[j][k] + p[j][k]/p[j][number];
            }
          else                                                                      // Reset cohort to empty
            (void)memset((DEF_TYPE *)p[j], 0, COHORT_SIZE*sizeof(double));
        }
      bpoints[i] = NULL;                                                            // Set the pointers back to NULL pointers
    }

  return;
}


/*==================================================================================================================================*/

static void InsertBcohorts()

  /* 
   * InsertBcohorts - Routine inserts the boundary cohorts into the populations, ignoring empty ones.
   */

{
  register int                    i;
  register int                    j;
  static cohort_pnt               p = NULL;
#if (I_CONST_DIM > 0)
  static cohortID_pnt             pid = NULL;
#endif
  static int                      max_bcohorts = -1;
  int                             cbc;

  for (i = 0, cbc = 0; i < POPULATION_NR; i++) cbc = imax(cbc, BpointNo[i]);
  if (!cbc) return;

  if (cbc > max_bcohorts)
    {
      max_bcohorts = cbc;
      p            = (cohort_pnt)Myalloc((void *)p, (size_t)(max_bcohorts*COHORT_SIZE), sizeof(double));
      if (!p) ErrorAbort(MAFT);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif // MODULE

#if (I_CONST_DIM > 0)
      pid = (cohortID_pnt)Myalloc((void *)pid, (size_t)(max_bcohorts*I_CONST_DIM), sizeof(double));
      if (!pid) ErrorAbort(MAFT);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return;
#endif // MODULE
#endif
    }

  for (i = 0; i < POPULATION_NR; i++)
    {
      (void)memcpy((DEF_TYPE *)p, (DEF_TYPE *)(ofs[i]), BpointNo[i]*COHORT_SIZE*sizeof(double));
      (void)memset((DEF_TYPE *)(ofs[i]), 0, BpointNo[i]*COHORT_SIZE*sizeof(double));
#if (I_CONST_DIM > 0)
      (void)memcpy((DEF_TYPE *)pid, (DEF_TYPE *)(ofsIDcard[i]), BpointNo[i]*I_CONST_DIM*sizeof(double));
      (void)memset((DEF_TYPE *)(ofsIDcard[i]), 0, BpointNo[i]*I_CONST_DIM*sizeof(double));
#endif
      for (j = 0; j < BpointNo[i]; j++)                                             // If new cohorts are not empty, insert in population
        {
          if (p[j][number] > abs_tols[i][0])
            CohortNo[i] = InsCohort(p[j],
#if (I_CONST_DIM > 0)
                                    pid[j],
#endif
                                    i);
        }
      ofs[i]      = NULL;                                                           // Set the pointers back to NULL pointers
      BpointNo[i] = 0; 
    }

  return;
}


/*==================================================================================================================================*/

void SievePop()

  /* 
   * SievePop - Routine that scans all the cohorts, removing the ones that are below the minimum size and conjugating cohorts that 
   *            have become too similar.
   */

{
  register int                    i;
  register int                    j, k, ind1, ind2;
  register cohort_pnt             p;
#if (I_CONST_DIM > 0)
  register cohortID_pnt           pid;
#endif
  double                          diff, comp;
  int                             equal;

  for (i = 0; i < POPULATION_NR; i++)
    {                                                                               // Join similar cohorts
      if (!(tol_zero[i]))                                                           // If all tolerances zero skip this part
        {
          p = pop[i];
#if (I_CONST_DIM > 0)
          pid = popIDcard[i];
#endif
          for (j = 1, ind1 = 0; j < CohortNo[i]; j++)
            {
              // Skip cohorts that are too small as base cohort
              if (p[ind1][0] < abs_tols[i][0])
                {
                  ind1 = j;
                  continue;
                }
              // Determine similarity
              for (k = 1, equal = 1; equal && (k < COHORT_SIZE); k++)
                {                                                                   // Use relative and absolute tolerances
                  diff  = fabs(p[ind1][k] - p[j][k]);
                  comp  = fabs(p[ind1][k] + p[j][k] + 1.0E-15);
                  equal = ((diff < abs_tols[i][k]) || (diff < rel_tols[i][k]*comp/2.0));
                }
              if (!equal)
                ind1 = j;                                                           // If unequal skip
              else                                                                  // If equal join, i-state and constants become
                {                                                                   // weigthed mean
                  for (k = 1; k < COHORT_SIZE; k++)
                    p[ind1][k] = ((p[ind1][k]*p[ind1][0] + p[j][k]*p[j][0])/(p[ind1][0] + p[j][0]));
#if (I_CONST_DIM > 0)
                  for (k = 0; k < I_CONST_DIM; k++) pid[ind1][k] = ((pid[ind1][k]*p[ind1][0] + pid[j][k]*p[j][0])/(p[ind1][0] + p[j][0]));
#endif
                  p[ind1][0] += p[j][0];
                  p[j][0] = -1.0E-15;
                }
            }
        }

      // Test the cohorts that are left upon size
      j = 0;
      p = pop[i];
#if (I_CONST_DIM > 0)
      pid = popIDcard[i];
#endif
      while ((j < CohortNo[i]) && (p[j][0] > abs_tols[i][0])) j++;
      ind1 = j;
      while (j < CohortNo[i])
        {
          while ((j < CohortNo[i]) && !(p[j][0] > abs_tols[i][0])) j++;
          ind2 = j;
          while ((j < CohortNo[i]) && (p[j][0] > abs_tols[i][0])) j++;
          if (j > ind2)
            {
              (void)memmove((DEF_TYPE *)p[ind1], (DEF_TYPE *)p[ind2], (j - ind2)*COHORT_SIZE*sizeof(double));
#if (I_CONST_DIM > 0)
              (void)memmove((DEF_TYPE *)pid[ind1], (DEF_TYPE *)pid[ind2], (j - ind2)*I_CONST_DIM*sizeof(double));
#endif
              ind1 += (j - ind2);
            }
        }
      CohortNo[i] = ind1;
    }

  for (i = 0; i < POPULATION_NR; i++) cohort_no[i] = CohortNo[i];

  return;
}


#endif // (POPULATION_NR > 0)

/*==================================================================================================================================*/

void CohortCycle(double next)

/* 
   * CohortCycle - Routine loops through one cycle of cohort creation and output
   *               generation. First new boundary cohorts are created, then
   *               integration of the continuous dynamics takes place, after
   *               which instantaneous dynamics can occur at the end of a cohort
   *               cycle. Finally the boundary cohorts are merged with  the
   *               existing population and output is produced if necessary.
   */

{
  register int i;

#if ((CHECK_EXTINCTION > 0) && (POPULATION_NR > 0))
  int  all_zero = 1;
  char pext[80];

  for (i = 0; i < POPULATION_NR; i++)                                               // If all populations are extinct exit
    {
      if ((!CohortNo[i]) && (!pop_extinct[i]))
        {
          sprintf(pext, "Population %d is extinct at time %.2f", i, env[0]);
          Warning(pext);
          pop_extinct[i] = 1;
        }
      else if (CohortNo[i])
        pop_extinct[i] = 0;
      all_zero *= pop_extinct[i];
    }
#if (CHECK_EXTINCTION > 1)
  if (all_zero) ErrorExit(0, AEXT);
#endif

  for (i = 0; i < POPULATION_NR; i++) cohort_no[i] = CohortNo[i];
#endif // ((CHECK_EXTINCTION > 0) && (POPULATION_NR > 0))

#if (BIFURCATION == 1)
  // Set the current bifurcation parameter value
  if (BifParLogStep)
    parameter[BifParIndex] = (BifParBase*pow(10.0, BifParStep*floor((env[0] + BIFTINY)/BifPeriod)));
  else
    parameter[BifParIndex] = (BifParBase + floor((env[0] + BIFTINY)/BifPeriod)*BifParStep);
#endif // (BIFURCATION == 1)

#if (POPULATION_NR > 0)
  // User specifies no. of birth points at the start of each cohort cycle
  SetBpointNo(env, pop, BpointNo);

  // Create boundary cohorts and bpoints
  CreateBcohorts();                                                                  

  SetBpoints(env, pop, bpoints);                                                    // User defines bpoints
#else
  SetBpointNo(env, NULL, NULL);
#endif // (POPULATION_NR > 0)

#if ((BIFURCATION == 1) && (MEASUREBIFSTATS == 1))
#if (POPULATION_NR > 0)
  measureBifstats(env, pop);
#else
  measureBifstats(env, NULL);
#endif
#endif

  if (step_size <= SMALLEST_STEP) step_size = cohort_limit;
  minss = maxss = step_size;

  // Do as many integration steps as possible with adaptable stepsize and end with an optional rest step
  PrepareCycle();
  ForcedCohortEnd = cohort_end = 0;

  while ((!((next - env[0]) < SMALLEST_STEP)) && (!cohort_end))
    {
      (void)IntegrationStep(step_size, (next - (env[0])), 0);

      initState    = NULL;
      currentState = NULL;
      for (i = 0; i < MAXDERS; i++) currentDers[i] = NULL;

      minss = min(minss, step_size);
      maxss = max(maxss, step_size);
    }
  ForcedCohortEnd = cohort_end;

  if (EBTDEBUG(2))
    {
      (void)fprintf(dbgfil, "Cohort end: T = %15.8f   min. dt: %12.7E  max. dt: %12.7E\n", env[0], minss, maxss);
      (void)fflush(dbgfil);
    }
#if (POPULATION_NR > 0)
  TransBcohorts();                                                                  // Transform boundary cohorts

  InstantDynamics(env, pop, ofs);                                                   // Instantaneous dynamics at the end of cycle

  for (i = 0; i < POPULATION_NR; i++)                                               // Create empty state labels
    strcpy(statelabels[i], "");                                                     // AvdM, moved here from FileState()

  InsertBcohorts();                                                                 // Insert boundary cohorts

  SievePop();                                                                       // Delete all cohorts that are too small
#else
  InstantDynamics(env, NULL, NULL);
#endif // (POPULATION_NR > 0)

#if (BIFURCATION == 1)
  SetBifOutputTimes(env);
#endif // (BIFURCATION == 1)

  outputDefined = 0;
  if (env[0] >= (next_output - identical_zero))
    {                                                                               // Increment next time
      next_output = (floor((env[0] + identical_zero)/delt_out))*delt_out;
      next_output += delt_out;                                                      // Produce output if required at this time
      FileOut();
      outputDefined = 1;
    }

#if ((BIFURCATION == 1) && (MEASUREBIFSTATS == 1))
  outputMeasureBifstats(env, pop);
#endif

#if (POPULATION_NR > 0)
  if (state_out > 0.0)
    {
      if (env[0] >= (next_state_output - identical_zero))
        {                                                                           // Increment next time
          next_state_output = (floor((env[0] + identical_zero)/state_out))*state_out;
          next_state_output += state_out;                                           // Output complete state if required at this time
          FileState();
        }
    }
#endif // (POPULATION_NR > 0)

#if (DYNAMIC_COHORTS == 1)
  next_cohort_end = max_time;
#else
  if (fabs(next_cohort_end - env[0]) < SMALLEST_STEP)
    next_cohort_end += cohort_limit;
  else if ((next_cohort_end - env[0]) < SMALLEST_STEP)
    next_cohort_end = env[0] + cohort_limit;
#endif // DYNAMIC_COHORTS

  return;
}


/*==================================================================================================================================*/

#if defined(MODULE)

EXTERN_C int CycleInit()

{
  register int    i;

#ifdef MODULE
  strcpy(error_msg, "");
#endif
  error_code    = 0;

  if ((env[0] >= max_time) || ForcedRunEnd) return 1;

#if ((CHECK_EXTINCTION > 0) && (POPULATION_NR > 0))
  int                             all_zero=1;
  char                            pext[80];

  for (i=0; i<POPULATION_NR; i++)                                                   // If all populations are extinct exit
    {
      if ((!CohortNo[i]) && (!pop_extinct[i]))
        {
          sprintf(pext, "Population %d is extinct at time %.2f", i, env[0]);
          Warning(pext);
          pop_extinct[i]=1;
        }
      else if (CohortNo[i]) pop_extinct[i]=0;
      all_zero *= pop_extinct[i];
    }
#if (CHECK_EXTINCTION > 1)
  if (all_zero) return (1 | error_code);
#endif

  for (i=0; i<POPULATION_NR; i++) cohort_no[i] = CohortNo[i];
#endif // ((CHECK_EXTINCTION > 0) && (POPULATION_NR > 0))

#if (BIFURCATION == 1)
  // Set the current bifurcation parameter value
  if (BifParLogStep)
    parameter[BifParIndex] = (BifParBase*pow(10.0, BifParStep*floor((env[0]+BIFTINY)/BifPeriod)));
  else
    parameter[BifParIndex] = (BifParBase + floor((env[0]+BIFTINY)/BifPeriod)*BifParStep);
#endif // (BIFURCATION == 1)

#if (POPULATION_NR > 0)
  // User specifies no. of birth points at the start of each cohort cycle
  SetBpointNo(env, pop, BpointNo);

  CreateBcohorts();                                                                 // Create boundary cohorts and bpoints

  if (error_code & FATAL_ERROR) return error_code;

  SetBpoints(env, pop, bpoints);                                                    // User defines bpoints
#else
  SetBpointNo(env, NULL, NULL);
#endif // (POPULATION_NR > 0)

#if ((BIFURCATION == 1) && (MEASUREBIFSTATS == 1))
#if (POPULATION_NR > 0)
  measureBifstats(env, pop);
#else
  measureBifstats(env, NULL);
#endif
#endif

  if (step_size <= SMALLEST_STEP) step_size = cohort_limit;
  minss = maxss = step_size;

  // Do as many integration steps as possible with adaptable stepsize and end with an optional rest step
  PrepareCycle();
  ForcedCohortEnd = cohort_end   = 0;

  return error_code;
}



/*==================================================================================================================================*/

EXTERN_C int CycleStep()

{
  int                             i, ret_val;                                       //AvdM

#ifdef MODULE
  strcpy(error_msg, "");
#endif
  error_code = 0;

  if ((env[0] >= max_time) || ForcedRunEnd) return END_OF_COHORT;

  /*
  if ((!((next_cohort_end-env[0]) < SMALLEST_STEP)) && (!cohort_end))
  {
  (void)IntegrationStep(step_size, (next_cohort_end-(env[0])), 0);
  minss = min(minss, step_size);
  maxss = max(maxss, step_size);
  return 0;
  }
  */                                                                                //AvdM

  while ((!((next_cohort_end - env[0]) < SMALLEST_STEP)) && (!cohort_end))
    {
      (void)IntegrationStep(step_size, (next_cohort_end - (env[0])), 0);
      minss = min(minss, step_size);
      maxss = max(maxss, step_size);
    }

  ForcedCohortEnd = cohort_end;

  ret_val = END_OF_COHORT;                                                          //AvdM

  if (EBTDEBUG(2))
    {
      (void)fprintf(dbgfil, "Cohort end: T = %15.8f   min. dt: %12.7E  max. dt: %12.7E\n", env[0], minss, maxss);
      (void)fflush(dbgfil);
    }
#if (POPULATION_NR > 0)
  TransBcohorts();                                                                  // Transform boundary cohorts

  InstantDynamics(env, pop, ofs);                                                   // Instantaneous dynamics at the end of cycle

  for (i = 0; i < POPULATION_NR; i++)                                               // Create empty state labels
    strcpy(statelabels[i], "");                                                     // AvdM, moved here from FileState()

  InsertBcohorts();                                                                 // Insert boundary cohorts

  if (error_code & FATAL_ERROR) return (ret_val | error_code);

  SievePop();                                                                       // Delete all cohorts that are too small
#else
  InstantDynamics(env, NULL, NULL);
#endif // (POPULATION_NR > 0)

#if (BIFURCATION == 1)
  SetBifOutputTimes(env);
#endif // (BIFURCATION == 1)

  outputDefined = 0;
  if (env[0] >= (next_output - identical_zero))
    {                                                                               // Increment next time
      next_output = (floor((env[0] + identical_zero)/delt_out))*delt_out;
      next_output += delt_out;                                                      // Produce output if required at this time
      FileOut();
      ret_val |= NORMAL_OUT;                                                        //AvdM
      outputDefined = 1;
    }

#if ((BIFURCATION == 1) && (MEASUREBIFSTATS == 1))
  outputMeasureBifstats(env, pop);
#endif

#if (POPULATION_NR > 0)
  if (state_out > 0.0)
    {
      if (env[0] >= (next_state_output - identical_zero))
        {                                                                           // Increment next time
          next_state_output = (floor((env[0] + identical_zero)/state_out))*state_out;
          next_state_output += state_out;                                           // Output complete state if required at this time
          FileState();
          ret_val |= STATE_OUT;                                                     //AvdM
        }
    }
#endif // (POPULATION_NR > 0)

#if (DYNAMIC_COHORTS == 1)
  next_cohort_end = max_time;
#else
  if (fabs(next_cohort_end - env[0]) < SMALLEST_STEP)
    next_cohort_end += cohort_limit;
  else if ((next_cohort_end - env[0]) < SMALLEST_STEP)
    next_cohort_end = env[0] + cohort_limit;
#endif // DYNAMIC_COHORTS

  ret_val |= error_code;

  return ret_val;                                                                   //AvdM
}

/*==================================================================================================================================*/

#endif // defined(MODULE)


<|start_filename|>lib/regr/html/mydata_surv3.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>mydata_surv3</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-20"><meta name="DC.source" content="mydata_surv3.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#2">set par values for binary mixture toxicants</a></li><li><a href="#3">set genetic algorithm parameters</a></li></ul></div><pre class="codeinput"><span class="comment">% created: 2006/08/14 by <NAME></span>
<span class="comment">% sample data for surv3 routines</span>
</pre><h2>set par values for binary mixture toxicants<a name="2"></a></h2><pre class="codeinput">h0 = .016;    <span class="comment">% 1/h, blank mortality prob rate (always &gt;0)</span>
CA0 = 3.10;   <span class="comment">% mM, No-Effect-Concentration for A (external, may be zero)</span>
CB0 = 1.13;   <span class="comment">% mM, No-Effect-Concentration for B (external, may be zero)</span>
bA = 0.29;    <span class="comment">% 1/(h*mM), killing rate for A</span>
bB = 0.024;   <span class="comment">% 1/(h*mM), killing rate for B</span>
kA = 5.0;     <span class="comment">% 1/h, elimination rate for A</span>
kB = 1.7;     <span class="comment">% 1/h, elimination rate for B</span>
dAB = 0.00;   <span class="comment">% 1/(h*mM^2), interaction rate for A and B</span>

p1 = [  h0;  CA0; CB0;   bA;   bB;   kA;  kB;   dAB]; <span class="comment">% collect par values</span>
p2 = [   1;    1;   1;    1;    1;    1;    1;    1]; <span class="comment">% iteration indicator</span>
p3 = [.001; .001;.001; .001; .001; .001; .001;   -1]; <span class="comment">% lower boundary</span>
p4 = [   1;   15;   5;   10;   10;   10;   10;    1]; <span class="comment">% upper boundary</span>

par = [p1,p2,p3,p4]; <span class="comment">% compose parameter input matrix</span>
<span class="comment">% values in first column are ignored in ga-algorothm</span>

t = [0:21]'; <span class="comment">% set time points</span>
c1 = [0;0.4;0.8;1.6;3.2;6.4;12.8]; <span class="comment">% set conc first toxicant</span>
c2 = [0;0.2;0.4;0.8;1.6;3.2];      <span class="comment">% set conc second toxicant</span>

<span class="comment">% H = haz_fomort2(par,t,c1,c2);</span>
S = fomort2(p1,t,c1,c2); <span class="comment">% get survival probabilities</span>

Z = surv_count(20,S);<span class="comment">% get Monte Carlo data using 20 ind per conc-combination</span>
</pre><h2>set genetic algorithm parameters<a name="3"></a></h2><pre class="codeinput">gasurv_options(<span class="string">'max_step_number'</span>,300);
gasurv_options(<span class="string">'popSize'</span>,500);
<span class="comment">% ga-algorithm: slow but robust</span>
p_ga = gasurv3(<span class="string">'fomort2'</span>,par,t,c1,c2,Z)  <span class="comment">% par estimate using genetic algorithm</span>
<span class="comment">% nm-algorithm: faster but less robust (and more local)</span>
p_nm = nmsurv3(<span class="string">'fomort2'</span>,p_ga,t,c1,c2,Z) <span class="comment">% par estimate using nead-melder</span>
<span class="comment">% scoring method: very fast but also very senbsitive for initial conditions</span>
p_sc = scsurv3(<span class="string">'fomort2'</span>,p_nm,t,c1,c2,Z) <span class="comment">% par estimate using scoring method</span>

[p_ga(:,1), p_nm(:,1), p_sc(:,1)] <span class="comment">% compare results</span>
</pre><pre class="codeoutput">Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -163.84 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -162.84 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -163.84 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -162.84 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -163.84 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -162.84 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -163.84 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -162.84 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -163.84 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -162.84 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

1 1551.878574
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

2 1437.039027
3 
4 1417.240470

5 1395.956819
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

6 1395.930769

7 1395.424440

8 1393.061457
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -81.92 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -80.92 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

9 1391.725049
10 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

11 1389.511697

12 1375.615627

13 1367.791920

14 1357.802796
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -655.36 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

15 1357.154989

16 1304.928781
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -654.36 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -462.41 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -462.41 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -463.41 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -462.41 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

17 1304.926207
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

18 1301.712705

19 1271.146611
20 
21 1248.953781

22 1232.254568
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
23 
24 1232.254523
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

25 1156.241834

26 972.465397
27 
28 971.856567

29 971.856562

30 962.262604
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
31 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

32 958.322543

33 957.727670

34 956.534567
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -115.852 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -114.852 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

35 939.911250
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
36 
37 937.744670
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

38 926.012248
39 
40 925.666965

41 925.427340

42 923.927721
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

43 923.088349

44 922.417770
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

45 922.339126
46 
47 922.312091
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
48 
49 922.305500
50 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
51 
52 922.305450
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

53 922.305433
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

54 922.305397
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

55 922.305215

56 922.305179
57 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

58 922.305172

59 922.305137
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

60 921.925898

61 921.772806
62 
63 921.772720
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

64 921.772672
65 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

66 921.772595

67 921.772552
68 
69 921.772404
70 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

71 921.772293
72 
73 921.772268

74 921.772217
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

75 921.771941
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
76 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

77 921.771898

78 921.554807

79 921.554711
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

80 921.554569
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

81 921.554422
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

82 921.554357

83 921.554260
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
84 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

85 921.554199

86 921.554054

87 921.553990
88 
89 921.553980

90 921.553892
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

91 921.553839
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

92 921.553674

93 921.553655
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

94 921.553630

95 921.553430

96 921.427381

97 921.383713
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

98 921.383702
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

99 921.383663
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

100 921.212729
101 
102 921.212625

103 921.212531

104 920.791630

105 920.791479
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

106 920.791387
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
107 
108 920.791186

109 920.718035

110 920.717850
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
111 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

112 920.717849
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

113 920.717645
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
114 
115 920.717475
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

116 920.717344
117 
118 920.717228
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

119 920.717174
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

120 920.717086
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

121 919.872735
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

122 919.862477
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

123 919.835835
124 
125 919.835785

126 919.835768

127 919.835610
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
128 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

129 919.835415

130 919.835398
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
131 
132 919.835292

133 919.687695
134 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

135 919.687541
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

136 919.687482
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

137 919.687477

138 919.687454
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
139 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

140 919.687444

141 919.687370
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

142 909.105337

143 909.105337

144 909.105115
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

145 909.104993
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

146 909.104726

147 909.104615
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

148 909.104534
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

149 908.115068

150 907.953478
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

151 907.953189

152 907.953147

153 906.267283
154 
155 906.267221
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

156 906.267211

157 906.267170
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

158 906.266989

159 905.455837

160 905.186916
161 
162 905.186824

163 904.257015
164 
165 902.458740
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
166 
167 901.972769

168 901.972737

169 901.972607
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

170 901.972571

171 901.972536
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

172 901.972445

173 901.972382
174 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

175 901.972356
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1853.64 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1852.64 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1853.64 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1852.64 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1853.64 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1852.64 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1853.64 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -1852.64 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

176 901.972216
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

177 901.972119
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
178 
179 901.972033

180 901.972006
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

181 901.971977
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

182 901.971855
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
183 
184 901.971855

185 901.971688
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

186 901.971658

187 901.971626
188 
189 896.551788

190 896.551788

191 896.551430
192 
193 896.551165

194 896.551007

195 896.416400
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

196 896.400017
197 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

198 896.399848
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

199 896.399729
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

200 896.399692
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

201 896.399470

202 896.399333

203 896.399327

204 896.399278

205 896.399006

206 896.398958
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

207 896.342394

208 896.342393
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

209 896.342241
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
210 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

211 896.342235
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

212 896.342100
213 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

214 896.342070
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

215 896.342056
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

216 896.342040

217 896.342037

218 896.341876
219 
220 896.341758
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

221 896.341758
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

222 894.899000
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

223 894.899000

224 894.898957
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

225 894.898884
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

226 894.898838
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

227 894.898756
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

228 894.898695

229 893.942913

230 893.942838
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

231 893.942721
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

232 893.942649
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

233 893.942491

234 893.942390

235 893.942389
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

236 893.942190

237 893.942007
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

238 893.942006

239 893.941947

240 893.941912

241 893.941852

242 893.941833

243 893.941699
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
244 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

245 893.941691
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

246 893.941535

247 893.941300

248 893.941190
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
249 
250 893.941190
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

251 893.318681
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

252 893.092429

253 887.117329
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
254 
255 883.469399
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

256 881.384770

257 881.382125
258 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

259 881.380343
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

260 880.773330

261 880.772390
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

262 874.252296
263 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

264 874.249143
265 
266 874.245916
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

267 874.245204
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

268 874.245091
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

269 874.242061

270 871.098210
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

271 871.097558
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
272 
273 870.655407

274 870.655255

275 870.654785

276 870.652145

277 870.651902

278 870.651013

279 870.650779

280 870.650770

281 859.611377
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
282 
283 858.882297
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -231.705 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -230.705 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
284 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

285 858.881458

286 858.880321

287 858.879460
288 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

289 858.879183
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

290 858.878103

291 858.878032
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

292 858.874694
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
293 Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

294 858.871081
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

295 858.870060
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

296 858.869079
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

297 858.866521

298 858.865542

299 858.863073
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is NaN.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is NaN.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -327.68 is Inf.)
Check function or try again with a different starting value.
Exiting fzero: aborting search for an interval containing a sign change
    because NaN or Inf function value encountered during search.
(Function value at -326.68 is Inf.)
Check function or try again with a different starting value.
no convergence for effect time 

 no convergence within 300 generations 

300 858.862983

p_ga =

    0.0312    1.0000    0.0010    1.0000
    5.7398    1.0000    0.0010   15.0000
    2.0962    1.0000    0.0010    5.0000
    1.6621    1.0000    0.0010   10.0000
    0.0011    1.0000    0.0010   10.0000
    3.0434    1.0000    0.0010   10.0000
    2.7502    1.0000    0.0010   10.0000
   -0.7561    1.0000   -1.0000    1.0000

step 1 dev 858.1927-878.04 initial
step 2 dev 858.1927-870.582 reflect
step 3 dev 858.1927-869.6661 contract inside
step 4 dev 858.1927-866.336 reflect
step 5 dev 858.1927-865.0101 contract inside
step 6 dev 856.5537-862.2021 reflect
step 7 dev 856.5537-861.5638 contract inside
step 8 dev 855.3572-861.1447 expand
step 9 dev 855.3572-861.1135 reflect
step 10 dev 855.3572-860.2764 reflect
step 11 dev 854.3704-858.863 reflect
step 12 dev 852.6642-858.8422 expand
step 13 dev 852.6642-858.1927 reflect
step 14 dev 847.6553-857.4119 expand
step 15 dev 847.6553-856.5537 reflect
step 16 dev 847.6553-855.7574 reflect
step 17 dev 847.6553-855.4588 reflect
step 18 dev 847.6553-855.3572 reflect
step 19 dev 842.9343-854.5424 expand
step 20 dev 842.9343-854.4742 reflect
step 21 dev 842.9343-854.3704 reflect
step 22 dev 842.9343-852.7278 reflect
step 23 dev 842.9343-852.6642 reflect
step 24 dev 837.3623-851.8414 expand
step 25 dev 837.3623-850.5973 reflect
step 26 dev 837.3623-850.3875 reflect
step 27 dev 837.3623-848.635 reflect
step 28 dev 832.6369-848.1238 expand
step 29 dev 827.1343-847.6553 expand
step 30 dev 815.0654-843.271 expand
step 31 dev 815.0654-842.9343 reflect
step 32 dev 815.0654-841.9111 reflect
step 33 dev 815.0654-840.9075 reflect
step 34 dev 804.4245-838.2638 expand
step 35 dev 804.4245-837.3623 reflect
step 36 dev 786.2159-832.6369 expand
step 37 dev 748.4633-827.1343 expand
step 38 dev 748.4633-821.3549 reflect
step 39 dev 748.4633-820.4593 reflect
step 40 dev 748.4633-818.4212 reflect
step 41 dev 748.4633-815.0654 reflect
step 42 dev 736.1242-805.9299 reflect
step 43 dev 736.1242-804.4245 reflect
step 44 dev 736.1242-787.938 reflect
step 45 dev 736.1242-786.2159 reflect
step 46 dev 730.093-770.6417 reflect
step 47 dev 730.093-757.4049 reflect
step 48 dev 730.093-757.3125 reflect
step 49 dev 730.093-755.3011 contract inside
step 50 dev 730.093-753.9084 contract inside
step 51 dev 715.1694-748.4633 expand
step 52 dev 715.1694-744.679 contract inside
step 53 dev 715.1694-742.673 reflect
step 54 dev 715.1694-739.7922 reflect
step 55 dev 714.2578-736.1242 reflect
step 56 dev 712.1072-735.4003 reflect
step 57 dev 712.1072-733.1545 contract inside
step 58 dev 712.1072-732.0781 reflect
step 59 dev 703.9354-730.093 reflect
step 60 dev 703.9354-725.9123 reflect
step 61 dev 703.9354-722.6761 reflect
step 62 dev 703.9354-720.6993 reflect
step 63 dev 703.9354-718.2719 contract inside
step 64 dev 703.9354-715.1694 reflect
step 65 dev 703.9354-714.2578 reflect
step 66 dev 703.9354-713.8996 contract inside
step 67 dev 703.9354-713.3347 contract inside
step 68 dev 703.9354-712.1072 reflect
step 69 dev 700.5338-711.8084 reflect
step 70 dev 700.5338-711.6636 contract inside
step 71 dev 700.5338-710.2869 reflect
step 72 dev 700.5338-710.0485 reflect
step 73 dev 700.5338-709.9373 contract inside
step 74 dev 700.5338-707.7859 contract outside
step 75 dev 700.5338-707.2964 reflect
step 76 dev 700.3068-706.5687 reflect
step 77 dev 700.3068-705.8325 contract inside
step 78 dev 700.3068-704.9264 reflect
step 79 dev 700.3068-704.8371 reflect
step 80 dev 700.3068-704.1926 contract inside
step 81 dev 700.3068-704.0723 reflect
step 82 dev 700.3068-703.9989 contract inside
step 83 dev 700.3068-703.9354 reflect
step 84 dev 700.3068-703.7994 reflect
step 85 dev 700.3068-703.5654 reflect
step 86 dev 700.3068-702.8444 reflect
step 87 dev 700.3068-702.4944 reflect
step 88 dev 700.3068-702.1475 contract outside
step 89 dev 700.3068-701.8461 reflect
step 90 dev 700.3068-701.7321 contract inside
step 91 dev 699.3254-701.2491 reflect
step 92 dev 699.3254-701.0144 contract inside
step 93 dev 699.3254-700.8192 reflect
step 94 dev 699.3254-700.6958 reflect
step 95 dev 699.3254-700.5715 contract inside
step 96 dev 699.3254-700.5338 reflect
step 97 dev 699.3254-700.4544 reflect
step 98 dev 698.5627-700.3068 expand
step 99 dev 698.5627-700.1188 reflect
step 100 dev 698.5627-700.0192 contract outside
step 101 dev 698.5627-699.8743 contract outside
step 102 dev 698.5627-699.8525 contract inside
step 103 dev 698.5627-699.7884 reflect
step 104 dev 698.5627-699.7254 reflect
step 105 dev 698.5627-699.723 reflect
step 106 dev 698.5627-699.5087 reflect
step 107 dev 698.5627-699.3254 contract inside
step 108 dev 698.3029-699.2587 reflect
step 109 dev 698.3029-699.2489 reflect
step 110 dev 698.3029-699.1874 reflect
step 111 dev 698.3029-699.1488 contract inside
step 112 dev 698.3029-699.1044 reflect
step 113 dev 698.3029-698.863 reflect
step 114 dev 698.3029-698.8533 reflect
step 115 dev 698.3029-698.7742 contract inside
step 116 dev 698.1447-698.6499 reflect
step 117 dev 698.1447-698.6466 reflect
step 118 dev 698.1447-698.6151 reflect
step 119 dev 698.1447-698.6071 contract inside
step 120 dev 698.1447-698.5627 contract inside
step 121 dev 697.9751-698.4427 reflect
step 122 dev 697.734-698.3794 expand
step 123 dev 697.734-698.3431 reflect
step 124 dev 697.734-698.3029 reflect
step 125 dev 697.734-698.2806 contract inside
step 126 dev 697.734-698.2739 reflect
step 127 dev 697.2827-698.2283 expand
step 128 dev 697.2827-698.1914 reflect
step 129 dev 697.2827-698.1447 reflect
step 130 dev 697.2827-698.1153 reflect
step 131 dev 697.2827-698.0557 reflect
step 132 dev 697.2827-698.041 reflect
step 133 dev 697.2827-698.0265 reflect
step 134 dev 697.2827-698.0191 reflect
step 135 dev 697.2827-697.9751 reflect
step 136 dev 673.0022-697.9465 expand
step 137 dev 673.0022-697.8294 reflect
step 138 dev 673.0022-697.734 reflect
step 139 dev 673.0022-697.7305 reflect
step 140 dev 673.0022-697.5019 reflect
step 141 dev 673.0022-697.4497 reflect
step 142 dev 673.0022-697.3541 reflect
step 143 dev 673.0022-697.2827 reflect
step 144 dev 662.7001-692.6639 expand
step 145 dev 662.7001-691.1199 reflect
step 146 dev 662.7001-689.6761 reflect
step 147 dev 659.303-689.4071 expand
step 148 dev 659.303-682.7038 reflect
step 149 dev 659.303-676.2619 reflect
step 150 dev 632.5819-675.8074 expand
step 151 dev 632.5819-673.0022 reflect
step 152 dev 632.4029-668.6002 reflect
step 153 dev 630.8542-664.3036 reflect
step 154 dev 630.8542-662.7001 reflect
step 155 dev 629.1627-661.1031 reflect
step 156 dev 629.1627-660.1892 reflect
step 157 dev 629.1627-659.303 reflect
step 158 dev 629.1627-638.516 contract outside
step 159 dev 629.1627-637.6033 contract outside
step 160 dev 629.1627-637.5692 contract inside
step 161 dev 629.1627-634.4947 reflect
step 162 dev 627.8742-632.7753 expand
step 163 dev 627.489-632.5819 reflect
step 164 dev 627.489-632.4029 contract inside
step 165 dev 627.489-631.7981 contract inside
step 166 dev 627.489-630.9072 reflect
step 167 dev 626.338-630.8542 reflect
step 168 dev 626.338-630.4742 reflect
step 169 dev 625.3708-630.3332 reflect
step 170 dev 625.3708-630.2969 contract inside
step 171 dev 621.7342-629.1627 expand
step 172 dev 621.7342-627.9467 reflect
step 173 dev 621.7342-627.8742 reflect
step 174 dev 621.7342-627.489 contract inside
step 175 dev 621.7342-626.5599 reflect
step 176 dev 621.7342-626.4417 reflect
step 177 dev 621.6385-626.338 reflect
step 178 dev 621.6385-625.8598 contract inside
step 179 dev 621.6385-625.7678 contract inside
step 180 dev 621.6385-625.7485 contract inside
step 181 dev 621.6385-625.4896 reflect
step 182 dev 621.6385-625.3821 reflect
step 183 dev 621.6385-625.3708 reflect
step 184 dev 618.221-625.0334 expand
step 185 dev 618.221-624.5002 reflect
step 186 dev 618.221-624.3951 reflect
step 187 dev 618.221-624.02 contract inside
step 188 dev 618.221-623.447 reflect
step 189 dev 618.221-623.276 reflect
step 190 dev 618.221-621.9116 contract outside
step 191 dev 618.221-621.8496 reflect
step 192 dev 618.221-621.7342 reflect
step 193 dev 615.6176-621.6385 expand
step 194 dev 615.6176-620.7171 reflect
step 195 dev 615.6176-620.5304 reflect
step 196 dev 615.6176-620.3571 reflect
step 197 dev 615.6176-620.2728 reflect
step 198 dev 613.6534-618.7471 expand
step 199 dev 613.6534-618.5299 reflect
step 200 dev 613.6534-618.221 reflect
step 201 dev 612.9535-617.4012 expand
step 202 dev 609.776-616.603 expand
step 203 dev 609.776-616.1091 reflect
step 204 dev 609.776-616.0244 reflect
step 205 dev 609.776-615.8095 reflect
step 206 dev 609.776-615.7869 reflect
step 207 dev 609.776-615.6176 reflect
step 208 dev 609.776-613.7086 contract inside
step 209 dev 609.776-613.6534 reflect
step 210 dev 609.776-612.9955 reflect
step 211 dev 609.776-612.9948 contract inside
step 212 dev 609.3899-612.9535 expand
step 213 dev 609.3899-612.5605 reflect
step 214 dev 609.3899-612.5047 reflect
step 215 dev 608.9334-612.3735 reflect
step 216 dev 608.9334-611.3939 reflect
step 217 dev 608.9334-610.7219 contract outside
step 218 dev 608.9334-610.6036 reflect
step 219 dev 608.8199-610.2577 reflect
step 220 dev 608.7568-610.1695 contract inside
step 221 dev 608.7568-609.776 contract inside
step 222 dev 608.7568-609.6085 reflect
step 223 dev 608.0929-609.4654 reflect
step 224 dev 606.9648-609.3899 expand
step 225 dev 606.9648-608.9902 reflect
step 226 dev 606.9648-608.9833 reflect
step 227 dev 606.9648-608.9334 reflect
step 228 dev 606.9648-608.8199 reflect
step 229 dev 606.9648-608.7761 reflect
step 230 dev 606.6985-608.7568 reflect
step 231 dev 606.6985-608.5405 reflect
step 232 dev 606.6985-608.3917 reflect
step 233 dev 606.6985-608.0929 contract outside
step 234 dev 605.039-607.69 expand
step 235 dev 605.039-607.2384 reflect
step 236 dev 605.039-607.1567 reflect
step 237 dev 605.039-607.1377 reflect
step 238 dev 605.039-607.1261 contract inside
step 239 dev 605.039-607.1044 reflect
step 240 dev 605.039-606.9648 reflect
step 241 dev 604.9395-606.7543 reflect
step 242 dev 604.9395-606.6985 reflect
step 243 dev 604.7685-606.314 reflect
step 244 dev 604.1275-606.3101 expand
step 245 dev 602.7002-605.9053 expand
step 246 dev 602.7002-605.8288 reflect
step 247 dev 602.7002-605.3665 reflect
step 248 dev 602.7002-605.039 reflect
step 249 dev 602.7002-605.0066 reflect
step 250 dev 602.4951-604.9395 reflect
step 251 dev 601.9311-604.7685 expand
step 252 dev 601.9311-604.2646 reflect
step 253 dev 601.6916-604.1376 reflect
step 254 dev 601.6916-604.1275 contract inside
step 255 dev 601.6916-603.9212 reflect
step 256 dev 601.3558-603.9124 reflect
step 257 dev 600.8671-603.7731 reflect
step 258 dev 600.8671-602.7965 reflect
step 259 dev 600.8671-602.7002 reflect
step 260 dev 600.8671-602.6984 reflect
step 261 dev 600.0336-602.5954 expand
step 262 dev 600.0336-602.4951 contract inside
step 263 dev 600.0197-601.9311 reflect
step 264 dev 599.9637-601.6916 reflect
step 265 dev 599.9637-601.3558 reflect
step 266 dev 599.7384-601.2237 reflect
step 267 dev 599.7344-601.1132 reflect
step 268 dev 599.6715-601.0423 reflect
step 269 dev 599.4149-600.8671 reflect
step 270 dev 598.9632-600.4055 reflect
step 271 dev 598.9419-600.0336 reflect
step 272 dev 598.9419-600.0197 reflect
step 273 dev 598.9419-599.9637 contract inside
step 274 dev 598.9419-599.7384 reflect
step 275 dev 598.9419-599.7344 reflect
step 276 dev 598.9419-599.6715 reflect
step 277 dev 598.3205-599.4837 reflect
step 278 dev 598.3205-599.4469 contract inside
step 279 dev 598.3205-599.4149 reflect
step 280 dev 598.3205-599.4019 reflect
step 281 dev 598.3205-599.3981 contract inside
step 282 dev 598.3205-599.2377 contract outside
step 283 dev 598.3205-599.2321 reflect
step 284 dev 598.3205-599.0308 contract inside
step 285 dev 598.3205-598.9632 reflect
step 286 dev 598.3205-598.9479 reflect
step 287 dev 598.3205-598.9419 contract inside
step 288 dev 598.3205-598.9376 reflect
step 289 dev 598.3205-598.8938 reflect
step 290 dev 598.3205-598.832 contract inside
step 291 dev 598.3205-598.8169 reflect
step 292 dev 598.3205-598.8062 reflect
step 293 dev 598.3205-598.7299 reflect
step 294 dev 598.315-598.6941 reflect
step 295 dev 598.315-598.6343 reflect
step 296 dev 598.315-598.6284 reflect
step 297 dev 598.1784-598.595 reflect
step 298 dev 598.1784-598.5628 reflect
step 299 dev 598.1784-598.5305 reflect
step 300 dev 598.1784-598.4503 reflect
No convergences with 300 steps

p_nm =

    0.0193    1.0000    0.0010    1.0000
    3.1168    1.0000    0.0010   15.0000
    2.0775    1.0000    0.0010    5.0000
    0.3544    1.0000    0.0010   10.0000
    0.0025    1.0000    0.0010   10.0000
    3.1823    1.0000    0.0010   10.0000
    3.1241    1.0000    0.0010   10.0000
    0.0350    1.0000   -1.0000    1.0000

step 1 norm 350576.457 dev 598.1784
step 2 norm 34869.634 dev 582.3809
step 3 norm 283.3995 dev 580.6772
step 4 norm 0.21485 dev 580.657
step 5 norm 0.00062349 dev 580.6568
step 6 norm 3.8048e-05 dev 580.6568
step 7 norm 1.8655e-06 dev 580.6568
step 8 norm 8.1091e-08 dev 580.6568
step 9 norm 3.48e-09 dev 580.6568

p_sc =

    0.0185    1.0000    0.0010    1.0000
    3.0907    1.0000    0.0010   15.0000
    2.0868    1.0000    0.0010    5.0000
    0.3171    1.0000    0.0010   10.0000
    0.0423    1.0000    0.0010   10.0000
    4.4216    1.0000    0.0010   10.0000
    3.8052    1.0000    0.0010   10.0000
    0.0089    1.0000   -1.0000    1.0000


ans =

    0.0312    0.0193    0.0185
    5.7398    3.1168    3.0907
    2.0962    2.0775    2.0868
    1.6621    0.3544    0.3171
    0.0011    0.0025    0.0423
    3.0434    3.1823    4.4216
    2.7502    3.1241    3.8052
   -0.7561    0.0350    0.0089

</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
% created: 2006/08/14 by <NAME>
% sample data for surv3 routines

%% set par values for binary mixture toxicants
h0 = .016;    % 1/h, blank mortality prob rate (always >0)
CA0 = 3.10;   % mM, No-Effect-Concentration for A (external, may be zero)
CB0 = 1.13;   % mM, No-Effect-Concentration for B (external, may be zero)
bA = 0.29;    % 1/(h*mM), killing rate for A
bB = 0.024;   % 1/(h*mM), killing rate for B
kA = 5.0;     % 1/h, elimination rate for A
kB = 1.7;     % 1/h, elimination rate for B
dAB = 0.00;   % 1/(h*mM^2), interaction rate for A and B

p1 = [  h0;  CA0; CB0;   bA;   bB;   kA;  kB;   dAB]; % collect par values
p2 = [   1;    1;   1;    1;    1;    1;    1;    1]; % iteration indicator
p3 = [.001; .001;.001; .001; .001; .001; .001;   -1]; % lower boundary
p4 = [   1;   15;   5;   10;   10;   10;   10;    1]; % upper boundary

par = [p1,p2,p3,p4]; % compose parameter input matrix
% values in first column are ignored in ga-algorothm

t = [0:21]'; % set time points
c1 = [0;0.4;0.8;1.6;3.2;6.4;12.8]; % set conc first toxicant
c2 = [0;0.2;0.4;0.8;1.6;3.2];      % set conc second toxicant

% H = haz_fomort2(par,t,c1,c2);
S = fomort2(p1,t,c1,c2); % get survival probabilities

Z = surv_count(20,S);% get Monte Carlo data using 20 ind per conc-combination

%% set genetic algorithm parameters
gasurv_options('max_step_number',300);
gasurv_options('popSize',500);
% ga-algorithm: slow but robust
p_ga = gasurv3('fomort2',par,t,c1,c2,Z)  % par estimate using genetic algorithm
% nm-algorithm: faster but less robust (and more local)
p_nm = nmsurv3('fomort2',p_ga,t,c1,c2,Z) % par estimate using nead-melder
% scoring method: very fast but also very senbsitive for initial conditions
p_sc = scsurv3('fomort2',p_nm,t,c1,c2,Z) % par estimate using scoring method

[p_ga(:,1), p_nm(:,1), p_sc(:,1)] % compare results

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/deb/EBTasj.c<|end_filename|>
/***
  NAME
    EBTasj.c
    asj DEB model with reprod buffer handling: lay egg as soon as buffer allows
***/

/*==========================================================================
 * INCLUDING THE HEADER FILE & splines for temp correction and food input
 *==========================================================================
 */

#include "escbox.h"
#include "spline_TC.c"
#include "spline_JX.c"

/*
 *==========================================================================
 * LABELLING ENVIRONMENT AND I-STATE VARIABLES
 *==========================================================================
 */

#define time env[0] /* d                              */
#define food env[1] /* -, scaled food density x = X/K */

#define age i_state(0)         /*  1/d   */
#define accel i_state(1)       /* 1/d^2  */
#define ageHaz i_state(2)      /*  1/d   */
#define length i_state(3)      /*   cm   */
#define resDens i_state(4)     /* J/cm^3 */
#define reprodBuf i_state(5)   /*   J    */
#define maturity i_state(6)    /*   J    */
#define weight i_state(7)      /*   g    */

/*
 *==========================================================================
 * DEFINING AND LABELLING CONSTANTS AND PARAMETERS
 *==========================================================================
 */

#define E_Hp   parameter[0]   /*    J       */
#define E_Hj   parameter[1]   /*    J       */
#define E_Hs   parameter[2]   /*    J       */
#define E_Hb   parameter[3]   /*    J       */
#define V_X    parameter[4]   /*    L       */
#define h_X    parameter[5]   /*   1/d      */
#define h_J    parameter[6]   /*   1/d      */
#define h_B0b  parameter[7]   /*   1/d      */
#define h_Bbs  parameter[8]   /*   1/d      */
#define h_Bsj  parameter[9]   /*   1/d      */
#define h_Bjp  parameter[10]  /*   1/d      */
#define h_Bpi  parameter[11]  /*   1/d      */
#define h_a    parameter[12]  /*   1/d      */
#define s_G    parameter[13]  /*    -       */
#define thin   parameter[14]  /*    -       */
#define L_m    parameter[15]  /*   cm       */
#define E_m    parameter[16]  /*  J/cm^3    */
#define k_J    parameter[17]  /*   1/d      */
#define k_JX   parameter[18]  /*   1/d      */
#define v      parameter[19]  /*   cm/d     */
#define g      parameter[20]  /*    -       */
#define p_M    parameter[21]  /* J/d.cm^3   */
#define p_Am   parameter[22]  /* J/d.cm^2   */
#define J_X_Am parameter[23]  /* mol/d.cm^2 */
#define K      parameter[24]  /*   mol/L    */
#define kap    parameter[25]  /*     -      */
#define kap_G  parameter[26]  /*     -      */
#define ome    parameter[27]  /*     -      */
#define E_0    parameter[28]  /*     J      */
#define L_b    parameter[29]  /*    cm      */
#define L_s    parameter[20]  /*    cm      */
#define L_j    parameter[31]  /*    cm      */
#define a_b    parameter[32]  /*     d      */
#define aT_b   parameter[33]  /*     d      */
#define q_b    parameter[34]  /*    1/d^2   */
#define qT_b   parameter[35]  /*    1/d^2   */
#define h_Ab   parameter[36]  /*    1/d     */
#define hT_Ab  parameter[37]  /*    1/d     */

/*
 *==========================================================================
 * USER INITIALIZATION ROUTINE ALLOWS OPERATIONS ON INITIAL POPULATIONS
 *==========================================================================
 */

void UserInit( int argc, char **argv, double *env, population *pop)
{
  return;
}

/*
 *==========================================================================
 * SPECIFICATION OF THE NUMBER AND VALUES OF BOUNDARY POINTS
 *==========================================================================
 */

void SetBpointNo(double *env, population *pop, int *bpoint_no)
{
  bpoint_no[0] = 1; /* all individuals start with the same age */

  return;
}

/*==========================================================================*/

void SetBpoints(double *env, population *pop, population *bpoints)
{
  bpoints[0][0][age]       = 0.0;
  bpoints[0][0][accel]     = qT_b;
  bpoints[0][0][ageHaz]    = hT_Ab;
  bpoints[0][0][length]    = L_b;
  bpoints[0][0][resDens]   = E_m;
  bpoints[0][0][maturity]  = E_Hb;
  bpoints[0][0][reprodBuf] = 0.0;
  bpoints[0][0][weight]    = L_b * L_b * L_b * (1 + ome);

  return;
}

/*==========================================================================*/

void EventLocation(double *env, population *pop, population *ofs, population *bpoints, double *events)
{ 
  register int i;
  
  events[0] = 1.0; events[1] = 1.0; events[2] = 1.0; events[3] = 1.0;
  for (i=0; i<cohort_no[0]; i++)
  {
    events[0] = fabs(pop[0][i][age]-aT_b)<fabs(events[0]) ? pop[0][i][age] - aT_b : events[0];
    events[1] = fabs(pop[0][i][maturity]-E_Hs)<fabs(events[1]) ? pop[0][i][maturity] - E_Hs : events[1];
    events[2] = fabs(pop[0][i][maturity]-E_Hj)<fabs(events[1]) ? pop[0][i][maturity] - E_Hj : events[2];
    events[3] = fabs(pop[0][i][maturity]-E_Hp)<fabs(events[1]) ? pop[0][i][maturity] - E_Hp : events[3];
  }
}

/*==========================================================================*/

 int ForceCohortEnd(double *env, population *pop, population *ofs, population *bpoints)
 { 
   return NO_COHORT_END;
 }

 /*==========================================================================
 * SPECIFICATION OF DERIVATIVES
 *==========================================================================
 */

void Gradient(double *env, population *pop, population *ofs, double *envgrad, population *popgrad, population *ofsgrad, population *bpoints)
{
  double sumL2, TC, s_M, kT_J, kT_JX, vT, pT_Am, p_A, p_J, p_C, p_R, h_thin, hT_X, hT_J, hT_a, JT_X_Am, r, f, e, hazard, L, L2, L3, kapG;
  register int i;

  /* temp correction */
  TC = spline_TC(time); 
  kT_J = k_J * TC; kT_JX = k_JX * TC; vT = v * TC; pT_Am = TC * p_Am; JT_X_Am = TC * J_X_Am; aT_b = a_b/ TC;
  hT_X = h_X * TC; hT_J = TC * h_J; hT_a = h_a * TC * TC; hT_Ab = h_Ab * TC; qT_b = q_b * TC * TC; 
  
  /* scaled functional response, food = scaled food density */
  f = food/ (food + 1);  

  /* The derivatives for the boundary cohort */
  ofsgrad[0][0][number]    = - h_B0b * ofs[0][0][number];        /*   */
  ofsgrad[0][0][age]       = 1.0;                                /* 0 */
  ofsgrad[0][0][accel]     = 0.0;                                /* 1 */
  ofsgrad[0][0][ageHaz]    = 0.0;                                /* 2 */
  ofsgrad[0][0][length]    = 0.0;                                /* 3 */
  ofsgrad[0][0][resDens]   = 0.0;                                /* 4 */
  ofsgrad[0][0][maturity]  = 0.0;                                /* 5 */
  ofsgrad[0][0][reprodBuf] = 0.0;                                /* 6 */
  ofsgrad[0][0][weight]    = 0.0;                                /* 7 */
          
  /* The derivatives for all internal cohorts */
  for(i=0; i<cohort_no[0]; i++) 
    { 
      /* help quantities */
      e = pop[0][i][resDens]/ E_m;                                /* -, scaled reserve density e = [E]/[E_m] */
      L = pop[0][i][length]; L2 = L * L; L3 = L * L2;             /* cm, struc length */
      if      (L<L_s) s_M = 1;                                    /* -, acceleration factor */
      else if (L<L_j) s_M = L/ L_s;                               /* -, acceleration factor */
      else            s_M = L_j/ L_s;                             /* -, acceleration factor */
      kapG = e>=L/L_m ? 1. : kap_G;                               /* kap_G if shrinking, else 1 */
      r = s_M * vT * (e/ L - 1./ L_m)/ (e + kapG * g);            /* 1/d, spec growth rate of structure */
      p_J = kT_J * pop[0][i][maturity];                           /* J/d, maturity maintenance */
      p_C = L3 * e * E_m * (s_M * vT/ L - r);                     /* J/d, reserve mobilisation rate */
      p_R = (1.-kap)*p_C>p_J ? (1. - kap) * p_C - p_J : 0;        /* J/d, flux to maturation or reprod */
      p_A = s_M * pT_Am * f * L2;                                 /* J/d, assimilation flux (overwritten for embryo's) */
      h_thin = 0.;                                                /* 1/d, thinning hazard */
      if (thin==1.) h_thin = pop[0][i][maturity]>E_Hs & pop[0][i][maturity]<E_Hj ? r : r * 2./3.; /* 1/d, thinning hazard */
      if      (pop[0][i][maturity]<E_Hs) hazard = pop[0][i][ageHaz] + h_Bbs + h_thin; 
      else if (pop[0][i][maturity]<E_Hj) hazard = pop[0][i][ageHaz] + h_Bsj + h_thin; 
      else if (pop[0][i][maturity]<E_Hp) hazard = pop[0][i][ageHaz] + h_Bjp + h_thin; 
      else                               hazard = pop[0][i][ageHaz] + h_Bpi + h_thin;
      
      popgrad[0][i][number]    = - hazard * pop[0][i][number];                                                                 /*   */
      popgrad[0][i][age]       = 1.0;                                                                                          /* 0 */
      popgrad[0][i][accel]     = (pop[0][i][accel] * s_G * L3/ L_m/ L_m/ L_m + hT_a) * e * (s_M * vT/ L - r) - r * pop[0][i][accel]; /* 1 */
      popgrad[0][i][ageHaz]    = pop[0][i][accel] - r * pop[0][i][ageHaz];                                                     /* 2 */
      popgrad[0][i][length]    = L * r/ 3.;                                                                                    /* 3 */
      popgrad[0][i][resDens]   = s_M * (p_A/ L3 - vT * e * E_m/ L); /* J/d.cm^3, change in reserve density [E] */              /* 4 */
      popgrad[0][i][maturity]  = pop[0][i][maturity] < E_Hp ? p_R : 0.;                                                        /* 5 */
      popgrad[0][i][reprodBuf] = pop[0][i][maturity] >= E_Hp ? p_R : 0.;                                                       /* 6 */
      popgrad[0][i][weight]    = 3. * L2 * popgrad[0][i][length] * (1. + ome * e) + L3 * ome * popgrad[0][i][resDens]/ E_m;    /* 7 */
      
      /* overwrite changes for embryo's since i-states other than age are already set at birth values */
      if (pop[0][i][age] < aT_b)
        {
          popgrad[0][i][number]    = - h_B0b * pop[0][i][number]; /* background hazard only */
          popgrad[0][i][accel]     = 0.;
          popgrad[0][i][ageHaz]    = 0.;
          popgrad[0][i][length]    = 0.;
          popgrad[0][i][resDens]   = 0.;
          popgrad[0][i][maturity]  = 0.;
          popgrad[0][i][reprodBuf] = 0.;
          popgrad[0][i][weight]    = 0.;
        }
    }
  
  /* The derivatives of environmental vars: time & scaled food density */
  envgrad[0] = 1.0; /* 1/d, change in time */
  for(i=0, sumL2 = 0.; i<cohort_no[0]; i++) sumL2 += pop[0][i][age]>aT_b ? pop[0][i][number] * pow(pop[0][i][length], 2.0) : 0; 
  envgrad[1] = spline_JX(time)/ V_X/ K - hT_X * food - JT_X_Am * f * sumL2/ V_X/ K; /* 1/d, change in scaled food density */
    
  return;
}

/*
 *==========================================================================
 * SPECIFICATION OF BETWEEN COHORT CYCLE DYNAMICS
 *==========================================================================
 */

void InstantDynamics(double *env, population *pop, population *ofs)
{
  double eggs;
  register int i;

  for (i=0, eggs=0.0; i<cohort_no[0]; i++)
    if (pop[0][i][reprodBuf] > E_0)
      {
        eggs += pop[0][i][number] * pop[0][i][reprodBuf]/ E_0; /* add all eggs */
        pop[0][i][reprodBuf] = 0.0; /* reset reproduction buffer */
      }
  
  /* specify i-states at birth, because changes are set to 0, except for age */
  ofs[0][0][number]    = eggs; /* put eggs into ofs cohort */
  ofs[0][0][age]       = 0.0;  
  ofs[0][0][accel]     = qT_b;
  ofs[0][0][ageHaz]    = hT_Ab;
  ofs[0][0][length]    = L_b;
  ofs[0][0][resDens]   = E_m;
  ofs[0][0][maturity]  = E_Hb;
  ofs[0][0][reprodBuf] = 0.0;
  ofs[0][0][weight]    = L_b * L_b * L_b * (1 + ome);
  
  return;
}

/*
 *==========================================================================
 * SPECIFICATION OF OUTPUT VARIABLES
 *==========================================================================
 */

void DefineOutput(double *env, population *pop, double *output)
{

  double totN, totL, totL2, totL3, totW;
  register int i;

  for(i=0, totN=0.0, totL=0.0, totL2=0.0, totL3=0.0, totW=0.0; i<cohort_no[0]; i++)
    {
      totN  += pop[0][i][number];
      totL  += pop[0][i][number] * pop[0][i][length];
      totL2 += pop[0][i][number] * pow(pop[0][i][length], 2);
      totL3 += pop[0][i][number] * pow(pop[0][i][length], 3);
      totW  += pop[0][i][number] * pop[0][i][weight];
    }

  output[0] = food;
  output[1] = totN;
  output[2] = totL;
  output[3] = totL2;
  output[4] = totL3;
  output[5] = totW;

  return;
}
/*==========================================================================*/


<|start_filename|>lib/regr/html/pregr_st.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>pregr_st</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="pregr_st.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h2>Contents</h2><div><ul><li><a href="#3">Description</a></li><li><a href="#4">Input</a></li><li><a href="#5">Output</a></li><li><a href="#6">Code</a></li></ul></div><pre class="codeinput"><span class="keyword">function</span> [cov, cor, sd, ss] = pregr_st (func, p, st)
</pre><pre class="codeinput">  <span class="comment">% created: 2010/05/08 by <NAME>; modified: 2013/05/02 by Gon&ccedil;<NAME></span>
  <span class="comment">%</span>
</pre><h2>Description<a name="3"></a></h2><pre>calculates covariance and correlation matrix of parameters
 standard deviation and sum of squared deviations
 of model predictions with respect to observations</pre><h2>Input<a name="4"></a></h2><pre>func: character string with name of user-defined function
  see nrregr_st or nrregr
p: (np,2) matrix with
  p(:,1) parameter values
  p(:,2) binaries with yes or no conditional values
  all conditional parameters have zero (co)variance
st: (ni,3) structure with
  st.nm(:,1) independent variable
  st.nm(:,2) dependent variable
  st.nm(:,3) weight coefficients (optional)
  The number of data matrices in st fields is optional
  The first data matrix is assumed to be zero-variate,
    the others uni-variate, which are first reduced to zero-variate data
    if all weight coefficients in a uni-variate data-set are zero,
    that relative error gets weight zero</pre><h2>Output<a name="5"></a></h2><pre>cov: (np,np) matrix with covariances
cor: (np,np) matrix with correlation coefficients
sd: (np,1) matrix with standard deviations
ss: scalar with weighted sum of squared deviations</pre><h2>Code<a name="6"></a></h2><pre class="codeinput">  <span class="keyword">global</span> index

  [nm nst] = fieldnmnst_st(st);

  i = 1; <span class="comment">% initiate data set counter</span>
  <span class="keyword">while</span> (i &lt;= nst) <span class="comment">% loop across data sets</span>
    eval([<span class="string">'[n('</span>, num2str(i), <span class="string">'), k] = size(st.'</span>, nm{i}, <span class="string">');'</span>]); <span class="comment">% number of data points</span>
    <span class="keyword">if</span> i == 1
      eval([<span class="string">'Y = st.'</span>, nm{i}, <span class="string">'(:,2);'</span>]); <span class="comment">% initiate dependent variables</span>
      <span class="keyword">if</span> k &gt; 2
	    eval([<span class="string">'W = st.'</span>, nm{i}, <span class="string">'(:,3);'</span>]); <span class="comment">% initiate weight coefficients</span>
      <span class="keyword">else</span>
	    W = ones(n(1),1);
      <span class="keyword">end</span>
    <span class="keyword">else</span>
      eval([<span class="string">'Y = [Y;st.'</span>, nm{i}, <span class="string">'(:,2)];'</span>]); <span class="comment">% append dependent variables</span>
      <span class="keyword">if</span> k &gt; 2
	    eval([<span class="string">'W = [W;st.'</span>, nm{i}, <span class="string">'(:,3)];'</span>]); <span class="comment">% append weight coefficients</span>
      <span class="keyword">else</span>
	    W = [W; ones(n(i), 1)]; <span class="comment">% append weight coefficients</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>
    i = i + 1;
  <span class="keyword">end</span>

  W = W/ sum(W); <span class="comment">% sum of weight coefficients set equal to 1</span>

  [np, k] = size(p); <span class="comment">% np: number of parameters</span>
  index = 1:np;
  <span class="keyword">if</span> k&gt;1
    index = index(1 == p(:,2)); <span class="comment">% indices of iterated parameters</span>
  <span class="keyword">end</span>
  n_pars = size(index, 2);  <span class="comment">% number of parameters that must be iterated</span>
  <span class="keyword">if</span> (n_pars == 0)
    <span class="keyword">return</span>; <span class="comment">% no parameters to iterate</span>
  <span class="keyword">end</span>

  [f, df] = nrdregr_st(func, p(:,1), st);
  ss = W' * (f - Y) .^ 2;
  cov = zeros(np, np);
  cov(index, index) = inv(df' * (df .* W(:, ones(1, n_pars))));
  n = sum(df ~= 0); <span class="comment">% number of data points that contributed to the parameter</span>
  cov(index, index) = cov(index, index) * ss ./ sqrt(n' * n);
  sd = sqrt(diag(cov));
  cor = zeros(np, np);
  cor(index, index) = cov(index, index) ./ (sd(index) * sd(index)');
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function [cov, cor, sd, ss] = pregr_st (func, p, st)
  % created: 2010/05/08 by <NAME>; modified: 2013/05/02 by <NAME>
  %
  %% Description
  %  calculates covariance and correlation matrix of parameters
  %   standard deviation and sum of squared deviations
  %   of model predictions with respect to observations
  %
  %% Input
  %  func: character string with name of user-defined function
  %    see nrregr_st or nrregr
  %  p: (np,2) matrix with
  %    p(:,1) parameter values
  %    p(:,2) binaries with yes or no conditional values
  %    all conditional parameters have zero (co)variance
  %  st: (ni,3) structure with
  %    st.nm(:,1) independent variable
  %    st.nm(:,2) dependent variable
  %    st.nm(:,3) weight coefficients (optional)
  %    The number of data matrices in st fields is optional
  %    The first data matrix is assumed to be zero-variate, 
  %      the others uni-variate, which are first reduced to zero-variate data
  %      if all weight coefficients in a uni-variate data-set are zero,
  %      that relative error gets weight zero
  %  
  %% Output
  %  cov: (np,np) matrix with covariances
  %  cor: (np,np) matrix with correlation coefficients
  %  sd: (np,1) matrix with standard deviations
  %  ss: scalar with weighted sum of squared deviations
  
  %% Code    
  global index
  
  [nm nst] = fieldnmnst_st(st);
  
  i = 1; % initiate data set counter
  while (i <= nst) % loop across data sets
    eval(['[n(', num2str(i), '), k] = size(st.', nm{i}, ');']); % number of data points
    if i == 1
      eval(['Y = st.', nm{i}, '(:,2);']); % initiate dependent variables
      if k > 2
	    eval(['W = st.', nm{i}, '(:,3);']); % initiate weight coefficients
      else
	    W = ones(n(1),1);
      end
    else     
      eval(['Y = [Y;st.', nm{i}, '(:,2)];']); % append dependent variables
      if k > 2
	    eval(['W = [W;st.', nm{i}, '(:,3)];']); % append weight coefficients
      else
	    W = [W; ones(n(i), 1)]; % append weight coefficients
      end
    end
    i = i + 1;
  end

  W = W/ sum(W); % sum of weight coefficients set equal to 1

  [np, k] = size(p); % np: number of parameters
  index = 1:np;
  if k>1
    index = index(1 == p(:,2)); % indices of iterated parameters
  end
  n_pars = size(index, 2);  % number of parameters that must be iterated
  if (n_pars == 0)
    return; % no parameters to iterate
  end
     
  [f, df] = nrdregr_st(func, p(:,1), st);
  ss = W' * (f - Y) .^ 2;
  cov = zeros(np, np);
  cov(index, index) = inv(df' * (df .* W(:, ones(1, n_pars))));
  n = sum(df ~= 0); % number of data points that contributed to the parameter
  cov(index, index) = cov(index, index) * ss ./ sqrt(n' * n);
  sd = sqrt(diag(cov));
  cor = zeros(np, np);
  cor(index, index) = cov(index, index) ./ (sd(index) * sd(index)');

##### SOURCE END #####
--></body></html>

<|start_filename|>lib/regr/html/shsurv.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>shsurv</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-09"><meta name="DC.source" content="shsurv.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><pre class="codeinput"><span class="keyword">function</span> shsurv (func, p, varin)
  <span class="comment">%  created: 2002/02/10 by <NAME></span>
  <span class="comment">%</span>
<span class="comment">  %% Description</span>
  <span class="comment">%  plots observed survivors and model predictions</span>
  <span class="comment">%  func: character string with name of user-defined function</span>
  <span class="comment">%    see scsurv</span>
  <span class="comment">%  p: (r,k) matrix with parameter values in p(:,1)</span>
  <span class="comment">%  tni: (ni,k) matrix with</span>
  <span class="comment">%    tni(:,1) time points</span>
  <span class="comment">%    tni(:,2) number of survivors (optional)</span>
  <span class="comment">%    The number of data matrices nt1, nt2, ... is optional but &gt;0</span>
  <span class="comment">%    but must match the definition of 'func'.</span>
  <span class="comment">%</span>
<span class="comment">  %% Remarks</span>
  <span class="comment">%  Set options for plotting routine shsurv with shregr_options</span>
  <span class="comment">%</span>
<span class="comment">  %% Example of use, assuming that function_name, pars, and data tn are defined properly:</span>
  <span class="comment">%  shsurv('function_name', pars, tn), or if the user-defined function codes for two data sets,</span>
  <span class="comment">%  for instance shsurv('function_name', pars, tn1, tn2).</span>

<span class="comment">  %% Code</span>
  i = 1; <span class="comment">% initiate data set counter</span>
  ci = num2str(i); <span class="comment">% character string with value of i</span>
  nntn = nargin -1; <span class="comment">% initial 'while' condition (will count down)</span>
  ntn = nntn -1; <span class="comment">% number of data sets</span>
  va_start (); <span class="comment">% set pointer to first unnamed argument</span>
  <span class="keyword">while</span> (--nntn) <span class="comment">% loop across data sets</span>
    eval([<span class="string">'tn'</span>, ci, <span class="string">' = va_arg();'</span>]); <span class="comment">% assing unnamed arguments to tni</span>
    eval([<span class="string">'[n('</span>, ci, <span class="string">') k] = size(tn'</span>, ci, <span class="string">');'</span>]); <span class="comment">% number of data points</span>
    <span class="keyword">if</span> i == 1
      listtn = [<span class="string">'tn'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list tn</span>
      listT = [<span class="string">'T'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list T</span>
      listf = [<span class="string">'f'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list f</span>
      listg = [<span class="string">'g'</span>, ci,<span class="string">','</span>]; <span class="comment">% initiate list g</span>
    <span class="keyword">else</span>
      listtn = [listtn, <span class="string">' tn'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list tn</span>
      listT = [listT, <span class="string">' T'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list T</span>
      listf = [listf, <span class="string">' f'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list f</span>
      listg = [listg, <span class="string">' g'</span>, ci,<span class="string">','</span>]; <span class="comment">% append list g</span>
    <span class="keyword">end</span>
    i = i + 1;
    ci = num2str(i); <span class="comment">% character string with value of i</span>
  <span class="keyword">end</span>

  [i, nl] = size(listtn); listtn = listtn(1:(nl-1)); <span class="comment">% remove last ','</span>
  [i, nl] = size(listT); listT = listT(1:(nl-1)); <span class="comment">% remove last ','</span>
  [i, nl] = size(listf); listf = listf(1:(nl-1)); <span class="comment">% remove last ','</span>
  [i, nl] = size(listg); listg = listg(1:(nl-1)); <span class="comment">% remove last ','</span>

  p = p(:,1); <span class="comment">% remove other columns from parameter data</span>

  <span class="keyword">global</span> dataset Range all_in_one; <span class="comment">% option settings</span>
    <span class="keyword">for</span> i = 1:ntn
    ci = num2str(i);
    eval([<span class="string">'global xlabel'</span>, ci, <span class="string">' ylabel'</span>, ci, <span class="string">';'</span>]);
  <span class="keyword">end</span>

<span class="comment">  %% set options if necessary</span>
  <span class="keyword">if</span> prod(size(dataset)) == 0 <span class="comment">% select data sets to be plotted</span>
    dataset = 1:ntn;
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(all_in_one)) == 0 <span class="comment">% all graphs in one</span>
    all_in_one = 0;
  <span class="keyword">end</span>
  <span class="keyword">if</span> prod(size(Range)) == 0 <span class="comment">% set plot ranges</span>
    Range = zeros (ntn, 2);
    <span class="keyword">for</span> i = 1:ntn
      ci = num2str(i);
      eval([<span class="string">'r0 = 0.9*min(tn'</span>, ci, <span class="string">'(:,1));'</span>]);
      eval([<span class="string">'r1 = 1.1*max(tn'</span>, ci, <span class="string">'(:,1));'</span>]);
      Range(i,:) = [r0 r1];
    <span class="keyword">end</span>
  <span class="keyword">end</span>

  [nr i] = size(Range);
  <span class="keyword">if</span> nr ~= ntn <span class="comment">% set plot ranges, because existing ones are invalid</span>
    Range = zeros (ntn, 2);
    <span class="keyword">for</span> i = 1:ntn
      ci = num2str(i);
      eval([<span class="string">'r0 = 0.9*min(tn'</span>, ci, <span class="string">'(:,1));'</span>]);
      eval([<span class="string">'r1 = 1.1*max(tn'</span>, ci, <span class="string">'(:,1));'</span>]);
      Range(i,:) = [r0 r1];
    <span class="keyword">end</span>
  <span class="keyword">end</span>

  <span class="keyword">for</span> i = 1:ntn <span class="comment">% set plot labels</span>
    ci = num2str(i);
    <span class="keyword">if</span> eval([<span class="string">'prod(size([xlabel'</span>, ci,<span class="string">']) == 0'</span>])
      eval([<span class="string">'xlabel'</span>, ci, <span class="string">' = ''time'';'</span>]);
    <span class="keyword">end</span>
    <span class="keyword">if</span> eval([<span class="string">'prod(size([ylabel'</span>, ci,<span class="string">']) ~= 1'</span>])
      eval([<span class="string">'ylabel'</span>, ci, <span class="string">' = ''number'';'</span>]);
    <span class="keyword">end</span>
  <span class="keyword">end</span>

  nS = max(size(dataset)); <span class="comment">% set number of data sets to be plotted</span>

  <span class="keyword">for</span> i = 1:ntn  <span class="comment">%% set time points</span>
    eval([<span class="string">'T'</span>, num2str(i), <span class="string">' = linspace('</span>, <span class="keyword">...</span>
	  num2str(Range(i,1)), <span class="string">', '</span>, num2str(Range(i,2)), <span class="string">', 100)'</span>;<span class="untermstring">']);</span>
  end

<span class="comment">  %% get survival probabilities</span>
  eval([<span class="string">'['</span>, listf,<span class="string">'] = '</span>, func, <span class="string">'(p,'</span>, listT,<span class="string">' );'</span>]);
  eval([<span class="string">'['</span>, listg,<span class="string">'] = '</span>, func, <span class="string">'(p,'</span>, listtn,<span class="string">' );'</span>]);
  <span class="keyword">for</span> i = 1:nS <span class="comment">%% get number of survivors</span>
    ci = num2str(dataset(i));
    eval([<span class="string">'f'</span>, ci, <span class="string">' = f'</span>, ci, <span class="string">'* tn'</span>, ci, <span class="string">'(1,2);'</span>]);
    eval([<span class="string">'g'</span>, ci, <span class="string">' = g'</span>, ci, <span class="string">'* tn'</span>, ci, <span class="string">'(1,2);'</span>]);
  <span class="keyword">end</span>

  clf;

  <span class="keyword">if</span> all_in_one ~= 0 <span class="comment">% single plot mode</span>
    <span class="keyword">for</span> i = 1:nS <span class="comment">% loop across data sets that must be plotted</span>
      ci = num2str(dataset(i));
      eval([<span class="string">'plot(T'</span>, ci, <span class="string">'(:, 1), f'</span>, ci, <span class="string">', ''r'');'</span>]);
      eval([<span class="string">'[nr nc] = size(tn'</span>, ci, <span class="string">');'</span>]);
      eval([<span class="string">'plot(tn'</span>, ci, <span class="string">'(:,1), tn'</span>, ci, <span class="string">'(:,2), ''b+'');'</span>]);
      <span class="keyword">for</span> j = 1:n(dataset(i)) <span class="comment">% connect data points with curves</span>
    	eval([<span class="string">'plot([tn'</span>, ci, <span class="string">'(j,[1 1])'</span>],<span class="untermstring">' ...</span>
	      <span class="string">'[tn'</span>, ci, <span class="string">'(j,2); g'</span>, ci, <span class="string">'(j)], ''m'');'</span>]);
      <span class="keyword">end</span>
      <span class="keyword">if</span> i == 1 <span class="comment">% set labels</span>
	    eval([<span class="string">'xtext = xlabel'</span>,ci,<span class="string">';'</span>]);
        eval([<span class="string">'xlabel('''</span>, xtext, <span class="string">''');'</span>]);
        eval([<span class="string">'ytext = ylabel'</span>,ci,<span class="string">';'</span>]);
        eval([<span class="string">'ylabel('''</span>, ytext, <span class="string">''');'</span>]);
      <span class="keyword">end</span>
    <span class="keyword">end</span>
  <span class="keyword">else</span> <span class="comment">% multiplot mode</span>
<span class="comment">    %% rows and colums of multiplot</span>
    r = max([1, floor(sqrt(ntn))]); k = ceil(nS/r);

    <span class="keyword">for</span> i = 1:nS <span class="comment">% loop across data sets that must be plotted</span>
      subplot(r,k,i)
      clf;
      ci = num2str(dataset(i));
      eval([<span class="string">'xtext = xlabel'</span>,ci,<span class="string">';'</span>]);
      eval([<span class="string">'xlabel('''</span>, xtext, <span class="string">''');'</span>]);
      eval([<span class="string">'ytext = ylabel'</span>,ci,<span class="string">';'</span>]);
      eval([<span class="string">'ylabel('''</span>, ytext, <span class="string">''');'</span>]);
      eval([<span class="string">'plot(T'</span>, ci, <span class="string">'(:, 1), f'</span>, ci, <span class="string">', ''r'');'</span>]);
      eval([<span class="string">'[nr nc] = size(tn'</span>, ci, <span class="string">');'</span>]);
      eval([<span class="string">'plot(tn'</span>, ci, <span class="string">'(:,1), tn'</span>, ci, <span class="string">'(:,2), ''b+'');'</span>]);
    <span class="keyword">end</span>

  <span class="keyword">end</span>
</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
function shsurv (func, p, varin)
  %  created: 2002/02/10 by <NAME>
  %
  %% Description
  %  plots observed survivors and model predictions
  %  func: character string with name of user-defined function
  %    see scsurv
  %  p: (r,k) matrix with parameter values in p(:,1) 
  %  tni: (ni,k) matrix with
  %    tni(:,1) time points
  %    tni(:,2) number of survivors (optional)
  %    The number of data matrices nt1, nt2, ... is optional but >0
  %    but must match the definition of 'func'.
  %
  %% Remarks
  %  Set options for plotting routine shsurv with shregr_options
  %
  %% Example of use, assuming that function_name, pars, and data tn are defined properly: 
  %  shsurv('function_name', pars, tn), or if the user-defined function codes for two data sets, 
  %  for instance shsurv('function_name', pars, tn1, tn2). 
  
  %% Code
  i = 1; % initiate data set counter
  ci = num2str(i); % character string with value of i
  nntn = nargin -1; % initial 'while' condition (will count down)
  ntn = nntn -1; % number of data sets
  va_start (); % set pointer to first unnamed argument
  while (REPLACE_WITH_DASH_DASHnntn) % loop across data sets
    eval(['tn', ci, ' = va_arg();']); % assing unnamed arguments to tni
    eval(['[n(', ci, ') k] = size(tn', ci, ');']); % number of data points
    if i == 1
      listtn = ['tn', ci,',']; % initiate list tn
      listT = ['T', ci,',']; % initiate list T
      listf = ['f', ci,',']; % initiate list f
      listg = ['g', ci,',']; % initiate list g
    else     
      listtn = [listtn, ' tn', ci,',']; % append list tn
      listT = [listT, ' T', ci,',']; % append list T
      listf = [listf, ' f', ci,',']; % append list f
      listg = [listg, ' g', ci,',']; % append list g
    end
    i = i + 1;
    ci = num2str(i); % character string with value of i
  end

  [i, nl] = size(listtn); listtn = listtn(1:(nl-1)); % remove last ','
  [i, nl] = size(listT); listT = listT(1:(nl-1)); % remove last ','
  [i, nl] = size(listf); listf = listf(1:(nl-1)); % remove last ','
  [i, nl] = size(listg); listg = listg(1:(nl-1)); % remove last ','
  
  p = p(:,1); % remove other columns from parameter data

  global dataset Range all_in_one; % option settings
    for i = 1:ntn
    ci = num2str(i);
    eval(['global xlabel', ci, ' ylabel', ci, ';']);
  end

  %% set options if necessary
  if prod(size(dataset)) == 0 % select data sets to be plotted
    dataset = 1:ntn;
  end
  if prod(size(all_in_one)) == 0 % all graphs in one
    all_in_one = 0;
  end
  if prod(size(Range)) == 0 % set plot ranges
    Range = zeros (ntn, 2);
    for i = 1:ntn
      ci = num2str(i);
      eval(['r0 = 0.9*min(tn', ci, '(:,1));']);
      eval(['r1 = 1.1*max(tn', ci, '(:,1));']);
      Range(i,:) = [r0 r1];
    end
  end
  
  [nr i] = size(Range);
  if nr ~= ntn % set plot ranges, because existing ones are invalid
    Range = zeros (ntn, 2);
    for i = 1:ntn
      ci = num2str(i);
      eval(['r0 = 0.9*min(tn', ci, '(:,1));']);
      eval(['r1 = 1.1*max(tn', ci, '(:,1));']);
      Range(i,:) = [r0 r1];
    end
  end
  
  for i = 1:ntn % set plot labels
    ci = num2str(i);
    if eval(['prod(size([xlabel', ci,']) == 0'])
      eval(['xlabel', ci, ' = ''time'';']);
    end
    if eval(['prod(size([ylabel', ci,']) ~= 1'])
      eval(['ylabel', ci, ' = ''number'';']);
    end    
  end
    
  nS = max(size(dataset)); % set number of data sets to be plotted  

  for i = 1:ntn  %% set time points
    eval(['T', num2str(i), ' = linspace(', ...
	  num2str(Range(i,1)), ', ', num2str(Range(i,2)), ', 100)';']);
  end
  
  %% get survival probabilities
  eval(['[', listf,'] = ', func, '(p,', listT,' );']);
  eval(['[', listg,'] = ', func, '(p,', listtn,' );']);
  for i = 1:nS %% get number of survivors
    ci = num2str(dataset(i));
    eval(['f', ci, ' = f', ci, '* tn', ci, '(1,2);']);
    eval(['g', ci, ' = g', ci, '* tn', ci, '(1,2);']);
  end
  
  clf;

  if all_in_one ~= 0 % single plot mode
    for i = 1:nS % loop across data sets that must be plotted
      ci = num2str(dataset(i));
      eval(['plot(T', ci, '(:, 1), f', ci, ', ''r'');']);
      eval(['[nr nc] = size(tn', ci, ');']);
      eval(['plot(tn', ci, '(:,1), tn', ci, '(:,2), ''b+'');']);
      for j = 1:n(dataset(i)) % connect data points with curves
    	eval(['plot([tn', ci, '(j,[1 1])'],' ...
	      '[tn', ci, '(j,2); g', ci, '(j)], ''m'');']);
      end
      if i == 1 % set labels
	    eval(['xtext = xlabel',ci,';']);
        eval(['xlabel(''', xtext, ''');']);
        eval(['ytext = ylabel',ci,';']);
        eval(['ylabel(''', ytext, ''');']);
      end  
    end
  else % multiplot mode
    %% rows and colums of multiplot
    r = max([1, floor(sqrt(ntn))]); k = ceil(nS/r);
    
    for i = 1:nS % loop across data sets that must be plotted
      subplot(r,k,i)  
      clf;
      ci = num2str(dataset(i));
      eval(['xtext = xlabel',ci,';']);
      eval(['xlabel(''', xtext, ''');']);
      eval(['ytext = ylabel',ci,';']);
      eval(['ylabel(''', ytext, ''');']);
      eval(['plot(T', ci, '(:, 1), f', ci, ', ''r'');']);
      eval(['[nr nc] = size(tn', ci, ');']);
      eval(['plot(tn', ci, '(:,1), tn', ci, '(:,2), ''b+'');']);
    end

  end
##### SOURCE END #####
--></body></html>

<|start_filename|>docs/first_fns.html<|end_filename|>
<HTML>
<HEAD>

  <STYLE>
  <!--
  H1 {color: blue; text-align:center}
  H2 {color: blue; text-align:left}
  A:link{color:blue}
  A:visited{color:red}
  A:hover{color:blue}
  A:active{color:blue}
  code {color:magenta}
  -->
  </STYLE>

  <TITLE>
    First steps
  </TITLE>

  <META 
    NAME ="keywords" CONTENT="Octave Matlab" >
  
</HEAD>

<BODY BGCOLOR="#EEFFEE">

<H1>Functions</H1>

A function is a file with extension <code>.m</code> and starts with the word <code>function</code> and has the name of the file in the first line. 
This line also defines the inputs and outputs, which are treated as <B>local variables</B>; local variables are variables whose value is only known during the execution of the function. 
All other variables that are used in the function are local by default, but can be made global.

<P>
Example: create a file with name "add.m" and write in it:<BR>
<code>
  function c = add (a,b)<BR>
  c = a + b; % calculate output<BR>
</code>
The values of the local variables <code>a</code>, <code>b</code> and <code>c</code> are only known during the execution of function
<code>add</code>. 
Variables with these names can have other values outside the function.

<P>
Save the file <code>add.m</code> and type in the command line:<BR>
<code>
 a = add (3,6) % this is how function add is used<BR>
</code>
The answer <code>a = 9</code> is returned. 
Notice that variable local <code>a</code> had value 3 during the execution of the function, but now it has value 9.
The function <code>add</code> has two inputs and one output.

<P>
We now create a function with two outputs, and pass a third variable <code>x</code> to the function:<BR>
<code>
  function [c,d] = test (a,b)<BR>
  global x    % d<BR>
  c = x*a;    % calculate first output<BR>
  d = x*(a-b);% calculate second output<BR>
</code>

<P>
To pass the value of the <B>global variable</B> <code>x</code> to the function <code>test</code>, it must be global:<BR>
<code>
  global x<BR>
  x = 2; 
  [a,b] = test(2,4)
</code><BR>
The result <code>a = 12</code> and <code>b = -4</code> is returned. 
Also try<BR>
<code>
  a = test(1,5) # the second output went lost now<BR>
</code><br>

Global declarations make sense only if done within a function and outside any function, or within at least two functions.

<p>
Loop support is implemented in <code>for, while</code>, decision forks in <code>if, else, elseif, switch</code>; 
they are all closed by <code>end</code>. 
The symbols like <code>==</code> (is-equal-to), <code><=</code> (larger than or equal to), <code>||</code> (or), <code>&&</code> (and) make these programming tools powerful. 
See Octave's manual.

<p>
Octave (but not Matlab) allows you to define functions in a script file; 
the end of the function definition is indicated by <code>endfunction</code>.

<H4>Recommendation</H4>

Minimize the use of global variables and loops across indices. 
Avoid long functions, work in short modules. 
Label all functions with name of author, date, and descriptions of inputs and outputs. 
The copy-paste-modify method is usually very efficient.

</BODY>
</HTML>


<|start_filename|>popDyn/EBTtool/fns/ebttooldefs.h<|end_filename|>
/***
   NAME
     ebttooldefs.h
   PURPOSE
     This file contains some constant declarations that are used when the escalator
     boxcar train is used from within the ebttool; it should be included in ebtcohrt.c
     and in the ebttool program file
     
   NOTES
     
   HISTORY
     AvdM - Nov 22, 2004 : Created.
***/

#ifndef EBTTOOLDEFS_H
#define EBTTOOLDEFS_H

//#if defined(_GNU_SOURCE)
//#include  "fenv.h"
//#endif

const int END_OF_COHORT = 0x01;		// 1
const int NORMAL_OUT = 0x02;		// 2
const int STATE_OUT = 0x04;		// 4
const int WARNING = 0x08;		// 8
const int NON_FATAL_ERROR = 0x10;	// 16
const int FATAL_ERROR = 0x20;		// 32
const int LIB_NOT_LOADED = 0x40;        // 64
const int FPE_ERROR = 0x80;		// 128

#endif // EBTTOOLDEFS_H 


<|start_filename|>popDyn/EBTtool/fns/DefineOutput.h<|end_filename|>
/* Copyright (c) 1997 by <NAME>. All Rights Reserved                  */

/***
   NAME
     DefineOutput
   PURPOSE
     A wrapper header file for DefineOutput.c
   NOTES
     
   HISTORY
     AMdR - Sep 07, 2007: Last Revision.
     AvdM - August, 2005 Added export of i_state_dim
***/

#ifndef I_STATE_DIM
#error You have to define I_STATE_DIM at the beginning of the source file!
#endif
#ifndef OUTPUT_VAR_NR
#error You have to define OUTPUT_VAR_NR at the beginning of the source file!
#endif

#ifndef DEFINEOUTPUT
#define DEFINEOUTPUT
#include  "math.h"
#include  "stdio.h"
#include  "stdlib.h"
#include  "float.h"

// AvdM050801:
#include "ebttune.h" //for definition of EXTERN_C

typedef	double		*population;


/*==========================================================================*/
/* 
 * Defining macro's for global use in all files
 */

#if defined(DBL_MAX)				/* Stub value for missing   */
#define MISSING_VALUE		(DBL_MAX)	/* data point	            */
#elif defined(MAXDOUBLE)
#define MISSING_VALUE		(MAXDOUBLE)
#else
#define MISSING_VALUE		(1.23456789e+307)
#endif

#define max(a, b)       (((a) > (b)) ? (a) : (b))
#define min(a, b)       (((a) < (b)) ? (a) : (b))
#define number		(0)
#define i_state(a)	(min((a)+1,I_STATE_DIM))
#define i_const(a)	((a)+I_STATE_DIM+1)

int			*cohort_no;
double			*parameter;

void			DefineOutput(double *, population *, double *);

EXTERN_C int		DefOutWrapper(double *env, population *pop, double *output,
				      double *pars, int *coh_nr)

{
  if(output)
    {
      parameter = pars;
      cohort_no = coh_nr;

      output[0] = env[0];
      DefineOutput(env, pop, output+1);	
      // AvdM if function is called with a null pointer for "output", it should
      // just return the number of output variables (similar to defIDcard)
    }

  return (OUTPUT_VAR_NR+1);
}

#ifdef MODULE
EXTERN_C int		iStateDim()
{
  return (I_STATE_DIM);
}
#endif /* MODULE */

#endif /* DEFINEOUTPUT */


<|start_filename|>animal/html/mydata_of.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>Demonstrates the use of f2o and o2f</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="mydata_of.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>Demonstrates the use of f2o and o2f</h1><!--introduction--><pre>We first obtain (otolith-length,opacity( data from functional response trajectory
  then we reconstruct functional response trajectory from (otolith-length,opacity) data
  and test the result graphically
shrinking is not allowed, on the assumption that the reproduction buffer is large enough
we assume k_J = k_M for simplicity's sake (implying stage transitions at fixed length)
we use volumetric length for body and otolith
if d/dt f changes slowly,  we have f about equal to e</pre><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">2006/03/27 Set anchovy parameters</a></li><li><a href="#2">from scaled functional response f to opacity o</a></li><li><a href="#3">from opacity o to scaled functional response f</a></li><li><a href="#4">tcfeLLOO = o2f_init(LOO, tc, par, teLLOO(end,3)); % get initial estimate</a></li><li><a href="#5">start plotting</a></li></ul></div><h2>2006/03/27 Set anchovy parameters<a name="1"></a></h2><pre class="codeinput">  Lb = .1; <span class="comment">% 1, d.cm^2, scaled maturity at birth</span>
  Lp = 1.6; <span class="comment">% 2, d.cm^2, scaled maturity at puberty</span>
  v = .031748 * 16.5838; <span class="comment">% 3, cm/d, energy conductance * M shape correction factor</span>
  vOD = 1.1861e-005; <span class="comment">% 4, mum/d, otolith speed for dissipation</span>
  vOG = .00011049; <span class="comment">% 5, mum/d, otolith speed for growth</span>
  kM = .015; <span class="comment">% 6, 1/d, somatic maintenance rate coeff</span>
  g = 6; <span class="comment">% 7, -, energy investment ratio</span>
  kap = 0.65; <span class="comment">% 8, was 0.65;% -, Veer</span>
  kapR = 0.95; <span class="comment">% 9, -, Fraction of reproduction energy fixed in eggs; ref = ;</span>
  delS = 20;<span class="comment">% 10, -, shape of the otosac</span>
par = [Lb; Lp; v; vOD; vOG; kM; g; kap; kapR; delS];

t = linspace(0,3*365,200)'; <span class="comment">% time points for simulation</span>

TA = 9800; <span class="comment">% K, Arrhenius temperature ; ref = after Regner 1996;</span>
T1 = 286; <span class="comment">% K, Reference temperature ;</span>
T = 286 + 1.85 * sin(2 * pi * (t + 207)/ 365); <span class="comment">% K, temp at time t</span>
cor_T = exp(TA/ T1 - TA ./ T); <span class="comment">% temp correction factors</span>

p5 = 1.0e+002 * <span class="keyword">...</span>
   [3.650000000000000 0.000338436258255;
   0.000139797026871 -0.000061529908266;
  -0.000140529304759 -0.000037548182856;
   0.000005704656069  0.000066063518408;
   0.000047981953130  0.000016729882406;
  -0.000005258679892 -0.000022614364105];

X = fnfourier(mod(t, 365), p5);
K = .045; <span class="comment">% chlo_a/d.m^2, saturation constant</span>
f = X ./ (K + X); <span class="comment">% scaled functional response</span>
tcf = [t, cor_T, f]; <span class="comment">% pack environmental forcing</span>
</pre><h2>from scaled functional response f to opacity o<a name="2"></a></h2><pre class="codeinput">LOb = .01; eb = .85; <span class="comment">% LO and e at birth</span>
[LOO, teLLOO] = f2o(tcf, eb, LOb, par); <span class="comment">% get otolith, state vars</span>
</pre><h2>from opacity o to scaled functional response f<a name="3"></a></h2><pre class="codeinput">tc = tcf(:,[1 2]); <span class="comment">% remove unknown f</span>
</pre><h2>tcfeLLOO = o2f_init(LOO, tc, par, teLLOO(end,3)); % get initial estimate<a name="4"></a></h2><pre class="codeinput">tcfeLLOO = o2f(LOO, tc, par); <span class="comment">% get best estimate (less robust)</span>
</pre><pre class="codeoutput">i = 3; t = 11.0937; f = 0.17533; e = 0.17543; L = 0.14882; LO = 0.014409; O = 0.92035; df = -0.0017027
i = 4; t = 16.61; f = 0.16331; e = 0.16355; L = 0.16835; LO = 0.016241; O = 0.91418; df = -0.0021781
i = 5; t = 22.1278; f = 0.15127; e = 0.15161; L = 0.18557; LO = 0.017878; O = 0.90712; df = -0.0021828
i = 6; t = 27.6406; f = 0.1445; e = 0.14474; L = 0.20091; LO = 0.019348; O = 0.90068; df = -0.0012276
i = 7; t = 33.1414; f = 0.14977; e = 0.14954; L = 0.2155; LO = 0.020754; O = 0.89828; df = 0.00095803
i = 8; t = 38.6277; f = 0.17267; e = 0.17149; L = 0.23119; LO = 0.022264; O = 0.90169; df = 0.0041748
i = 9; t = 44.1059; f = 0.21508; e = 0.2125; L = 0.25018; LO = 0.024083; O = 0.90801; df = 0.0077402
i = 10; t = 49.5804; f = 0.27316; e = 0.26897; L = 0.27445; LO = 0.026395; O = 0.91356; df = 0.01061
i = 11; t = 55.0556; f = 0.33891; e = 0.33324; L = 0.30519; LO = 0.029317; O = 0.91706; df = 0.012009
i = 12; t = 60.5352; f = 0.40412; e = 0.3974; L = 0.34264; LO = 0.032875; O = 0.91873; df = 0.011899
i = 13; t = 66.0191; f = 0.46299; e = 0.4558; L = 0.38623; LO = 0.037022; O = 0.91906; df = 0.010736
i = 14; t = 71.5053; f = 0.51153; e = 0.50457; L = 0.43495; LO = 0.041665; O = 0.91838; df = 0.0088476
i = 15; t = 76.997; f = 0.54957; e = 0.54327; L = 0.48766; LO = 0.046699; O = 0.91697; df = 0.0069278
i = 16; t = 82.4918; f = 0.57701; e = 0.57182; L = 0.54323; LO = 0.052018; O = 0.91496; df = 0.0049938
i = 17; t = 87.9901; f = 0.59465; e = 0.59089; L = 0.60064; LO = 0.057527; O = 0.91241; df = 0.0032087
i = 18; t = 93.4909; f = 0.60344; e = 0.60134; L = 0.65898; LO = 0.063139; O = 0.90933; df = 0.0015977
i = 19; t = 98.9939; f = 0.60435; e = 0.60406; L = 0.71743; LO = 0.068777; O = 0.9057; df = 0.00016392
i = 20; t = 104.4954; f = 0.59754; e = 0.59934; L = 0.77522; LO = 0.074368; O = 0.90144; df = -0.0012373
i = 21; t = 109.9993; f = 0.58382; e = 0.58778; L = 0.83163; LO = 0.079846; O = 0.89638; df = -0.0024933
i = 22; t = 115.5063; f = 0.56548; e = 0.57115; L = 0.88604; LO = 0.085152; O = 0.89048; df = -0.0033292
i = 23; t = 121.0134; f = 0.54193; e = 0.54957; L = 0.93788; LO = 0.090233; O = 0.88346; df = -0.004276
i = 24; t = 126.5256; f = 0.51755; e = 0.52586; L = 0.98672; LO = 0.09505; O = 0.87532; df = -0.0044233
i = 25; t = 132.0367; f = 0.49329; e = 0.50186; L = 1.0323; LO = 0.099583; O = 0.86607; df = -0.0044025
i = 26; t = 137.5484; f = 0.47279; e = 0.48032; L = 1.0748; LO = 0.10384; O = 0.85611; df = -0.0037182
i = 27; t = 143.0572; f = 0.45777; e = 0.4635; L = 1.1146; LO = 0.10786; O = 0.84618; df = -0.0027275
i = 28; t = 148.5671; f = 0.44919; e = 0.45263; L = 1.1523; LO = 0.1117; O = 0.83716; df = -0.0015571
i = 29; t = 154.0734; f = 0.44681; e = 0.44794; L = 1.1888; LO = 0.11544; O = 0.82978; df = -0.0004313
i = 30; t = 159.5759; f = 0.44778; e = 0.44755; L = 1.2248; LO = 0.11914; O = 0.82384; df = 0.00017533
i = 31; t = 165.0815; f = 0.45218; e = 0.45061; L = 1.2608; LO = 0.12285; O = 0.81922; df = 0.000799
i = 32; t = 170.5818; f = 0.45625; e = 0.45466; L = 1.2971; LO = 0.12661; O = 0.81498; df = 0.00074036
i = 33; t = 176.0815; f = 0.45964; e = 0.45827; L = 1.3338; LO = 0.1304; O = 0.81044; df = 0.00061549
i = 34; t = 181.5817; f = 0.46175; e = 0.46085; L = 1.3707; LO = 0.13423; O = 0.80529; df = 0.00038404
i = 35; t = 187.0849; f = 0.4621; e = 0.46188; L = 1.4076; LO = 0.13808; O = 0.79922; df = 6.4033e-05
i = 36; t = 192.5908; f = 0.46171; e = 0.46183; L = 1.4442; LO = 0.14191; O = 0.79236; df = -7.0582e-05
i = 37; t = 198.0911; f = 0.45952; e = 0.46033; L = 1.4802; LO = 0.1457; O = 0.78445; df = -0.00039928
i = 38; t = 203.596; f = 0.458; e = 0.45865; L = 1.5155; LO = 0.14944; O = 0.7761; df = -0.00027455
i = 39; t = 209.1027; f = 0.45591; e = 0.45675; L = 1.55; LO = 0.15312; O = 0.76733; df = -0.00038111
i = 40; t = 214.6121; f = 0.45444; e = 0.45508; L = 1.5836; LO = 0.15674; O = 0.75839; df = -0.0002654
i = 41; t = 220.237; f = 0.45354; e = 0.45394; L = 1.617; LO = 0.16028; O = 0.78161; df = -0.00016135
i = 42; t = 225.7703; f = 0.45247; e = 0.45292; L = 1.6489; LO = 0.16364; O = 0.77189; df = -0.00019211
i = 43; t = 231.2637; f = 0.45124; e = 0.45177; L = 1.6797; LO = 0.16691; O = 0.76187; df = -0.00022416
i = 44; t = 236.7645; f = 0.4499; e = 0.45048; L = 1.7096; LO = 0.17012; O = 0.75147; df = -0.00024415
i = 45; t = 242.2647; f = 0.44855; e = 0.44915; L = 1.7385; LO = 0.17324; O = 0.74079; df = -0.00024514
i = 46; t = 247.762; f = 0.44749; e = 0.44798; L = 1.7662; LO = 0.17629; O = 0.7301; df = -0.00019368
i = 47; t = 253.2629; f = 0.44763; e = 0.44764; L = 1.793; LO = 0.17925; O = 0.72031; df = 2.6187e-05
i = 48; t = 258.761; f = 0.44869; e = 0.44826; L = 1.8189; LO = 0.18215; O = 0.71184; df = 0.00019325
i = 49; t = 264.2585; f = 0.45023; e = 0.44954; L = 1.8441; LO = 0.18499; O = 0.70438; df = 0.00028043
i = 50; t = 269.7597; f = 0.45378; e = 0.4522; L = 1.8687; LO = 0.18779; O = 0.69904; df = 0.00064423
i = 51; t = 275.2553; f = 0.45638; e = 0.45504; L = 1.8929; LO = 0.19054; O = 0.69424; df = 0.00047401
i = 52; t = 280.7573; f = 0.45882; e = 0.45756; L = 1.9166; LO = 0.19325; O = 0.68903; df = 0.00044259
i = 53; t = 286.2547; f = 0.45852; e = 0.45844; L = 1.9397; LO = 0.19589; O = 0.68145; df = -5.4359e-05
i = 54; t = 291.752; f = 0.45495; e = 0.45653; L = 1.9617; LO = 0.19845; O = 0.66923; df = -0.00065002
i = 55; t = 297.2527; f = 0.44645; e = 0.45059; L = 1.9822; LO = 0.20087; O = 0.64928; df = -0.0015445
i = 56; t = 302.7629; f = 0.43306; e = 0.44; L = 2.0004; LO = 0.20311; O = 0.61772; df = -0.0024308
i = 57; t = 308.2669; f = 0.41369; e = 0.42412; L = 2.0156; LO = 0.20509; O = 0.56701; df = -0.0035183

1 218.360837
2 
3 153.551923
4 
 no convergence within 5 generations 

5 130.828166
no convergence at point 58
i = 58; t = 313.7785; f = 0.41369; e = 0.40215; L = 2.027; LO = 0.20677; O = 0.47923; df = 0

1 130.828166
2 3 
4 51.022577

 no convergence within 5 generations 

5 51.022577
no convergence at point 59
i = 59; t = 319.0718; f = 0.41369; e = 0.37413; L = 2.0345; LO = 0.20809; O = 0.31798; df = 0

1 51.022577

2 0.000000
3 4 
 no convergence within 5 generations 

5 0.000000
i = 60; t = 323.9762; f = 1; e = 0.34827; L = 2.0374; LO = 0.20899; O = 0; df = NaN
i = 61; t = 325.7448; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.20973; O = 0; df = 0
i = 62; t = 331.1422; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21045; O = 0; df = 0
i = 63; t = 336.536; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21115; O = 0; df = 0
i = 64; t = 341.9274; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21182; O = 0; df = 0
i = 65; t = 347.3169; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21248; O = 0; df = 0
i = 66; t = 352.7052; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21312; O = 0; df = 0
i = 67; t = 358.0937; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21375; O = 0; df = 0
i = 68; t = 363.4831; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21436; O = 0; df = 0
i = 69; t = 368.8746; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21495; O = 0; df = 0
i = 70; t = 374.2694; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21553; O = 0; df = 0
i = 71; t = 379.6685; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.2161; O = 0; df = 0
i = 72; t = 385.073; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21665; O = 0; df = 0
i = 73; t = 390.484; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.2172; O = 0; df = 0
i = 74; t = 395.9028; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21774; O = 0; df = 0
i = 75; t = 401.3302; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21826; O = 0; df = 0
i = 76; t = 406.7671; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21878; O = 0; df = 0
i = 77; t = 412.2143; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.2193; O = 0; df = 0
i = 78; t = 417.6721; f = 0.34827; e = 0.34827; L = 2.0374; LO = 0.21981; O = 0; df = 0
no convergence at point 79 after awakening 
i = 79; t = 422.6106; f = 1; e = 0.39211; L = 2.0391; LO = 0.22038; O = 0.40596; df = 0.5

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 80; t = 427.8553; f = 1; e = 0.35007; L = 2.0479; LO = 0.22147; O = 0.61237; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 81
i = 81; t = 432.9031; f = 1; e = 0.47973; L = 2.0631; LO = 0.22298; O = 0.697; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 82
i = 82; t = 437.5242; f = 1; e = 0.52068; L = 2.0838; LO = 0.22483; O = 0.73836; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 83
i = 83; t = 442.2792; f = 1; e = 0.55229; L = 2.108; LO = 0.22695; O = 0.76025; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 84
i = 84; t = 447.1139; f = 1; e = 0.57292; L = 2.1346; LO = 0.22927; O = 0.77015; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 85
i = 85; t = 452.0041; f = 1; e = 0.58465; L = 2.1627; LO = 0.23171; O = 0.77269; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 86
i = 86; t = 456.9157; f = 1; e = 0.58743; L = 2.1912; LO = 0.2342; O = 0.76885; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 87
i = 87; t = 461.8323; f = 1; e = 0.58222; L = 2.2194; LO = 0.2367; O = 0.75919; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 88
i = 88; t = 466.7323; f = 1; e = 0.56983; L = 2.2465; LO = 0.23914; O = 0.74325; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 89
i = 89; t = 471.5939; f = 1; e = 0.55126; L = 2.2718; LO = 0.24146; O = 0.71993; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 90
i = 90; t = 476.3953; f = 1; e = 0.52796; L = 2.2948; LO = 0.24363; O = 0.68764; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 91
i = 91; t = 481.1163; f = 1; e = 0.50191; L = 2.3149; LO = 0.24561; O = 0.6446; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 92
i = 92; t = 485.74; f = 1; e = 0.47488; L = 2.3321; LO = 0.24738; O = 0.58951; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 93
i = 93; t = 490.2873; f = 1; e = 0.44885; L = 2.3464; LO = 0.24895; O = 0.52811; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 94; t = 495.8123; f = 1; e = 0.40283; L = 2.3566; LO = 0.25036; O = 0.46674; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 95; t = 504.8425; f = 1; e = 0.40319; L = 2.3586; LO = 0.25165; O = 0.41768; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 96; t = 510.4315; f = 1; e = 0.40443; L = 2.3659; LO = 0.25288; O = 0.39098; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 97; t = 516.0842; f = 1; e = 0.4056; L = 2.3728; LO = 0.2541; O = 0.38585; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 98; t = 521.6577; f = 1; e = 0.40684; L = 2.38; LO = 0.25536; O = 0.39385; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 99; t = 527.109; f = 1; e = 0.4082; L = 2.388; LO = 0.25665; O = 0.40545; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 100; t = 532.4288; f = 1; e = 0.40969; L = 2.3967; LO = 0.258; O = 0.41486; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 101; t = 537.7038; f = 1; e = 0.41126; L = 2.4059; LO = 0.25939; O = 0.41572; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 102; t = 543.0092; f = 1; e = 0.41283; L = 2.4151; LO = 0.2608; O = 0.41063; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 103; t = 548.4112; f = 1; e = 0.41436; L = 2.424; LO = 0.26221; O = 0.39998; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 104; t = 553.9462; f = 1; e = 0.41578; L = 2.4323; LO = 0.26362; O = 0.38563; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 105; t = 559.6296; f = 1; e = 0.41707; L = 2.4399; LO = 0.26501; O = 0.36844; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 106; t = 565.4425; f = 1; e = 0.41823; L = 2.4467; LO = 0.26638; O = 0.35069; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 107; t = 571.3544; f = 1; e = 0.41927; L = 2.4528; LO = 0.26773; O = 0.33379; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 108; t = 577.3281; f = 1; e = 0.42022; L = 2.4583; LO = 0.26905; O = 0.31864; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 109; t = 583.3404; f = 1; e = 0.42107; L = 2.4633; LO = 0.27036; O = 0.30472; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 110; t = 589.3678; f = 1; e = 0.42185; L = 2.4678; LO = 0.27165; O = 0.28988; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 111; t = 595.4149; f = 1; e = 0.42255; L = 2.4719; LO = 0.27291; O = 0.27421; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 112; t = 601.4573; f = 1; e = 0.42317; L = 2.4756; LO = 0.27415; O = 0.25859; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 113; t = 607.4772; f = 1; e = 0.42375; L = 2.4789; LO = 0.27536; O = 0.24636; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 114; t = 613.4626; f = 1; e = 0.42429; L = 2.4821; LO = 0.27654; O = 0.24016; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 115; t = 619.4283; f = 1; e = 0.42484; L = 2.4853; LO = 0.27772; O = 0.24006; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 116; t = 625.3619; f = 1; e = 0.42541; L = 2.4886; LO = 0.2789; O = 0.25028; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 117; t = 631.2815; f = 1; e = 0.42603; L = 2.4923; LO = 0.28008; O = 0.26381; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 118; t = 637.1781; f = 1; e = 0.42671; L = 2.4963; LO = 0.28127; O = 0.27625; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 119; t = 643.0675; f = 1; e = 0.42743; L = 2.5005; LO = 0.28247; O = 0.2808; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 120; t = 648.9648; f = 1; e = 0.42814; L = 2.5046; LO = 0.28364; O = 0.27143; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 121; t = 654.9006; f = 1; e = 0.42874; L = 2.5081; LO = 0.28476; O = 0.2394; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 122; t = 660.8188; f = 1; e = 0.42915; L = 2.5106; LO = 0.2858; O = 0.1675; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 123; t = 666.4446; f = 1; e = 0.42935; L = 2.5117; LO = 0.28669; O = 0.02239; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 124; t = 671.5117; f = 1; e = 0.42948; L = 2.5125; LO = 0.28747; O = 0; df = NaN
i = 125; t = 676.6677; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.28824; O = 0; df = 0
i = 126; t = 682.1052; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.28899; O = 0; df = 0
i = 127; t = 687.5374; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.28972; O = 0; df = 0
i = 128; t = 692.9651; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29043; O = 0; df = 0
i = 129; t = 698.3893; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29112; O = 0; df = 0
i = 130; t = 703.8109; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29179; O = 0; df = 0
i = 131; t = 709.2308; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29245; O = 0; df = 0
i = 132; t = 714.6504; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29309; O = 0; df = 0
i = 133; t = 720.0704; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29371; O = 0; df = 0
i = 134; t = 725.4925; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29432; O = 0; df = 0
i = 135; t = 730.9179; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29492; O = 0; df = 0
i = 136; t = 736.3473; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.2955; O = 0; df = 0
i = 137; t = 741.7828; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29607; O = 0; df = 0
i = 138; t = 747.2252; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29663; O = 0; df = 0
i = 139; t = 752.6759; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29718; O = 0; df = 0
i = 140; t = 758.1361; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29772; O = 0; df = 0
i = 141; t = 763.6066; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29825; O = 0; df = 0
i = 142; t = 769.0886; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29878; O = 0; df = 0
i = 143; t = 774.5827; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.2993; O = 0; df = 0
i = 144; t = 780.0895; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.29981; O = 0; df = 0
i = 145; t = 785.6098; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.30033; O = 0; df = 0
i = 146; t = 791.1428; f = 0.42948; e = 0.42948; L = 2.5125; LO = 0.30083; O = 0; df = 0
no convergence at point 147 after awakening 
i = 147; t = 796.7269; f = 1; e = 0.47155; L = 2.5143; LO = 0.30144; O = 0.34394; df = 0.5

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 148
i = 148; t = 800.981; f = 1; e = 0.49799; L = 2.524; LO = 0.30237; O = 0.51885; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 149
i = 149; t = 805.6546; f = 1; e = 0.53487; L = 2.5375; LO = 0.30355; O = 0.59732; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 150
i = 150; t = 810.4462; f = 1; e = 0.56109; L = 2.5542; LO = 0.30492; O = 0.63651; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 151
i = 151; t = 815.316; f = 1; e = 0.57758; L = 2.573; LO = 0.30643; O = 0.65457; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 152
i = 152; t = 820.2268; f = 1; e = 0.5848; L = 2.5928; LO = 0.30802; O = 0.65833; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 153
i = 153; t = 825.1476; f = 1; e = 0.58364; L = 2.6129; LO = 0.30964; O = 0.65067; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 154
i = 154; t = 830.0582; f = 1; e = 0.5751; L = 2.6323; LO = 0.31123; O = 0.63213; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 155
i = 155; t = 834.9285; f = 1; e = 0.55955; L = 2.6504; LO = 0.31276; O = 0.60039; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 156
i = 156; t = 839.7326; f = 1; e = 0.53843; L = 2.6664; LO = 0.31419; O = 0.55234; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 157
i = 157; t = 844.4471; f = 1; e = 0.51346; L = 2.6799; LO = 0.31546; O = 0.48281; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
no convergence at point 158
i = 158; t = 849.0564; f = 1; e = 0.48486; L = 2.6905; LO = 0.31658; O = 0.38507; df = 0

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 159; t = 854.22; f = 1; e = 0.46102; L = 2.697; LO = 0.31753; O = 0.25673; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 160; t = 859.5689; f = 1; e = 0.4616; L = 2.7003; LO = 0.31833; O = 0.10721; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 161; t = 864.7669; f = 1; e = 0.46186; L = 2.7019; LO = 0.31902; O = 0; df = NaN
i = 162; t = 869.7281; f = 0.46186; e = 0.46186; L = 2.7019; LO = 0.31969; O = 0; df = 0
i = 163; t = 875.4883; f = 0.46186; e = 0.46186; L = 2.7019; LO = 0.32037; O = 0; df = 0
i = 164; t = 881.2452; f = 0.46186; e = 0.46186; L = 2.7019; LO = 0.32107; O = 0; df = 0
i = 165; t = 886.9957; f = 0.46186; e = 0.46186; L = 2.7019; LO = 0.32177; O = 0; df = 0
i = 166; t = 892.7369; f = 0.46186; e = 0.46186; L = 2.7019; LO = 0.32249; O = 0; df = 0
no convergence at point 167 after awakening 
i = 167; t = 898.4471; f = 1; e = 0.46261; L = 2.7019; LO = 0.32322; O = 0.0084916; df = 0.5

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 168; t = 903.5607; f = 1; e = 0.46214; L = 2.7035; LO = 0.32397; O = 0.021462; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 169; t = 908.7053; f = 1; e = 0.46242; L = 2.7052; LO = 0.32474; O = 0.020191; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 170; t = 913.8278; f = 1; e = 0.46268; L = 2.7067; LO = 0.3255; O = 0.0073991; df = NaN

1 0.000000
2 3 4 
 no convergence within 5 generations 

5 0.000000
i = 171; t = 918.8997; f = 1; e = 0.46293; L = 2.7082; LO = 0.32627; O = 0; df = NaN
i = 172; t = 923.9422; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.32704; O = 0; df = 0
i = 173; t = 929.574; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.32782; O = 0; df = 0
i = 174; t = 935.1743; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.32861; O = 0; df = 0
i = 175; t = 940.7518; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.32939; O = 0; df = 0
i = 176; t = 946.2958; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33018; O = 0; df = 0
i = 177; t = 951.8095; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33097; O = 0; df = 0
i = 178; t = 957.2934; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33176; O = 0; df = 0
i = 179; t = 962.7441; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33255; O = 0; df = 0
i = 180; t = 968.1638; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33333; O = 0; df = 0
i = 181; t = 973.5519; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33411; O = 0; df = 0
i = 182; t = 978.9071; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33488; O = 0; df = 0
i = 183; t = 984.2341; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33564; O = 0; df = 0
i = 184; t = 989.5262; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33639; O = 0; df = 0
i = 185; t = 994.7838; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33714; O = 0; df = 0
i = 186; t = 1000.0113; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33787; O = 0; df = 0
i = 187; t = 1005.2073; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33858; O = 0; df = 0
i = 188; t = 1010.3726; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33929; O = 0; df = 0
i = 189; t = 1015.5083; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.33998; O = 0; df = 0
i = 190; t = 1020.6149; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34065; O = 0; df = 0
i = 191; t = 1025.6935; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34131; O = 0; df = 0
i = 192; t = 1030.7457; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34196; O = 0; df = 0
i = 193; t = 1035.7728; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34259; O = 0; df = 0
i = 194; t = 1040.7768; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34321; O = 0; df = 0
i = 195; t = 1045.7597; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34381; O = 0; df = 0
i = 196; t = 1050.7238; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34439; O = 0; df = 0
i = 197; t = 1055.6719; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34497; O = 0; df = 0
i = 198; t = 1060.6069; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34552; O = 0; df = 0
i = 199; t = 1065.532; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.34607; O = 0; df = 0
i = 200; t = 1070.4509; f = 0.46293; e = 0.46293; L = 2.7082; LO = 0.3466; O = 0; df = 0
</pre><h2>start plotting<a name="5"></a></h2><pre class="codeinput">subplot(2,3,1)
plot(tcf(:,1), tcf(:,2), <span class="string">'g'</span>, tcfeLLOO(:,1), tcfeLLOO(:,2), <span class="string">'r'</span>)
xlabel(<span class="string">'time'</span>)
ylabel(<span class="string">'c_T'</span>)

subplot(2,3,2)
plot(tcf(:,1), tcf(:,3), <span class="string">'g'</span>, tcfeLLOO(:,1), tcfeLLOO(:,3), <span class="string">'r'</span>)
xlabel(<span class="string">'time'</span>)
ylabel(<span class="string">'f'</span>)

subplot(2,3,3)
plot(teLLOO(:,1), teLLOO(:,2), <span class="string">'g'</span>, tcfeLLOO(:,1), tcfeLLOO(:,4), <span class="string">'r'</span>)
xlabel(<span class="string">'time'</span>)
ylabel(<span class="string">'e'</span>)

subplot(2,3,4)
plot(teLLOO(:,1), teLLOO(:,3), <span class="string">'g'</span>, tcfeLLOO(:,1), tcfeLLOO(:,5), <span class="string">'r'</span>)
xlabel(<span class="string">'time'</span>)
ylabel(<span class="string">'L'</span>)

subplot(2,3,5)
plot(teLLOO(:,1), teLLOO(:,4), <span class="string">'g'</span>, tcfeLLOO(:,1), tcfeLLOO(:,6), <span class="string">'r'</span>)
xlabel(<span class="string">'time'</span>)
ylabel(<span class="string">'L_O'</span>)

subplot(2,3,6)
plot(LOO(:,1), LOO(:,2), <span class="string">'g'</span>, tcfeLLOO(:,6), tcfeLLOO(:,7), <span class="string">'r'</span>)
xlabel(<span class="string">'L_O'</span>)
ylabel(<span class="string">'O'</span>)
</pre><img vspace="5" hspace="5" src="mydata_of_01.png" alt=""> <p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% Demonstrates the use of f2o and o2f
%  We first obtain (otolith-length,opacity( data from functional response trajectory
%    then we reconstruct functional response trajectory from (otolith-length,opacity) data
%    and test the result graphically
%  shrinking is not allowed, on the assumption that the reproduction buffer is large enough
%  we assume k_J = k_M for simplicity's sake (implying stage transitions at fixed length)
%  we use volumetric length for body and otolith
%  if d/dt f changes slowly,  we have f about equal to e

%% 2006/03/27 Set anchovy parameters
  Lb = .1; % 1, d.cm^2, scaled maturity at birth
  Lp = 1.6; % 2, d.cm^2, scaled maturity at puberty
  v = .031748 * 16.5838; % 3, cm/d, energy conductance * M shape correction factor
  vOD = 1.1861e-005; % 4, mum/d, otolith speed for dissipation
  vOG = .00011049; % 5, mum/d, otolith speed for growth
  kM = .015; % 6, 1/d, somatic maintenance rate coeff
  g = 6; % 7, -, energy investment ratio
  kap = 0.65; % 8, was 0.65;% -, Veer
  kapR = 0.95; % 9, -, Fraction of reproduction energy fixed in eggs; ref = ;
  delS = 20;% 10, -, shape of the otosac
par = [Lb; Lp; v; vOD; vOG; kM; g; kap; kapR; delS];

t = linspace(0,3*365,200)'; % time points for simulation 

TA = 9800; % K, Arrhenius temperature ; ref = after Regner 1996;
T1 = 286; % K, Reference temperature ;
T = 286 + 1.85 * sin(2 * pi * (t + 207)/ 365); % K, temp at time t
cor_T = exp(TA/ T1 - TA ./ T); % temp correction factors

p5 = 1.0e+002 * ...
   [3.650000000000000 0.000338436258255;
   0.000139797026871 -0.000061529908266;
  -0.000140529304759 -0.000037548182856;
   0.000005704656069  0.000066063518408;
   0.000047981953130  0.000016729882406;
  -0.000005258679892 -0.000022614364105];

X = fnfourier(mod(t, 365), p5);
K = .045; % chlo_a/d.m^2, saturation constant
f = X ./ (K + X); % scaled functional response
tcf = [t, cor_T, f]; % pack environmental forcing

%% from scaled functional response f to opacity o
LOb = .01; eb = .85; % LO and e at birth
[LOO, teLLOO] = f2o(tcf, eb, LOb, par); % get otolith, state vars

%% from opacity o to scaled functional response f
tc = tcf(:,[1 2]); % remove unknown f

%% tcfeLLOO = o2f_init(LOO, tc, par, teLLOO(end,3)); % get initial estimate
tcfeLLOO = o2f(LOO, tc, par); % get best estimate (less robust)

%% start plotting
subplot(2,3,1)
plot(tcf(:,1), tcf(:,2), 'g', tcfeLLOO(:,1), tcfeLLOO(:,2), 'r')
xlabel('time')
ylabel('c_T')

subplot(2,3,2)
plot(tcf(:,1), tcf(:,3), 'g', tcfeLLOO(:,1), tcfeLLOO(:,3), 'r')
xlabel('time')
ylabel('f')

subplot(2,3,3)
plot(teLLOO(:,1), teLLOO(:,2), 'g', tcfeLLOO(:,1), tcfeLLOO(:,4), 'r')
xlabel('time')
ylabel('e')

subplot(2,3,4)
plot(teLLOO(:,1), teLLOO(:,3), 'g', tcfeLLOO(:,1), tcfeLLOO(:,5), 'r')
xlabel('time')
ylabel('L')

subplot(2,3,5)
plot(teLLOO(:,1), teLLOO(:,4), 'g', tcfeLLOO(:,1), tcfeLLOO(:,6), 'r')
xlabel('time')
ylabel('L_O')

subplot(2,3,6)
plot(LOO(:,1), LOO(:,2), 'g', tcfeLLOO(:,6), tcfeLLOO(:,7), 'r')
xlabel('L_O')
ylabel('O')

##### SOURCE END #####
--></body></html>

<|start_filename|>animal/html/get_pars_u.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>get_pars_u</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2015-02-06"><meta name="DC.source" content="get_pars_u.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>get_pars_u</h1><!--introduction--><p>Gets primary parameters from compound parameters</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#3">Syntax</a></li><li><a href="#4">Description</a></li><li><a href="#5">Remarks</a></li><li><a href="#6">Example of use</a></li></ul></div><h2>Syntax<a name="3"></a></h2><p>[par, aLM] = <a href="../get_pars_u.m"><b>get_pars_u</b></a>(q, p)</p><h2>Description<a name="4"></a></h2><p>Gets primary parameters from compound parameters Surface linked somatic maintenance costs are not included</p><p>Input</p><div><ul><li>q: 4-vector with</li></ul></div><pre>  1 JXAm  % mmol/d.mm^2 % {J_{XAm}} max spec food uptake rate
  2 K     % M    % half saturation coefficient
  3 ME0   % mol  % M_E^0 mass at time 0 (all mass consists of reserve)
  4 MWb   % mol  % M_W^b mass at birth (reserve plus structure)
  this data must be supplied to convert compound to primary pars
  we here assume that ME0 and MWb are given at abundant food
  (reserve density at birth equals that of the mother at egg production)</pre><div><ul><li>p: 8-vector with</li></ul></div><pre>  1 kap   % -      % fraction allocated to som maint + growth
  2 kapR  % -      % fraction of energy to reprod that is fixed in embryo
  3 g     % -      % energy investment ratio
  4 kJ    % d^-1   % maturity maintenance rate coefficient
  5 kM    % d^-1   % somatic maintenance rate coefficient
  6 v     % mm/d   % energy conductance
  7 Hb    % d.mm^2 % scaled maturity at birth M_H^b/{J_EAm}
  8 Hp    % d.mm^2 % scaled maturity at puberty M_H^p/{J_EAm}
  this vector is output of get_pars_s</pre><p>Output</p><div><ul><li>par: 12-vector with primary pars of standard DEB model</li></ul></div><pre>  1  JEAm % mmol/d.mm^2 % {J_{EAm}} max spec assimilation rate
  2  b    % m^3/ d.mm^2 % {b} spec searching rate
  3  yEX  % mol/mol     % y_EX yield of reserve on food
  4  yVE  % mol/mol     % y_VE yield of structure on reserve
  5  v    % mm/d        % energy conductance
  6  JEM  % mol/d.mm^3  % [J_{EM}] spec somatic maintenance costs
  7  kJ   % 1/d         % k_J maturity maintenance rate coefficient
  8  kap  % -           % \kappa fraction to som maint + growth
  9  kapR % -           % \kappa_R fraction fixed in embryo
 10  MHb  % mol         % M_H^b maturity at birth
 11  MHp  % mol         % M_H^p maturity at puberty
 12  MV   % mol/ mm^3   % [M_V] mass-volume converter for structure</pre><div><ul><li>aLM: (4,4)-matrix with</li></ul></div><pre>  age a, length L, mass of reserve M_E, mass of structure M_V
  at age 0, at birth, at puberty, at infinity</pre><h2>Remarks<a name="5"></a></h2><p>Notice that all quantities that involve length depend on the shape unless if chosen for volumetric lengths</p><h2>Example of use<a name="6"></a></h2><p>See <a href="../mydata_get_pars.m"><b>mydata_get_pars</b></a></p><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% get_pars_u
% Gets primary parameters from compound parameters

%%
function [par, aLM] = get_pars_u(q, p)
  %  created 2007/01/27 by <NAME>, modified 2007/08/07
  
  %% Syntax
  % [par, aLM] = <../get_pars_u.m *get_pars_u*>(q, p)
  
  %% Description
  % Gets primary parameters from compound parameters
  % Surface linked somatic maintenance costs are not included
  %
  % Input
  %
  % * q: 4-vector with
  %
  %    1 JXAm  % mmol/d.mm^2 % {J_{XAm}} max spec food uptake rate
  %    2 K     % M    % half saturation coefficient
  %    3 ME0   % mol  % M_E^0 mass at time 0 (all mass consists of reserve)
  %    4 MWb   % mol  % M_W^b mass at birth (reserve plus structure)
  %    this data must be supplied to convert compound to primary pars
  %    we here assume that ME0 and MWb are given at abundant food
  %    (reserve density at birth equals that of the mother at egg production)
  %
  % * p: 8-vector with
  %
  %    1 kap   % -      % fraction allocated to som maint + growth
  %    2 kapR  % -      % fraction of energy to reprod that is fixed in embryo
  %    3 g     % -      % energy investment ratio
  %    4 kJ    % d^-1   % maturity maintenance rate coefficient
  %    5 kM    % d^-1   % somatic maintenance rate coefficient
  %    6 v     % mm/d   % energy conductance
  %    7 Hb    % d.mm^2 % scaled maturity at birth M_H^b/{J_EAm}
  %    8 Hp    % d.mm^2 % scaled maturity at puberty M_H^p/{J_EAm}
  %    this vector is output of get_pars_s
  %
  % Output
  %
  % * par: 12-vector with primary pars of standard DEB model
  %
  %    1  JEAm % mmol/d.mm^2 % {J_{EAm}} max spec assimilation rate
  %    2  b    % m^3/ d.mm^2 % {b} spec searching rate
  %    3  yEX  % mol/mol     % y_EX yield of reserve on food
  %    4  yVE  % mol/mol     % y_VE yield of structure on reserve
  %    5  v    % mm/d        % energy conductance
  %    6  JEM  % mol/d.mm^3  % [J_{EM}] spec somatic maintenance costs
  %    7  kJ   % 1/d         % k_J maturity maintenance rate coefficient
  %    8  kap  % -           % \kappa fraction to som maint + growth
  %    9  kapR % -           % \kappa_R fraction fixed in embryo 
  %   10  MHb  % mol         % M_H^b maturity at birth
  %   11  MHp  % mol         % M_H^p maturity at puberty
  %   12  MV   % mol/ mm^3   % [M_V] mass-volume converter for structure
  %
  % * aLM: (4,4)-matrix with 
  %
  %    age a, length L, mass of reserve M_E, mass of structure M_V
  %    at age 0, at birth, at puberty, at infinity
  
  %% Remarks
  % Notice that all quantities that involve length depend on the shape unless if chosen for volumetric lengths

  %% Example of use
  % See <../mydata_get_pars.m *mydata_get_pars*>

  % unpack q
  JXAm = q(1); K   = q(2); ME0 = q(3); MWb = q(4);
  % unpack p
  kap = p(1); kapR = p(2); g   = p(3); kJ  = p(4);
  kM  = p(5); v    = p(6); Hb  = p(7); Hp  = p(8);

  Lm = v/ (kM * g); % max length for transfer to dget_aul
  f = 1; % scaled functional response for transfer to dget_aul_p

  % get initial scaled reserve, assuming abundant food (f = 1)
  [U0, Lb, info] = initial_scaled_reserve(f, [Hb/(1-kap); g; kJ; kM; v]);
  if info ~= 1
    fprintf('problems in finding initial scaled reserve\n');
  end

  % get states at birth: age, scaled reserve, length
  ab = get_tb([g; kJ/ kM], f, Lb/ Lm)/ kM;
  Ub = f * Lb^3/ v; 
 
  b    = JXAm/ K;
  JEAm = ME0/ U0;
  yEX  = JEAm/ JXAm;
  MHb  = JEAm * Hb;
  MHp  = JEAm * Hp;
  MEb  = JEAm * Ub;
  MVb  = MWb - MEb;
  MV   = MVb/ Lb^3;
  yVE  = v * MV/ (kap * JEAm * g);
  JEM  = kM * MV/ yVE;
  
  % pack parameters of the standard model
  par = [JEAm; b; yEX; yVE; v; JEM; kJ; kap; kapR; MHb; MHp; MV];

  % get states at puberty: age, scaled reserve, length
  [H, aUL] = ode45(@dget_aul_p, [Hb;Hp], [ab, Ub, Lb], [], kap, v, kJ, g, Lm, f);
  ap = aUL(end,1); Up = aUL(end,2); Lp = aUL(end,3);
  MEp = JEAm * Up; MVp = MV * Lp^3;

  % states at infinite age
  MVm = MV * Lm^3; MEm = MEp * (Lm/ Lp)^3;

  % pack states 
  aLM = [ 0,  0, ME0,   0;
	 ab, Lb, MEb, MVb;
	 ap, Lp, MEp, MVp;
	Inf, Lm, MEm, MVm];
##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebttint.h<|end_filename|>
/***
   NAME
     ebttint.h
   PURPOSE
     Interface header file to the functions defined in ebttint.c
   NOTES
     
   HISTORY
     AMdR - Nov 08, 1998 : Created.
     AMdR - Nov 15, 2015 : Revised last.
***/

#ifndef EBTTINT_H
#define EBTTINT_H

#ifdef	EBTTINT_C
#undef	EXTERN
#define EXTERN
#else
#undef	EXTERN
#define EXTERN	extern
#endif

EXTERN void	PrepareCycle(void);
EXTERN double	IntegrationStep(double, double, int);


/*===========================================================================*/
#endif /* EBTTINT_H */


<|start_filename|>animal/html/get_pars.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>get_pars_* and iget_pars_* and elas_pars_*</title><meta name="generator" content="MATLAB 7.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2014-01-04"><meta name="DC.source" content="get_pars.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style></head><body><div class="content"><h1>get_pars_* and iget_pars_* and elas_pars_*</h1><!--introduction--><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Description</a></li><li><a href="#2">Remarks</a></li><li><a href="#3">Example of use</a></li></ul></div><h2>Description<a name="1"></a></h2><pre>Functions get_pars_* obtain compound DEB parameters from easy-to-observe quantities
Functions iget_pars_* do the reverse, which can be used for checking.</pre><pre>The routines are organized as follows</pre><pre class="codeinput"><span class="comment">%	               |            get_pars   	          |             iget_pars               |</span>
<span class="comment">%  food level      |	one 	      several 	      | one               several           |</span>
<span class="comment">%  constraint      | kJ = kM    kJ != kM   kJ = kM 	  | kJ = kM 	kJ != kM 	kJ = kM     |</span>
<span class="comment">%  growth 	       | get_pars_g get_pars_h get_pars_i |	iget_pars_g iget_pars_h iget_pars_i |</span>
<span class="comment">%  growth &amp; reprod | get_pars_r get_pars_s get_pars_t |	iget_pars_r iget_pars_s iget_pars_s |</span>
<span class="comment">%                  |            get_pars_9            |             iget_pars_9             |</span>
<span class="comment">%</span>
<span class="comment">% Functions for several food levels do not use age at birth data.</span>
<span class="comment">% If one food level is available, we have to make use of the assumption of stage transitions at fixed amounts of structure (k_M = k_J).</span>
<span class="comment">% If several food levels are available, we no longer need to make this assumption, but it does simplify matters considerably.</span>
<span class="comment">% Functions elas_pars_g and elas_pars_r give elasticity coefficients.</span>
<span class="comment">% Function get_pars_u converts compound parameters into unscaled primary parameters at abundant food.</span>
<span class="comment">% Function get_pars_9 converts data into unscaled primary parameters at abundant food.</span>
<span class="comment">%</span>
</pre><h2>Remarks<a name="2"></a></h2><pre>The theory is discussed in KooySous2008 and LikaAugu2013.
The heating length LT is assumed to be zero in all get_pars_* functions.</pre><h2>Example of use<a name="3"></a></h2><pre>See mydata_get_pars and mydata_get_pats_9.</pre><p class="footer"><br>
      Published with MATLAB&reg; 7.14<br></p></div><!--
##### SOURCE BEGIN #####
%% get_pars_* and iget_pars_* and elas_pars_*
%
%% Description
%  Functions get_pars_* obtain compound DEB parameters from easy-to-observe quantities
%  Functions iget_pars_* do the reverse, which can be used for checking. 
%
%  The routines are organized as follows
%
%	               |            get_pars   	          |             iget_pars               | 
%  food level      |	one 	      several 	      | one               several           |
%  constraint      | kJ = kM    kJ != kM   kJ = kM 	  | kJ = kM 	kJ != kM 	kJ = kM     |
%  growth 	       | get_pars_g get_pars_h get_pars_i |	iget_pars_g iget_pars_h iget_pars_i |
%  growth & reprod | get_pars_r get_pars_s get_pars_t |	iget_pars_r iget_pars_s iget_pars_s |
%                  |            get_pars_9            |             iget_pars_9             |
%
% Functions for several food levels do not use age at birth data. 
% If one food level is available, we have to make use of the assumption of stage transitions at fixed amounts of structure (k_M = k_J). 
% If several food levels are available, we no longer need to make this assumption, but it does simplify matters considerably. 
% Functions elas_pars_g and elas_pars_r give elasticity coefficients. 
% Function get_pars_u converts compound parameters into unscaled primary parameters at abundant food. 
% Function get_pars_9 converts data into unscaled primary parameters at abundant food. 
%
%% Remarks
%  The theory is discussed in KooySous2008 and LikaAugu2013. 
%  The heating length LT is assumed to be zero in all get_pars_* functions.
%
%% Example of use
%  See mydata_get_pars and mydata_get_pats_9. 

##### SOURCE END #####
--></body></html>

<|start_filename|>popDyn/EBTtool/fns/ebtutils.c<|end_filename|>
/***
   NAME
     ebtutils.c
   PURPOSE
     This file contains the output routines FileOut() and FileState() plus
     all low level routines that are processing memory allocation
     requests and issuing error and warning messages. The routines are
     called from a number of different modules.
   NOTES

   HISTORY
     AMdR - Jul 19, 1995 : Created.
     AMdR - May 13, 2016 : Revised last.
***/
#define	EBTUTILS_C				/* Identification of file   */
#define	EBTLIB					/* and file grouping	    */

#include "escbox.h"				/* Include general header   */
#include "ebtmain.h"
#include "ebtstop.h"
#include "ebtutils.h"

/* <NAME> 2020/04/02 */
#include "ebttint.h"

#include "ebtcsbdefs.h"                         /* Definition of Envdim and Popdim*/

#ifdef __cplusplus
#undef EBTDEBUG
#define EBTDEBUG(a)	0
#endif

#if (HAS_MALLINFO && EBTDEBUG(5))
#include "malloc.h"
#endif /* HAS_MALLINFO */

// Magic key of the type of CSB file written
const uint32_t		CSB_MAGIC_KEY = 20030509;



/*==========================================================================*/
/*
 * The error messages that occur in the routines in the present file.
 */

#define ECSB "Error writing to CSB file. Further state output will be disabled!"
#define IPAC "Invalid population number in request to add cohorts: AddCohorts()!"
#define ICAC "Invalid cohort number in request to add cohorts: AddCohorts()!"
#define MAFC "Memory allocation failure for cohort variables!"
#define MAFI "Memory allocation failure for cohort constants!"



/*==========================================================================*/
/*
 * Start of function implementations.
 */
/*==============================================================================*/

int	  imin(int a, int b)

{
  return (a < b) ? a : b;
}




/*==============================================================================*/

int	  imax(int a, int b)

{
  return (a > b) ? a : b;
}




/*==============================================================================*/

double	  min(double a, double b)

{
  return (a < b) ? a : b;
}




/*==============================================================================*/

double	  max(double a, double b)

{
  return (a > b) ? a : b;
}




/*==============================================================================*/

int	  iszero(double a)

{
  /*
   * return (fabs(a) < equal2zero);
   */

  return (fabs(a) < identical_zero);
}




/*==============================================================================*/

int	  ismissing(double a)

{
  return (fabs(a) > 0.95*MISSING_VALUE);
}




/*==============================================================================*/

int	  isequal(double a, double b)

{
  double		diff;

  diff = fabs(a - b);

  /*
   * return ((diff < equal2zero) || (diff < 0.5*equal2zero*(fabs(a)+fabs(b))));
   */

  return ((diff < identical_zero) || (diff < 0.5*identical_zero*(fabs(a)+fabs(b))));
}




/*==============================================================================*/

void	  SetStepSize(double newstep)

{
  step_size = newstep;

  return;
}




/*==============================================================================*/

void	  ErrorAbort(CONST char *mes)

  /*
   * ErrorAbort - Routine issues an error message and exits immediately
   *		  without trying to save the state of the system.
   */

{
#ifndef MODULE
  char                  rn[MAXFILENAMELEN];

  (void)strcpy(rn, runname);
  rn[strlen(rn)-1] = '\0';			// Remove trainling dot

  (void)fprintf(stderr, "\nRUN %-s: ERROR at T = %.2f:\n", rn, env[0]);
  (void)fprintf(stderr, "** %-70s **\n", mes);
  (void)fprintf(stderr, "** %-70s **\n\n",
		"Normal closure of output files failed.");
  exit(1);
#else
  strcpy(error_msg, mes);
  strcat(error_msg, "\nNormal closure of output files failed.");
  error_code |= FATAL_ERROR;
#endif

  return;
}


/*==========================================================================*/

void	  ErrorExit(CONST int exitcode, CONST char *mes)

  /*
   * ErrorExit - Routine issues an error message and tries to call the
   *		 ShutDown() routine to save the state of the system. The
   *		 program subsequently terminates.
   */

{
#ifndef MODULE
  char                  rn[MAXFILENAMELEN];

  (void)strcpy(rn, runname);
  rn[strlen(rn)-1] = '\0';			// Remove trainling dot

  (void)fprintf(stderr, "\nRUN %-s: ERROR at T = %.2f:\n", rn, env[0]);
  (void)fprintf(stderr, "** %-70s **\n", mes);
  (void)fprintf(stderr, "** %-70s **\n\n",
		"Normal closure of output files attempted.");
  ShutDown(exitcode);
#else
  // put things in error message for tool to read
  strcpy(error_msg, mes);
  strcat(error_msg, "\nNormal closure of output files attempted.");
  error_code |= FATAL_ERROR;
#endif

  return;
}



/*==========================================================================*/

void	  Warning(CONST char *mes)

  /*
   * Warning - Routine issues a warning message pertaining to the current
   *	       state of the program. The program continues normally.
   */

{
#ifndef MODULE
  char                  rn[MAXFILENAMELEN];

  (void)strcpy(rn, runname);
  rn[strlen(rn)-1] = '\0';			// Remove trainling dot

  (void)fprintf(stderr, "\nRUN %-s: WARNING at T = %.2f:\n", rn, env[0]);
  (void)fprintf(stderr, "** %-70s **\n", mes);
  (void)fprintf(stderr, "** %-70s **\n\n", "Program continues normally.");
#else
  strcpy(error_msg, mes);
  strcat(error_msg, "\nProgram continues normally.");
  error_code |= WARNING;
#endif

  return;
}




/*==========================================================================*/
#if (HAS_MALLINFO && EBTDEBUG(5))
#define SKIP_CALLS	10
static long unsigned	call_nr = 0L;
struct mallinfo		malloc_info;
#endif /* HAS_MALLINFO */

void	*Myalloc(void *pnt, size_t count, size_t eltsize)

  /*
   * Myalloc - Replacement routine for the 'calloc()' and 'realloc()'
   *	       functions.  Allocates or reallocates memory and sets it to 0.
   *	       Implemented to watch memory use.
   */

{
  size_t		size;
  void			*value;

#if (HAS_MALLINFO && EBTDEBUG(5))
  call_nr++;
  if (!(call_nr%SKIP_CALLS))
    {
      malloc_info = mallinfo();
      (void)fprintf(stderr, "Myalloc #%12ld  in:", call_nr);
      (void)fprintf(stderr, "\tBlocks free: %8d  total: %8d",
		    malloc_info.fordblks,
		    malloc_info.uordblks);
      (void)fprintf(stderr, "\tChunks free: %8d  Arena: %8d  \n",
		    malloc_info.ordblks,
		    malloc_info.arena);
    }
#endif /* HAS_MALLINFO */

  size	= count * eltsize;
  if (pnt)					/* Reallocation call        */
      value = (void *)realloc((DEF_TYPE *)pnt, (SIZE_TYPE)size);
  else						/* Allocation call	    */
    {
      value = (void *)malloc((SIZE_TYPE)size);
      if (value != NULL) (void)memset((DEF_TYPE *)value, 0, size);
    }

#if (HAS_MALLINFO && EBTDEBUG(5))
  if (!(call_nr%SKIP_CALLS))
    {
      malloc_info = mallinfo();
      (void)fprintf(stderr, "Myalloc #%12ld out:", call_nr);
      (void)fprintf(stderr, "\tBlocks free: %8d  total: %8d",
		    malloc_info.fordblks,
		    malloc_info.uordblks);
      (void)fprintf(stderr, "\tChunks free: %8d  Arena: %8d  \n",
		    malloc_info.ordblks,
		    malloc_info.arena);
    }
#endif /* HAS_MALLINFO */

  return value;
}



/*==========================================================================*/

void	  PrettyPrint(FILE *fp, double value)

/*
 * PrettyPrint - Formatted print of output to the file pointed to by fp.
 */

{
#if !defined(_MSC_VER)
  int fpclass = fpclassify(value);

  if (fpclass == FP_NORMAL)
#endif
    {
      if (((fabs(value) <= 1.0E4) && (fabs(value) >= 1.0E-4)) || (value == 0))
	(void)fprintf(fp, "%.10f", value);
      else
	(void)fprintf(fp, "%.6E", value);
    }
#if !defined(_MSC_VER)
  else (void)fprintf(fp, "%E", value);
#endif

  return;
}
/*==========================================================================*/

void	  WriteStateToFile(FILE *fp, double *data)

/*
 * WriteStateToFile - Routine writes the entire state of the populations
 *		      and the environment to the file pointed to by fp.
 */

{
  register int		i;

  // Write environment state
  for(i=0; i<ENVIRON_DIM; i++)
    {
      if (i) (void)fprintf(fp, "\t");
      if (data) PrettyPrint(fp, data[i]);
      else PrettyPrint(fp, env[i]);
    }
  (void)fprintf(fp, "\n\n");

#if (POPULATION_NR > 0)
  register int		j, k;
  int			len = ENVIRON_DIM;
  population		lpop = NULL;

  for(i=0; i<POPULATION_NR; i++)
    {
      // Write boundary cohorts
      if (data) lpop = (population)(data + len + CohortNo[i]*COHORT_SIZE);
      for(j=BpointNo[i]-1; (j>=0); j--)
	{
	  for(k=0; k<COHORT_SIZE; k++)
	    {
	      if (k) (void)fprintf(fp, "\t");
	      if (data) PrettyPrint(fp, lpop[j][k]);
	      else PrettyPrint(fp, ofs[i][j][k]);
	    }
#if (I_CONST_DIM > 0)
	  for(k=0; k<I_CONST_DIM; k++)
	    {
	      (void)fprintf(fp, "\t");
	      PrettyPrint(fp, ofsIDcard[i][j][k]);
	    }
#endif
	  (void)fprintf(fp, "\n");
	}

      // Write internal cohorts
      if (data) lpop = (population)(data + len);
      for(j=CohortNo[i]-1; (j>=0); j--)
	{
	  for(k=0; k<COHORT_SIZE; k++)
	    {
	      if (k) (void)fprintf(fp, "\t");
	      if (data) PrettyPrint(fp, lpop[j][k]);
	      else PrettyPrint(fp, pop[i][j][k]);
	    }
#if (I_CONST_DIM > 0)
	  for(k=0; k<I_CONST_DIM; k++)
	    {
	      (void)fprintf(fp, "\t");
	      PrettyPrint(fp, popIDcard[i][j][k]);
	    }
#endif
	  (void)fprintf(fp, "\n");
	}

      if (!CohortNo[i])
	{
	  for(j=0; j<(COHORT_SIZE+I_CONST_DIM); j++)
	    {
	      if (j) (void)fprintf(fp, "\t");
	      (void)fprintf(fp, "%f", 0.0);
	    }
	  (void)fprintf(fp, "\n");
	}
      else len += (CohortNo[i]+BpointNo[i])*COHORT_SIZE;

      (void)fprintf(fp, "\n");
    }
#endif // (POPULATION_NR > 0)

  return;
}




/*==========================================================================*/
#if (POPULATION_NR > 0)

static void	  WriteBinStateToFile(FILE *fp)

/*
 * WriteBinStateToFile - Routine writes the entire state of the populations
 *		         and the environment in binary format to the file
 *			 pointed to by fp.
 */

{
  register int		i, j, k;
  int			writeOK;
  size_t		hdrdbls, lbldbls;
  Envdim		cenv[2];
  Popdim		cpop[2];
  double		zero = 0.0;

  hdrdbls  = (sizeof(Envdim)/sizeof(double))+1;
  (void)memset((DEF_TYPE *)cenv, 0, hdrdbls*sizeof(double));

  cenv->timeval      = env[0];
  cenv->columns      = ENVIRON_DIM;
  cenv->data_offset  = hdrdbls;
  cenv->memory_used  = hdrdbls*sizeof(double);
  cenv->memory_used += ENVIRON_DIM*sizeof(double);
  for (i=0; i<POPULATION_NR; i++)
    {
      hdrdbls = (sizeof(Popdim)/sizeof(double))+1;
      lbldbls = (strlen(statelabels[i])*sizeof(char))/sizeof(double)+1;
      cenv->memory_used += (hdrdbls+lbldbls)*sizeof(double);
      cenv->memory_used += (imax(CohortNo[i], 1)*
			    (COHORT_SIZE+I_CONST_DIM)*sizeof(double));
    }

  hdrdbls  = (sizeof(Envdim)/sizeof(double))+1;
  writeOK  = (fwrite((void *)cenv, 1, hdrdbls*sizeof(double), fp) == (hdrdbls*sizeof(double)));

  if (writeOK)
    writeOK = (fwrite((void *)env, 1, ENVIRON_DIM*sizeof(double), fp) == (ENVIRON_DIM*sizeof(double)));

  for (i=0; (i<POPULATION_NR) && (writeOK); i++)
    {
      hdrdbls = (sizeof(Popdim)/sizeof(double))+1;
      lbldbls = (strlen(statelabels[i])*sizeof(char))/sizeof(double)+1;
      (void)memset((DEF_TYPE *)cpop, 0, hdrdbls*sizeof(double));
      cpop->timeval     = env[0];
      cpop->population  = i;
      cpop->columns     = (COHORT_SIZE+I_CONST_DIM);
      cpop->cohorts     = imax(CohortNo[i], 1);
      cpop->data_offset = hdrdbls+lbldbls;
      cpop->lastpopdim  = (i == (POPULATION_NR-1));

      writeOK = (fwrite((void *)cpop, 1, hdrdbls*sizeof(double), fp) == (hdrdbls*sizeof(double)));
      if (!writeOK) break;

      writeOK = (fwrite((void *)statelabels[i], 1, lbldbls*sizeof(double), fp) == (lbldbls*sizeof(double)));
      if (!writeOK) break;

      if (CohortNo[i])
	{
	  for(k=0; (k<COHORT_SIZE) && writeOK; k++)
	    for(j=CohortNo[i]-1; (j>=0) && writeOK; j--)
	      writeOK = (fwrite((void *)(pop[i][j]+k), sizeof(double), 1, fp) == 1);
#if (I_CONST_DIM > 0)
	  for(k=0; (k<I_CONST_DIM) && writeOK; k++)
	    for(j=CohortNo[i]-1; (j>=0) && writeOK; j--)
	      writeOK = (fwrite((void *)(popIDcard[i][j]+k), sizeof(double), 1, fp) == 1);
#endif
	}
      else
	for(k=0; (k<(COHORT_SIZE+I_CONST_DIM)) && writeOK; k++)
	  writeOK = (fwrite((void *)&zero, sizeof(double), 1, fp) == 1);
    }

  (void)fflush(fp);				/* Flush the file buffer    */

  if (!writeOK)
    {
      Warning(ECSB);
      (void)fclose(fp);
      csbfil = NULL;
    }

  return;
}


#endif // (POPULATION_NR > 0)


/*==========================================================================*/

void	  FileOut()

  /*
   * FileOut - Routine sends output to file. All output statistics are
   *	       defined by the user, except for the first one which is the
   *	       current time value.
   */

{
  register int		i;

  for(i=0; i<OUTPUT_VAR_NR; i++) output[i]=0.0;
#if (POPULATION_NR > 0)
  for(i=0; i<POPULATION_NR; i++) cohort_no[i] = CohortNo[i];
#endif // (POPULATION_NR > 0)

#if (POPULATION_NR > 0)
  DefineOutput(env, pop, output);		/* User output values       */
#else
  DefineOutput(env, NULL, output);		/* User output values       */
#endif // (POPULATION_NR > 0)

#if (BIFURCATION == 1)
  // Add bifurcation parameter as last column
  output[OUTPUT_VAR_NR] = parameter[BifParIndex];
#endif // (BIFURCATION == 1)

  (void)fprintf(resfil, "%.2f", env[0]);
  for(i=0; i<exp_output_var_nr(); i++)
    {
      (void)fprintf(resfil, "\t");
      PrettyPrint(resfil, output[i]);
    }
  (void)fprintf(resfil, "\n"); (void)fflush(resfil);

  for(i=exp_output_var_nr(); i>0; i--) output[i] = output[i-1];
  output[0] = env[0];

  return;
}




/*==========================================================================*/
#if (POPULATION_NR > 0)

void	  FileState()

  /*
   * FileState - Routine writes the entire state of the environment and all
   *		 populations to the '.csb' file.
   */

{
  uint32_t		tmpint32;
  int			tmpint;
  int			writeOK = 1;

  if (csbfil && csbnew)
    { // New CSB file: Write magic key and parameters
      tmpint32 = CSB_MAGIC_KEY;
      writeOK = (fwrite((void *)(&tmpint32), 1, sizeof(uint32_t), csbfil) == sizeof(uint32_t));
      tmpint  = PARAMETER_NR;
      if (writeOK)
	writeOK = (fwrite((void *)(&tmpint), 1, sizeof(int), csbfil) == sizeof(int));
      if (writeOK)
	writeOK = (fwrite((void *)(&parameter), PARAMETER_NR, sizeof(double), csbfil) == sizeof(double));
      csbnew = 0;
    }

  if (!writeOK)
    {
      Warning(ECSB);
      (void)fclose(csbfil);
      csbfil = NULL;
    }
  if (csbfil) WriteBinStateToFile(csbfil);	/* Append state to .csb file*/

  return;
}




/*==========================================================================*/

int	AddCohorts(population *pop, int popnr, int cohnr)

  /*
   * AddCohorts - Routine extends the population with number "popnr"
   *		  with "cohnr" cohorts. Routine can be called by user
   *		  in, for example, the routine UserInit().
   */

{
  int			newindex;
  uint32_t		mem_req;

  if ((popnr < 0) || (popnr >= POPULATION_NR)) Warning(IPAC);
  if (cohnr <1) Warning(ICAC);

  mem_req = (CohortNo[popnr]+cohnr)*COHORT_SIZE;
  if (!(mem_req < DataMemAllocated[popnr]))
    {
      DataMemAllocated[popnr] = MemBlocks(mem_req);
      pop[popnr] = (population)Myalloc((void *)pop[popnr],
				       (size_t)DataMemAllocated[popnr],
				       sizeof(double));
      if(!(pop[popnr])) ErrorAbort(MAFC);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return -1;	// ok?
#endif
    }
#if (I_CONST_DIM > 0)
  mem_req = (CohortNo[popnr]+cohnr)*I_CONST_DIM;
  if (!(mem_req < IDMemAllocated[popnr]))
    {
      IDMemAllocated[popnr] = MemBlocks(mem_req);
      popIDcard[popnr] = (popID)Myalloc((void *)popIDcard[popnr],
					(size_t)IDMemAllocated[popnr],
					sizeof(double));
      if(!(popIDcard[popnr])) ErrorAbort(MAFI);
#ifdef MODULE
      if (error_code & FATAL_ERROR) return -1;	// ok?
#endif
    }
#endif

  newindex = CohortNo[popnr];
  CohortNo[popnr] += cohnr;
  cohort_no[popnr] = CohortNo[popnr];

  return newindex;
}
#endif // (POPULATION_NR > 0)




/*==========================================================================*/
#if (POPULATION_NR > 0)
void LabelState(int popnr, const char *fmt, ...)

{
  va_list		argpnt;
  char			tmpbuf[1024];

  va_start(argpnt, fmt);
  vsprintf(tmpbuf, fmt, argpnt);
  va_end(argpnt);
  strncpy(statelabels[popnr], tmpbuf, (DESCRIP_MAX-1)*sizeof(char));
  statelabels[popnr][DESCRIP_MAX-1] = '\0';

  return;
} /* LabelState */

#endif


/*==========================================================================*/
#if (BIFURCATION == 1)

static double		next_bif_output;
static int		DoBifOutput = 0;

#if (MEASUREBIFSTATS == 1)
#include "ebtbifstats.c"
#endif

void	SetBifOutputTimes(double *env)

{
  static int			first = 1;

  // At start no (state) output
  if (first)
    {
      BifPeriod		= max_time;

      if (BifParLogStep)
	max_time        = ceil((log10(BifParLastVal/parameter[BifParIndex])/BifParStep) + 1.0 + BIFTINY);
      else
	max_time        = floor(((BifParLastVal - parameter[BifParIndex])/BifParStep) + 1.0 + BIFTINY);

      max_time	       *= BifPeriod;

      next_state_output = ((floor((BIFTINY+env[0])/BifPeriod)+1)*BifPeriod -
			   BifStateOutput);
      next_output	= ((floor((BIFTINY+env[0])/BifPeriod)+1)*BifPeriod -
			   BifOutput);
      next_bif_output   =  (floor((BIFTINY+env[0])/BifPeriod)+1)*BifPeriod;

      first = 0;

      return;
    }

  if (env[0] >= (next_bif_output-identical_zero))
    {
      // If env[0] equal to integer multiple of BifPeriod both state output
      // and regular output, unless this already last time we were here

      next_state_output  = env[0];
      next_output        = env[0];
      next_bif_output   += BifPeriod;

      DoBifOutput = 1;
    }
  else
    {
      // Otherwise schedule next state output for the end of the
      // current period with constant bifurcation parameter and
      // regular output for the last BifOutput timesteps of this
      // period
      //
      next_state_output = max(next_state_output, next_bif_output - BifStateOutput);
      next_output	= max(next_output, next_bif_output - BifOutput);
      DoBifOutput = 0;
    }

  return;
}

#endif // (BIFURCATION == 1)



/*=============================================================================*/


<|start_filename|>popDyn/EBTtool/fns/ebtmain.h<|end_filename|>
/***
   NAME
     ebtmain.h
   PURPOSE
     Interface header file to the functions defined in ebtmain.c
   NOTES
     
   HISTORY
     AMdR - Jul 20, 1995 : Created.
     AMdR - Oct 25, 2012 : Revised last.
***/

#ifndef EBTMAIN_H
#define EBTMAIN_H

/*==========================================================================*/
/*
 * Definitions of global variables exported to the linker. All the global 
 * variables are defined in the ebtmain.h file and exported to the other 
 * modules. This facilitates location of their definitions.
 */

#ifndef EXPORTING
#define EXPORTING 
#endif
#ifdef 	EBTMAIN_C
#  undef  EXTERN
#  define EXTERN
#else
#  undef  EXPORTING
#  define EXPORTING
#  undef  EXTERN
#  define EXTERN	extern
#endif

EXTERN int	environ_dim;		/* Environment dimension    */
EXTERN int	population_nr;		/* Number of populations    */
EXTERN int	i_state_dim;		/* I-state dimension        */
EXTERN int	i_const_dim;		/* I-constant dimension     */
EXTERN int	parameter_nr;		/* Parameter number         */
EXTERN int      error_code;             /* Warning/(fatal) error    */

#ifdef 	EBTMAIN_C
// Static variables restricted to ebtmain.c only
static int	output_var_nr;			/* Output variable number   */
#endif

#ifdef MODULE
EXTERN	 char error_msg[1024];	/* Error message, for tool  */
EXTERN_C char* exp_error_msg(void);
EXTERN_C int exp_environ_dim(void);
EXTERN_C int exp_population_nr(void);
EXTERN_C int exp_i_state_dim(void);
EXTERN_C int exp_i_const_dim(void);
EXTERN_C int exp_parameter_nr(void);
EXTERN_C double* exp_env(void); 
EXTERN_C population* exp_pop(void);
EXTERN_C int* exp_CohortNo(void);
EXTERN_C double* exp_output(void);
EXTERN_C char* exp_statelabel(int popnr);
#if (I_CONST_DIM > 0)
EXTERN_C popID* exp_popIDcard(void); 
#else
EXTERN_C double* exp_popIDcard(void);
#endif  // i_const_dim
#endif  // module

// This function is called in both the tool and ebtutils.c. It is implemented
// to protect the value of output_var_nr from changes by the user
EXTERN_C int exp_output_var_nr(void);


EXTERN double	*initState;			/* Pointer to initial       */
						/* system state             */
EXTERN double	*currentState;			/* Pointer to most current  */
						/* system state             */
EXTERN double	*currentDers[MAXDERS];		/* Pointers to computed     */
						/* derivatives              */
EXTERN double	env[ENVIRON_DIM];		/* Becomes vector of        */
						/* environmental values     */
#if (POPULATION_NR > 0)
EXTERN population pop[POPULATION_NR];		/* Array of pointers to the */
						/* population data          */
EXTERN population ofs[POPULATION_NR];		/* Array of pointers to the */
						/* offspring data           */
EXTERN population bpoints[POPULATION_NR];	/* Array of pointers to the */
						/* boundary points          */
#if (I_CONST_DIM > 0)
EXTERN popID popIDcard[POPULATION_NR];		/* Population ID structure  */
EXTERN popID ofsIDcard[POPULATION_NR];		/* & offspring ID structure */
#else                                           /* for non-dynamic data     */
EXTERN double popIDcard[POPULATION_NR];
#endif

EXTERN int	CohortNo[POPULATION_NR]; 	/* Number of cohorts in     */
						/* the various populations  */
EXTERN int	cohort_no[POPULATION_NR];       /* Copy of CohortNo vector  */
						/* accessible to user       */
EXTERN int      BpointNo[POPULATION_NR];        /* Number of boundary points*/
						/* for boundary cohorts     */
EXTERN int	bpoint_no[POPULATION_NR];       /* Copy of BpointNo vector  */
						/* accessible to user       */
#endif // (POPULATION_NR > 0)

EXTERN double	cohort_limit;                   /* Time limit new cohorts   */

EXTERN double	max_time;                       /* Maximum integration time */

EXTERN int	cohort_end;                     /* Flag indicating dynamic  */
						/* ending of cohort cycle   */
EXTERN double	step_size;                      /* The step size for the    */
						/* time integration         */
EXTERN double	output[OUTPUT_VAR_NR+2];	/* Array with output values */

EXTERN int	outputDefined;			/* Output is defined flag   */

EXTERN double	delt_out;                       /* Output time interval     */

EXTERN double	state_out;                      /* The time interval for    */
						/* complete state output    */
EXTERN double	next_cohort_end;		/* Time of cohort closure   */

EXTERN double	next_output, next_state_output;	/* Time of next (state)     */
						/* output                   */
EXTERN FILE	*resfil;			/* Pointer to outputfile    */

EXTERN FILE	*csbfil;			/* Pointer binary state file*/

#if ((BIFURCATION == 1) && (MEASUREBIFSTATS == 1))
EXTERN FILE	*averages;			// File pointers for
EXTERN FILE	*gaverages;			// bifurcation output
EXTERN FILE	*variances;
EXTERN FILE	*extrema;
#endif

EXTERN int	csbnew;				/* Flag new state file      */

EXTERN FILE	*dbgfil;			/* Pointer debug report file*/

EXTERN double	accuracy;                       /* Accuracy of the          */
						/* integration routine      */
EXTERN double	identical_zero;			/* Tolerance value, deter-  */
						/* mining identity with 0.0 */
EXTERN double	equal2zero;			/* Internal tolerance value */
						/* for identity with 0.0    */
#if (POPULATION_NR > 0)
EXTERN cohort	abs_tols[POPULATION_NR];	/* Absolute tolerance for   */
						/* identity of cohorts      */
EXTERN cohort	rel_tols[POPULATION_NR];	/* Relative tolerance for   */
						/* identity of cohorts      */
EXTERN int	tol_zero[POPULATION_NR];        /* Flag indicating one of   */
						/* i-state tolerances is 0  */
EXTERN int	pop_extinct[POPULATION_NR];     /* Flag indicating whether  */
						/* population extinction has*/
						/* been signalled already   */
#endif // (POPULATION_NR > 0)

#if PARAMETER_NR
EXTERN double	parameter[PARAMETER_NR];	/* Vector of free parameters*/
#endif						/* in the problem           */

#if (BIFURCATION == 1)
EXTERN int	BifParIndex;			/* Index of                 */
						/* bifurcation parameter    */
EXTERN double	BifParStep;			/* Step size in             */
						/* bifurcation parameter    */
EXTERN double	BifParLastVal;			/* Last value of            */
						/* bifurcation parameter    */
EXTERN int	BifParLogStep;			/* Logarithmic steps in     */
						/* bifurcation parameter    */
EXTERN double	BifOutput;			/* Output period            */
						/* during bifurcation run   */
EXTERN double	BifStateOutput;			/* State output period      */
						/* during bifurcation run   */
EXTERN double	BifParBase;			/* First value of           */
						/* bifurcation parameter    */
EXTERN double	BifPeriod;			/* Parameter change period  */
						/* during bifurcation run   */
#endif // (BIFURCATION == 1)
EXTERN char	progname[MAXFILENAMELEN];       /* Name of the program      */

EXTERN char	runname[MAXFILENAMELEN];        /* Name of the current run  */

EXTERN char	**usernotes;			/* User defined notes       */
						/* State labels in CSB file */
#if (POPULATION_NR > 0)
EXTERN char     statelabels[POPULATION_NR][DESCRIP_MAX];
#endif // (POPULATION_NR > 0)

EXTERN struct dscrptn {				/* The structure with       */
		char accuracy[DESCRIP_MAX];	/* descriptions of the      */
		char cohort_limit[DESCRIP_MAX];	/* quantities that are      */
		char identical_zero[DESCRIP_MAX]; /* read from .CVF file    */
		char max_time[DESCRIP_MAX];
		char delt_out[DESCRIP_MAX];
		char state_out[DESCRIP_MAX];
		char abs_tols[COHORT_SIZE][DESCRIP_MAX];
		char rel_tols[COHORT_SIZE][DESCRIP_MAX];
#if PARAMETER_NR
		char parameter[PARAMETER_NR][DESCRIP_MAX];
#endif
#if (BIFURCATION == 1)
		char bifparindex[DESCRIP_MAX];
		char bifparstep[DESCRIP_MAX];
		char bifparlastval[DESCRIP_MAX];
		char bifparlogstep[DESCRIP_MAX];
		char bifoutput[DESCRIP_MAX];
		char bifstateoutput[DESCRIP_MAX];
#endif // (BIFURCATION == 1)
		} description;

EXTERN int	Resume;				/* Flag for resuming run    */

EXTERN int	debug_level;			/* Level of debug info      */

#if (POPULATION_NR > 0)
EXTERN long	DataMemAllocated[POPULATION_NR];/* Total number of doubles  */
						/* currently allocated      */
#if (I_CONST_DIM > 0)
EXTERN long	IDMemAllocated[POPULATION_NR];	/* Total number of doubles  */
#endif						/* currently allocated      */
#endif // (POPULATION_NR > 0)

EXTERN int	rk_level;			/* Number of current Runge- */
						/* Kutta evaluation (1-6)   */

EXTERN int	ForcedCohortEnd;		/* Flag indicating forced   */
						/* dynamic cohort closure   */

EXTERN int	ForcedRunEnd;			/* Flag indicating forced   */
						/* ending of entire run     */

EXTERN int	LocatedEvent;			/* Index of located event   */


/*==========================================================================*/
#endif /* EBTMAIN_C */


<|start_filename|>animal/html/shtraject_M.html<|end_filename|>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>shtraject_M</title><meta name="generator" content="MATLAB 8.6"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2017-02-07"><meta name="DC.source" content="shtraject_M.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, code { font-size:12px; }
tt { font-size: 1.2em; }
pre { margin:0px 0px 20px; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }
pre.error { color:red; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }
.footer a { color:#878787; }
.footer a:hover { color:#878787; text-decoration:underline; }
.footer a:visited { color:#878787; }

table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; }
table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }





  </style></head><body><div class="content"><h1>shtraject_M</h1><p>created by <NAME> 2011/03/07</p><p>mineral trajectories in the standard DEB model, stochastic version   in scaled mineral fluxes j_M = J_M/ k_M.M_Vm with M_Vm = [M_V] L_m^3   in scaled time with 1/k_M as time unit</p><p>shtraject gives tau, f(tau), e(tau), l(tau), N(tau), uE0, g   the time intervals are short relative to d/dt e,l,N this means that d/dt e,l,cN can be obtained from the output table [t e l cN]</p><p>organic &amp; mineral fluxes obtain organic fluxes j_O = (j_X, j_V, j_E+j_ER, j_P)  j_* = J_*/ M_Vm.k_M selected copy-paste from <a href="dtraject.m"><b>dtraject</b></a> to get de dl j_ER</p><pre class="codeinput">l2 = l .* l; l3 = l .* l2;

j_X = - f .* l2/ (kap * y_VX); <span class="comment">% negative because food disappears</span>

<span class="keyword">if</span> e &gt; l + lT <span class="comment">% (positive) growth</span>
  r = g * (e ./ l - 1 - lT ./ l) ./ (e + g); <span class="comment">% spec growth rate</span>
<span class="keyword">else</span> <span class="comment">% shrinking (negative growth)</span>
  r = g * (e ./ l - 1 - lT ./ l) ./ (e + kapG * g); <span class="comment">% spec growth rate</span>
<span class="keyword">end</span>
dl = l .* r/ 3; <span class="comment">% growth in length</span>
j_V = 3 * l2 .* dl;

de = g * (f - e) ./ l; <span class="comment">% change in reserve density</span>
j_E = (l3 .* de +  e  .* j_V)/ (g * kap * y_VE);
j_ER = (vH &gt;= vHp) .* ((g + lT + l) .* e .* l .^2 ./ (e + g) - k * vHp) * kapR1;
j_E = j_E + j_ER/ (kap * y_VE);

j_P = - y_PX * j_X; <span class="comment">% sign opposite for that for food</span>

j_O = [j_X, j_V, j_E, j_P]';

<span class="comment">% obtain mineral fluxes</span>
<span class="comment">% J_M = (J_C, J_H, J_O, J_N)</span>
<span class="comment">% J_M = - n_M^-1 n_O J_O</span>
<span class="comment">% notice: J_M is given in scaled time</span>
j_M = - n_M\n_O * j_O;

figure
subplot(2,2,1)
plot(t(alive), j_M(1,alive), <span class="string">'g'</span>, t(~alive), j_M(1,~alive), <span class="string">'r'</span>)
ylabel(<span class="string">'scaled CO_2 production'</span>)
xlabel(<span class="string">'time since birth'</span>)

<span class="comment">%figure</span>
subplot(2,2,2)
plot(t(alive), j_M(2,alive), <span class="string">'g'</span>, t(~alive), j_M(2,~alive), <span class="string">'r'</span>)
ylabel(<span class="string">'scaled H_2O production'</span>)
xlabel(<span class="string">'time since birth'</span>)

<span class="comment">%figure</span>
subplot(2,2,3)
plot(t(alive), -j_M(3,alive), <span class="string">'g'</span>, t(~alive), -j_M(3,~alive), <span class="string">'r'</span>)
ylabel(<span class="string">'scaled O_2 use'</span>)
xlabel(<span class="string">'time since birth'</span>)

<span class="comment">%figure</span>
subplot(2,2,4)
plot(t(alive), j_M(4,alive), <span class="string">'g'</span>, t(~alive), j_M(4,~alive), <span class="string">'r'</span>)
ylabel(<span class="string">'scaled NH_3 production'</span>)
xlabel(<span class="string">'time since birth'</span>)
</pre><img vspace="5" hspace="5" src="shtraject_M_01.png" alt=""> <p class="footer"><br><a href="http://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2015b</a><br></p></div><!--
##### SOURCE BEGIN #####
%% shtraject_M
%
% created by <NAME> 2011/03/07
%
% mineral trajectories in the standard DEB model, stochastic version
%   in scaled mineral fluxes j_M = J_M/ k_M.M_Vm with M_Vm = [M_V] L_m^3
%   in scaled time with 1/k_M as time unit
%
% shtraject gives tau, f(tau), e(tau), l(tau), N(tau), uE0, g
%   the time intervals are short relative to d/dt e,l,N
% this means that d/dt e,l,cN can be obtained from the output table [t e l cN]
% 
% organic & mineral fluxes
% obtain organic fluxes
% j_O = (j_X, j_V, j_E+j_ER, j_P)  j_* = J_*/ M_Vm.k_M
% selected copy-paste from <dtraject.m *dtraject*> to get de dl j_ER

l2 = l .* l; l3 = l .* l2;

j_X = - f .* l2/ (kap * y_VX); % negative because food disappears

if e > l + lT % (positive) growth
  r = g * (e ./ l - 1 - lT ./ l) ./ (e + g); % spec growth rate
else % shrinking (negative growth)
  r = g * (e ./ l - 1 - lT ./ l) ./ (e + kapG * g); % spec growth rate
end
dl = l .* r/ 3; % growth in length
j_V = 3 * l2 .* dl;

de = g * (f - e) ./ l; % change in reserve density
j_E = (l3 .* de +  e  .* j_V)/ (g * kap * y_VE);
j_ER = (vH >= vHp) .* ((g + lT + l) .* e .* l .^2 ./ (e + g) - k * vHp) * kapR1; 
j_E = j_E + j_ER/ (kap * y_VE);

j_P = - y_PX * j_X; % sign opposite for that for food

j_O = [j_X, j_V, j_E, j_P]';

% obtain mineral fluxes
% J_M = (J_C, J_H, J_O, J_N)
% J_M = - n_M^-1 n_O J_O
% notice: J_M is given in scaled time
j_M = - n_M\n_O * j_O;

figure
subplot(2,2,1)
plot(t(alive), j_M(1,alive), 'g', t(~alive), j_M(1,~alive), 'r')
ylabel('scaled CO_2 production')
xlabel('time since birth')

%figure
subplot(2,2,2)
plot(t(alive), j_M(2,alive), 'g', t(~alive), j_M(2,~alive), 'r')
ylabel('scaled H_2O production')
xlabel('time since birth')

%figure
subplot(2,2,3)
plot(t(alive), -j_M(3,alive), 'g', t(~alive), -j_M(3,~alive), 'r')
ylabel('scaled O_2 use')
xlabel('time since birth')

%figure
subplot(2,2,4)
plot(t(alive), j_M(4,alive), 'g', t(~alive), j_M(4,~alive), 'r')
ylabel('scaled NH_3 production')
xlabel('time since birth')
##### SOURCE END #####
--></body></html>