title: Matlab plot for exponential decay function
body: <p>I have empirical data of 9 sets of patients the data looks in this format </p>
  
  <pre><code>               input = [10      -1      1
                          20      17956   1
                          30      61096   1
                          40      31098   1
                          50      18446   1
                          60      12969   1
                          95      7932    1
                          120     6213    1
                          188     4414    1
                          240     3310    1
                          300     3329    1
                          610     2623    1
                          1200    1953    1
                          1800    1617    1
                          2490    1559    1
                          3000    1561    1
                          3635    1574    1
                          4205    1438    1
                          4788    1448    1
                        ];
                        calibrationfactor_wellcounter =1.841201569;
  </code></pre>
  
  <p>Here, the first column describes values of time and next one is concentration. As you can see, the concentration increases until a certain time and then decreases exponentially with increase in time.</p>
  
  <p>If I plot the following characteristics, I obtain following curve <img src="https://i.stack.imgur.com/sihDD.jpg" alt="enter image description here"> </p>
  
  <p>I would like to create a script which represents the same behavior cited above. following is the script which i have formulated  where concentration linearly increases till certain time period and aftermath it decays exponentially, but when i plot this function i am obtaining linear characteristics , kindly let me know if my logic is appropriate</p>
  
  <pre><code>function c_o = Sample_function(td,t_max,a1,a2,a3,b1,b2,b3)
     t =(0: 100 :5000); % time of the sample post injection in mins
     c =(0 : 2275.3 :113765);
     A_max= max(c);%Max value of Concentration (Peak of the curve)
  
     c_o = zeros(size(t));
     c_o(t&gt;td &amp; t&lt;=t_max) = A_max*(t(t&gt;td &amp; t&lt;=t_max)-td);
  
     c_o(t&gt;t_max)=(a1*exp(-b1*(t(t&gt;t_max)-t_max)))+(a2*exp(-b2*(t(t&gt;t_max)-t_max)))+(a3*exp(-b3*(t(t&gt;t_max)-t_max)));        
  
     fprintf('plotting Data ...\n');
     hold on;
     %figure ;
     plot(c_o,'erasemode','background');
     xlabel('time of the sample in minutes ');
     ylabel('Activity of the sample Ba/ml');
     title (' Input function: Activity sample VS time ');
  
     pause;
  end
  </code></pre>
  
  <p>The figure i obtained is <img src="https://i.stack.imgur.com/iK84h.jpg" alt="enter image description here">
  In the above plot the decay is linear instead of exponential, let me know how to obtain 3rd order decay this is the line of code i have written to obtain 3rd order decay</p>
  
  <pre><code>c_o(t&gt;t_max)=(a1*exp(-b1*(t(t&gt;t_max)-t_max)))+(a2*exp(-b2*(t(t&gt;t_max)-t_max)))+(a3*exp(-b3*(t(t&gt;t_max)-t_max)));
  </code></pre>