title: Matlab - "Could not extract differential variables to solve for" in dsolve
body: <p>I am trying to solve a RLC circuit as a symbolic differential equation in MATLAB using <code>dsolve</code>, the equation being</p>
  
  <pre><code>U(t) = L*Q''(t) + R*Q'(t) + (1/C)*Q(t)
  </code></pre>
  
  <p>with the initial conditions</p>
  
  <pre><code>Q(0)  = 0
  Q'(0) = 0
  </code></pre>
  
  <p>and</p>
  
  <pre><code>U(t) = 10*sin(2*t)
  L = 1
  R = 0
  C = 1/4
  </code></pre>
  
  <h2>While this works ...</h2>
  
  <p>When I implement it explicitly (and using strings) as </p>
  
  <pre><code>Q = dsolve('D2Q(t) + 4*Q(t) = 10*sin(2*t)', 'DQ(0)=0, Q(0)=0');
  Q = simplify(Q);
  </code></pre>
  
  <p>I'll get </p>
  
  <pre><code>Q =
  
    5 sin(2 t)   5 t cos(2 t) 
    ---------- - ------------ 
        4             2
  </code></pre>
  
  <p>which is correct. </p>
  
  <h2>... this does not.</h2>
  
  <p>For purely esoteric reasons I tried computing it directly using symbolic equations, as the documentation on <code>dsolve</code> stated it could be done.</p>
  
  <p>So starting with</p>
  
  <pre><code>syms L R C t Q(t)
  U = sym('10')*sin(sym('2')*t)
  DEQ = L*diff(Q(t),t,2) + R*diff(Q(t),t) + (1/C)*Q(t)
  DEQ = subs(DEQ, [L R C], [sym('1'), sym('0'), sym('1/4')])
  eqn = (U == DEQ)
  </code></pre>
  
  <p>I receive</p>
  
  <pre><code>eqn =
  10*sin(2*t) == 4*Q(t) + diff(Q(t), t, t)
  </code></pre>
  
  <p>Which is correct. If I now feed it into <code>dsolve</code> though, using</p>
  
  <pre><code>Q = dsolve(eqn, ...
      Q(t) == 0, ...
      diff(Q(t),t) == 0);
  </code></pre>
  
  <p>Matlab throws the error</p>
  
  <pre><code>Error using symengine (line 58)
  Could not extract differential variables to solve for. Use 'solve' or 'vpasolve'
  to compute the solutions of non-differential equations.
  </code></pre>
  
  <p>Why is that?</p>