title: Solving 7 equations of first order equations ode45 Matlab
body: <p>I am trying to solve a system with seven differential equations. And I am having a hard time grapsing the ode45 solver.<br />
  These are the equations:</p>
  <blockquote>
  <p>ω2_dot = -0.75 ω1 ω3</p>
  <p>ω1_dot = 0.75 ω2 ω3 + 0.2</p>
  <p>ω3_dot = 0</p>
  <p>q1_dot = 1/2(ω1q4 + ω2q3 - ω3q2)</p>
  <p>q2_dot = 1/2(ω2q4 + ω3q1 - ω1q3)</p>
  <p>q3_dot = 1/2(ω3q4 + ω1q2 - ω2q2)</p>
  <p>q4_dot = -1/2(ω1q1 + ω2q2 + ω3q3)</p>
  </blockquote>
  <p>The initial values are listed in the <code>inital_val</code> in the same order. Here is what I have so far:</p>
  <pre><code>inital_val = [1 -1 2 0 0 0 1];
  
  timespan = [0:0.05:3.95];
  
  [result t] = ode45(@soe,timespan,inital_val);
  
  function [results,t]=soe(inital_val, timespan)
  omega1_dot = -0.75*omega2*omega3;
  omega2_dot = 0.75*omega2*omega3+0.2;
  omega3_dot = 0;
  q1_dot = (1/2)*(q4*omega1+omega2*q3-omega3*q2);
  q2_dot = (1/2)*(q4*omega2+omega3*q1-omega1*q3);
  q3_dot = (1/2)*(q4*omega3+omega1*q2-omega2*q2);
  q4_dot = (1/2)*(q1*omega1+q2*omega2+q3*omega3);
  results = [omega1 omega2 omega3 q1 q2 q3 q4];
  
  end
  </code></pre>
  <p>However, it gives me this error message, which makes sense but I then don't know how to fix it:</p>
  <pre><code>Unrecognized function or variable 'omega2'.
  
  Error in ode45_part&gt;soe (line 10)
  omega1_dot = -0.75*omega2*omega3;
  
  Error in odearguments (line 90)
  f0 = feval(ode,t0,y0,args{:});   % ODE15I sets args{1} to yp0.
  
  Error in ode45 (line 115)
    odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
  
  Error in ode45_part (line 7)
  [result t] = ode45(@soe,timespan,inital_val);
  </code></pre>
  <p>Any help would be much appreciated</p>