function dy=acrobot_eq6(t,y,v,m1,m2,l1,l2,lc1,lc2,I1,I2,g,f1,f2); 

%---2005.7.28-----
%%%  nonlinear System
%---definition---
%-----------------  Nonlinear system------------------------------------------------
%---definition---
%‘æ‚PƒŠƒ“ƒNŠp“x�@‘æ‚QƒŠƒ“ƒNŠp“x�@‘æ‚PƒŠƒ“ƒNŠp‘¬“x  ‘æ‚QƒŠƒ“ƒNŠp‘¬“x  ‘æ‚PƒŠƒ“ƒNŠp‰Á‘¬“x�@‘æ‚QƒŠƒ“ƒNŠp‰Á‘¬“x   
%---y(1,1)      y(2,1)         y(3,1)          y(4,1)
%
%                             dy(1,1)          dy(2,1)               dy(3,1)          dy(4,1)
%--------------------------------------------------------------------------

global ni
dy=zeros(4,1);

alfa=I1 + m1*lc1^2+m2*l1^2;
beta=l1*m2*lc2;
ganm=I2 + m2*lc2^2;
k1=(m1*lc1 + m2*l1)*g;
k2=m2*lc2*g;
d11=alfa + ganm + 2*beta*cos(y(2,1));
d12=ganm + beta*cos(y(2,1));
d21=ganm + beta*cos(y(2,1));
d22=ganm;



p1= ( -beta*( 2*y(3,1) + y(4,1) ) * y(4,1)*sin( y(2,1) ) )....
    +( k1*cos( y(1,1)) + k2*cos( y(1,1) + y(2,1) ) )  ;
p2= ( beta*y(3,1)^2*sin( y(2,1) ) )+ ( k2*cos( y(1,1) + y(2,1) ) ) ;



v= -f1*( y(1,1) - pi/2 ) - f2*y(3,1);


tau= -(-d22*p1+d12*p2)/d12 + (d12 - d11*d22/d12)*v;

dy(1,1)=y(3,1);

dy(2,1)=y(4,1);

dy(3,1)=v;

dy(4,1)=-p1/d12-(d11/d12)*v  ;







