## 2 Theoretical Background and Preliminaries
### Real-Life Results  
In this section, the whole system, including the mathematical model, ANN model, and real-time MLS, is simulated simultaneously. Since the system is fundamentally unstable, it means using the closed-loop system is essential. The input signals, including chirp, step, sinand constant source, are applied and used for three models. The control signal is generated by LQ controller and converted to PWM in real MLS.  
The output of the ANN model is based on real-time controller. On the other hand, the controller already has been designed for real-time model. However, the obtained ANN is using the control signal that is being generated by real-model. The ANN model is not exactly like the real-model. It means a new model may need to implement a new controller in the simulation. Since the MLS is a highly nonlinear unstable system, it needs to illustrate complex control algorithms. The obtained ANN model can control itself by previous controller with minor changes if it works in linear region. The developed controller is applied to the system. The results are shown from Figures 8 and 9. In Figure 8, it is seen that the ball is exposed to disturbance in real life, that is why the simulation models can not respond to real life disturbance.  
The figures show the higher frequency response of three models up to 7 s. It can be seen that the position response in real model is less than that of the mathematical and ANN models. In other words, the bandwidth of mathematical model is more than real-model. However, the ANN result indicates better behavior in high frequency.  
In Figure 9, it can be seen that the transient response is compensated desirably and the steady state response of the ANN model is acceptable. However, for a high frequency region like chirp signal or step points in pulse signals performance has not been achieved well. The MSE error, in this case has been decreased considerably compared to the off-line ANN model.  
In this paper, NN-NARX structure and linearization by dynamic output feedback were implemented to control ball position of a real magnet levitation system. The noisy signals (signals before filters) are used in order to train the neural network model more accurately.  
The Levenberg-Marquardt method gives the best results with 12 neurons in the hidden layer and one delay. The training process achieved best performances after 113 iterations. Increasing the number of neurons in the hidden layer in this project did not improve the accuracy of the model. As the input  
Figure 8: Ball position comparison among real model, ANN model and Mathematical model.  
signal in closed-loop system depends on the error between input and its output, the ANN controller is developed instead of real MLS LQ controller. Results indicate the steady state and transient response is compensated desirably for the neural network model.  
For the purpose of comparing all models, the mean square error between the input command and output of models was calculated. Table 3 shows the results where YEXP, YANN, and YMATH represent the ball position in the experiment, artificial neural network, and mathematical model, respectively. UEXP is the input command in the experimental test. Based on results in the figures cited above and Table 3, it is concluded that the identified model has acceptable performance.