title: Using time dependent (heat) source in PDE Toolbox
body: <p>My goal is to apply a time-dependent heat source when solving the heat transfer problem. </p>
  
  <p>The partial differential equation for transient conduction heat transfer is:</p>
  
  <p><a href="https://i.stack.imgur.com/XZNy2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XZNy2.png" alt="The partial differential equation for transient conduction heat transfer"></a></p>
  
  <p>and more information can be found here: <a href="https://www.mathworks.com/help/pde/examples/solving-a-heat-transfer-problem-with-temperature-dependent-properties.html" rel="nofollow noreferrer">Solving a Heat Transfer Problem With Temperature-Dependent Properties</a></p>
  
  <p>All parameters are constants in my case, except the source term, f, needs to be changed along with time. </p>
  
  <p>I'm following the example code here: <a href="https://www.mathworks.com/help/pde/examples/nonlinear-heat-transfer-in-a-thin-plate.html" rel="nofollow noreferrer">Nonlinear Heat Transfer In a Thin Plate</a> which gives a way to solve the transient problem, and I'm able to plot the heat data at each time point. </p>
  
  <p>The problem when applying it to my case is that, in the example the source is a constant value, throughout the entire region and entire time, and related to radiation and convection (in my case they should be all zero), but I need to feed a time-dependent source (Joule heating by time-varying electric current). The source could have one of the following formats: </p>
  
  <ol>
  <li>Analytical: a positive value such as 1 W/m^2, within a time window such as 0&lt; t&lt; 1 ns, and 0 otherwise. </li>
  <li>Numerical: data is provided by a 1xN vector where N is the number of time points. </li>
  </ol>
  
  <p>And the source is confined in a certain region, eg. 0&lt; x &lt;1 mm and 0&lt; y&lt;1 mm.</p>
  
  <p>I have seen a similar question but unanswered: <a href="https://stackoverflow.com/questions/37864981/how-to-use-a-variable-coefficient-in-pde-toolbox-to-solve-a-parabolic-equation">How to use a variable coefficient in PDE Toolbox to solve a parabolic equation (Matlab)</a></p>
  
  <p>Is there a way to implement this with the PDE Toolbox? Writing code from scratch would be so complicated....</p>