function dx = bbFUNODE(t,x)

%**************************************************************%
%This functions is to be used with the bbGUI.m and BBFUN.m     %
%files.  It contains the necessary information to run the non- %
%simulation of the ball and beam example.		       %                                %
%                                                              %
%Copyright (C) 1997 by the Regents of the University of        %
%Michigan.                                                     %
%**************************************************************%

%Retrieve the value of the K matrix.
   Khandle = findobj('Tag','Kframe');
   K = get(Khandle,'Value');

%Retrieve the value of Nbar.     
   Nbarhandle = findobj('Tag','Nbarframe');
   Nbar = get(Nbarhandle,'Value');

%Retrieve the step input value.
    stephandle = findobj('Tag','stepslider');
    stepval=get(stephandle,'Value');

%Representation of the non-linear system.    
   dx=zeros(4,1);
   dx(1)=x(2);
   dx(2)=-5/7*(-9.8)*sin(x(3))+5/7*x(1)*x(4)^2;
   dx(3)=x(4);
   dx(4)=-K*[x(1) x(2) x(3) x(4)]'+Nbar*stepval; 

