title: sub plotting odes15 MATLAB
body: <p><strong>I am trying to practice for a final coming up and I was given an old question and I am having trouble with the odes15 and sub plotting. I tried using the examples given on the MATLAB main website but couldn't figure out why it would work. The question is:</strong> </p>
  
  <p><img src="https://i.stack.imgur.com/j4Ugc.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/lwpe9.png" alt="enter image description here"></p>
  
  <p><strong>This is my code:</strong></p>
  
  <pre><code> function dx = problem1(t,x)
  
  P1 = 0.028735 ;
  P2 = 0.028344 ;
  P3 = 5.035 * 10^(-5) ;
  Vi = 12 ;
  n = 5/54 ;
  D(t) = 3*exp(-0.05*t) ;
  U = 3 ;
  
  dx = zeros(3,1);
  dx(1) = -P1*(G-Gb) - (X-Xb)*G + D(t) ;
  dx(2) = -P2*(X-Xb) + P3*(I-Ib) ;
  dx(3) = -n*I + U(t)/Vi ;
  
  [T,X] = ode15s(@problem1, [0 24], [4.5 15 15]) ;
  plot(T,X(:,1),'-',T,X(:,2),'-.',T,X(:,3),'.')
  </code></pre>