INTRODUCTION
Recently, several attempts have been made to analyze the dynamic and control a system which is contains a ball on a body and its stability. Although, the system of ball on a sphere is particularly a nonlinear system, it can be considered linear around the equilibrium point (Ho et al., 2009). The system of ball on a sphere can be seen in Fig. 1. Past researches have shown that artificial neural networks are effective softcomputing techniques to model and control a broad category of complex nonlinear systems, especially to those systems whose mathematical models are extremely difficult to obtain (Hu and Hwang, 2001). Artificial neural networks have traditionally been used for classification and prediction tasks (Hourfar and Salahshoor, 2009; ElEmam and Yousif, 2009). Attractive features of neural networks are that they can be trained easily by using past data records from systems under study. They are readily applicable to multivariable systems (BazarganLari et al., 2012; Coban, 2004; Mahi and Izabatene, 2011; Rashid et al., 2012; Hourfar and Salahshoor, 2009; Aliasghary et al., 2008). These facts suggest that neural networks, in conjunction with a suitable control strategy such as modelbased control and neural control can be used to control nonlinear systems as an adaptive sub system (Hourfar and Salahshoor, 2009; Qiu et al., 2011; Halbaoui et al., 2012).

Fig. 1:  A ball on a sphere system, system of ball on a sphere such an inherently nonlinear, unstable and under actuated system 
The solution is given for the regulation case.
In this study, In particular, the nonlinear nature of neural networks and the ability of neural networks to learn from their environments in supervised as well as unsupervised ways, make them highly suited for solving difficult larger class of these nonlinear systems is proposed.
DYNAMIC AND MODELING
In the present study, a ball on a sphere system with arbitrary desires is controlled by the adaptive neural network controller. For this purpose, a model for the ball on a sphere system has been opted and then, its dynamical equations have been derived (Liu et al., 2011; Ho et al., 2009). Although, these dynamical equations are extremely nonlinear and their parameters are interdependent in various directions, they have been considered linear around the equilibrium point, since in that point, the parameters are assumed independent in all directions. In this work, like a ball and wheel system, the system of ball on sphere is considered to be tow dimensional in all directions is shown in Fig. 2.
The generalized coordinates of system are θ_{x}, β_{x} which respectively denote the ball and the spheres angles with respect to the x direction, θ_{y}, β_{y} which denotes the ball and the spheres angles with respect to the Y direction. The parameters of system are I_{B} and I_{b} which are moments of inertia of the sphere and ball, respectively and m as the mass of ball. There is also R and r which already denote the sphere and balls’ radiuses, respectively.
Then, by using the EulerLagrange formulation, the systems equation will be derived:

Fig. 2:  2D schema of the system, system of ball on a sphere can considered truly as two independent ball and wheel systems around its equilibrium point 
M_{13} = 0
M_{14} = 0
M_{23} = 0
M_{24} = 0
M_{31} = 0
M_{32} = 0
M_{41} = 0
M_{42 }= 0
And finally as a result, the dynamic model of the system is stated in the form of matrices as shown in Eq. 16:
where, that matrices M (q), G (q) and vector τ_{f }represent the inertia, gravity term and disturbance, respectively.
ADAPTIVE NEURAL NETWORK CONTROL
In order to present an adaptive neural network control method for a (robotic) system, one may begin with an adaptive algorithm to make it robust with respect to some uncertainty and disturbances. To achieve this goal, a radial basis network that is a feedforward neural network using the radial basis activation function is designed. In this study, the radial basis function of choice is the Gaussian radial basis function:
where, μ_{i}∈R^{n } the center is vector and σ^{2} is the variance. Each Gaussian RBF network includes three layers: the input layer, the hidden layer and the output layer. The output of the network f (W, y) can be given by:
where, α (y) [α_{1} (y) α_{1} (y)…α_{n} (y)]^{T} is generally positive for commonly used radial basis functions.
Define:
where, Λ is a positive definite matrix. Static neural networks are adequate to model D (q) and G (q) since that both of them are functions of q only. Assume that d_{kj} (q) and g_{k} (q) can be define as:
where, ξ (q), η (q)∈R are the Gaussian activation basis functions, θ , β∈R are the weight vectors of the neural networks and ∈_{dki} (q), ∈_{gk} (q)∈R are the modeling errors of d_{kj }(q), g_{k} (q), respectively, which are assumed to be bounded.
From above and according to Eq. 16, the control law can be found as:
The last term in the control law is added to repress the modeling errors of the neural networks. It can be proved for some values K and K_{s} if parameters update by:

Fig. 3:  Adaptive neural network algorithm, the control structure of proposed approach q, , are the desired joint angle, the desired joint angular velocity and the desired joint angular acceleration, respectively 
Regulation error and it’s time derivative converge to zero when large enough time (Wei et al., 2005).
The control law is shown in Fig. 3.
RESULTS AND DISCUSSION
The desired values of ball angles in order to have a regulation control at its unstable equilibrium point is considered at θ_{x} = 0 and θ_{y} = 0.
The physical properties of the ball and the sphere, which already described in the modeling section, are:
m 
= 
0.06 kg 
r 
= 
0.0125 m 
R 
= 
0.15 m 
I_{b} 
= 
3.75x10^{6} kg m^{2} 
I_{B} 
= 
0.99 kg m^{2} 
g 
= 
9.81 m sec^{2} 
The desired values for the initial condition are also should be specified. Initial position angle of the ball is considered around its equilibrium point at θ_{x0} = 0.07 and θ_{y0} = 0.07. Also, the initial angular velocities of the ball are . The initial position and velocity of sphere in both X and Y directions are β_{x0} = 0, = 0 and = 0, respectively.
For each element of D (q) and G (q), a 100node for hidden layer of neural network is used. The values of ì and σ^{2} are considered 0.0 and 10.0, respectively.

Fig. 4:  Disturbance, the controlling simulation has been done due to the disturbance 

Fig. 5:  Time evolution of θ in X direction in present of disturbance after 10 sec ball angle in X direction becomes stable in 0.1 sec 

Fig. 6:  Regulated θ in Y direction in 10 sec. It is stable in presented disturbance after 0.1 sec 
To show the potential of the adaptive neural network controlling method, a complex random term in which denotes the disturbance of the system has been applied in Xdirection. The disturbance is shown in Fig. 4.
The controlling simulation has been done due to the disturbance given in Fig. 4. These simulation results are summarized in Fig. 512. In Fig. 5 it can be observed ball angle in X direction become regulated in 0.1 seconds in present of disturbance and the error tends to zero after 0.1 sec. It can be also observed the same in Y direction in Fig. 6 which shows regulation after 0.1 sec.

Fig. 7:  Time evolution of β in X direction in present of disturbance after 10 sec 

Fig. 8:  β in Y direction is plotted vs. time in 10 sec, the angle of ball related to Y direction 

Fig. 9:  Error of angel θ is X direction the error tends to 0 after 0.1 sec 
The time evolution of beta in X and Y directions in present of disturbance after 10 seconds is shown in the Fig. 7 and 8, respectively. In the Fig. 9, the error of angel theta in X direction can be observed. The error of angle theta in Y direction is shown in Fig. 10. The error tends to zero after 0.1 sec. The torque required is applied to the sphere in X direction to control the position of the ball in present of disturbance is shown in Fig. 11. Also, simulation result of the Yaxis control input response of the motor is shown in Fig. 12.
According to the results, it can be realized that the ball is regulated in both X and Y directions in less than 0.1 sec, much faster than previous works.

Fig. 10:  θ error in Ydirection, Error of angel θ in Y direction reaches its desired value. The error tends to zero after 0.1 sec 

Fig. 11:  Torque in Xdirection, torque is applied to the sphere in the X direction to control the position of the ball in present of disturbance by means of changing β in X direction 

Fig. 12:  Torque in Ydirection, torque is applied to the sphere in the Y direction to control the position of the ball in present of disturbance by means of changing β in Y direction 
Also, from figures it is obvious that the errors tends to zero quickly with smoother maximum over shoots thanks to adaptive neural network control approach.
CONCLUSION
The purpose of this article was to control a system of “ball on a sphere”. At first, a dynamical model that had been constructed for this special system had been utilized. By choosing a proper controller called adaptive neural network method, as can be shown in the simulation results and figures, an appropriate regulation control has been achieved. As can be observed from results, adaptive neural controller was able to lead the system to the desired position in consideration of undesirable disturbances. The great accuracy of the diagrams represents the propriety and accuracy of used controller which can continue doing its task well in the presence of disturbance.