title: Interpereting dsolve output to use with ODE45 [MATLAB]
body: <p>i've been trying to solve a second order differential equation using this <a href="http://12000.org/my_notes/matlab_ODE/" rel="nofollow" title="example">1</a>,
  however I couldnt get it right and found nothing helpful online but I believe I've made progress.</p>
  
  <p>I used <em>dsolve</em>;</p>
  
  <pre><code>syms x(t) v(t) fi(t)
  
  [x(t), v(t)] = dsolve(diff(x) == v, diff(v) == fi/m, x(0) == [-L, -L], v(0) == [5, 10] )
  </code></pre>
  
  <p>which gives me;</p>
  
  <pre><code>   x(t) =
  
  
  
  int(fi(x)/5, x, 0, t, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true) - 5
  
  
  
  
  
  v(t) =
  
  C2 + t*(int(fi(x)/5, x, 0, t, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true) - 5) + int(-(x*fi(x))/5, x, 0, t, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true)
  </code></pre>
  
  <p>Now I need help interperating the result and I wonder if I can use this result to get something out of ode45? Also I want to plot the solution as a reference trajectory to a simulation of 500 particles moving through a forcefield.</p>
  
  <hr>
  
  <p>using ODE45:</p>
  
  <pre><code>function dxdt = solution(t,y0)
  frprintf('Second stop')
  .....
  dxdt = [x, v]
  end
  </code></pre>
  
  <p>call from main file:</p>
  
  <pre><code>t:dt:t_f
  y0 = [x0,v0]
  fprintf('first stop')
  [x, v] = ode45(@solution, y0, t)
  </code></pre>
  
  <p>I've set it up so that if the code would run smoothly it would print "first stop, second stop, third stop" and "fourth stop", it only prints out first stop and thats where I get the error. </p>