title: Inverted pendelum matrix derivative approximation
body: <p>Here I've written a dynamic function as:</p>
  
  <pre><code>function dAx = dynamic(t,x)
  global u;
  
  g = 9.8;
  l = 0.5;
  m = 0.5;
  h = 2;
  
  dx(1,1) = x(2);
  dx(2,1) = g/l*sin(x(1))-h/(m*l^2)*x(2)+1/(m*l)*cos(x(1))*u(1,1);
  dx(3,1) = g*lcos(x(3))-u(2,1);
  
  
  A = [x(1)*x(2)+10*x(1);10*x(2)-5*x(1);x(3)] 
  
  dx = 1e-3
  dAx = [(((x(1)+dx)+(x(1)-dx))*((x(2)+dx)+(x(2)-dx)))/(2*dx)+(10*(x(1)+dx)+(x(1)-dx))/(2*dx);
         ((10*(x(2)+dx)+(x(2)-dx))-5*((x(1)+dx)+(x(1)-dx)))/(2*dx);
         ((x(3)+dx)+(x(3)-dx))/(2*dx)]; % dA/dx using central derivative method computation
  </code></pre>
  
  <p>Here there is a matrix <code>A (3*1)</code> and function out put is <code>derivative of matrix A</code> related to system states.</p>
  
  <p>I've tried to use <strong>central difference method</strong>.Is my derivative matrix calculation correct?</p>