title: Plot dsolve solution of ODE in MATLAB with multiple constants involved
body: <p><strong>Basic Goal:</strong>   <em>Solve</em> &amp; <em>Plot</em> the solution of an ODE 
      <code>D2f=a1*f+a0</code></p>
  
  <p>where</p>
  
  <pre><code>a1=k*H*H/c;
  a0=-H*H*tau0/c;
  c=0.1;
  k=1;
  H=1;
  tau0=1;
  </code></pre>
  
  <p>I am using <em>dsolve</em> command to find the solution with the above mentioned values of constants.</p>
  
  <pre><code>sol=dsolve('D2th=a1*th+a0','th(0)=0','th(1)=0','t');
  </code></pre>
  
  <p>Instead of getting a solution with assigned values of constants, I get the solution as:</p>
  
  <pre><code>sol =
  
  
  (exp(a1^(1/2)*t)*(a0 - a0*exp(-a1^(1/2))))/(a1*(exp(a1^(1/2)) - exp(-a1^(1/2)))) - (exp(-a1^(1/2)*t)*(a0 - a0*exp(a1^(1/2))))/(a1*(exp(a1^(1/2)) - exp(-a1^(1/2)))) - a0/a1
  </code></pre>
  
  <p>I need MATLAB to automatically replace the values of constants (<em>a1</em>, <em>a0</em>, etc.,) and then solve the equation, so that the results show up in complete simplified form. </p>
  
  <p><strong>Secondly</strong>, 
  I want to plot the solution of above ODE as follows:</p>
  
  <pre><code>t0=0;
  tf=1;
  N=100;
  h=(tf-t0)/N;
  t=t0+(0:N)'*h;
  plot(t,sol)
  </code></pre>
  
  <p>I have tried <code>plot(t,sol(t))</code>
  but nothing works fine.</p>
  
  <p><strong>Summary of question:</strong> first solve the ODE by replacing the values of constant in solution, and then plot the solution with respect to a column vector <em>t</em>.</p>