K = [39.7840   10.6327   15.9696    5.0094
      5.9724    8.9139    3.1899    3.0430];
  
[t,q,u] = mexSim([-0.1;0.1;0;0],[0;0;0;0],K',3);

subplot(2,1,1)
plot(t,q)
ylabel('angles (rad), velocities (rad/s)');
legend('q_0','q_1','q_2','q_3');
subplot(2,1,2);
plot(t,u);
xlabel('time(s)');
ylabel('torques (rad/s)');
legend('\tau_0','\tau_1');