Neural Network Toolbox™ Previous page   Next Page 
 Provide feedback about this page

NARX Network (newnarx, newnarxsp, sp2narx)

All the specific dynamic networks discussed so far have either been focused networks, with the dynamics only at the input layer, or feedforward networks. The nonlinear autoregressive network with exogenous inputs (NARX) is a recurrent dynamic network, with feedback connections enclosing several layers of the network. The NARX model is based on the linear ARX model, which is commonly used in time-series modeling.

The defining equation for the NARX model is

where the next value of the dependent output signal y(t) is regressed on previous values of the output signal and previous values of an independent (exogenous) input signal. You can implement the NARX model by using a feedforward neural network to approximate the function f. A diagram of the resulting network is shown below, where a two-layer feedforward network is used for the approximation. This implementation also allows for a vector ARX model, where the input and output can be multidimensional.

There are many applications for the NARX network. It can be used as a predictor, to predict the next value of the input signal. It can also be used for nonlinear filtering, in which the target output is a noise-free version of the input signal. The use of the NARX network is demonstrated in another important application, the modeling of nonlinear dynamic systems.

Before demonstrating the training of the NARX network, an important configuration that is useful in training needs explanation. You can consider the output of the NARX network to be an estimate of the output of some nonlinear dynamic system that you are trying to model. The output is fed back to the input of the feedforward neural network as part of the standard NARX architecture, as shown in the left figure below. Because the true output is available during the training of the network, you could create a series-parallel architecture (see [NaPa91]), in which the true output is used instead of feeding back the estimated output, as shown in the right figure below. This has two advantages. The first is that the input to the feedforward network is more accurate. The second is that the resulting network has a purely feedforward architecture, and static backpropagation can be used for training.

The following demonstrates the use of the series-parallel architecture for training an NARX network to model a dynamic system.

The example of the NARX network is the magnetic levitation system described beginning on page 7-20. The bottom graph in the following figure shows the voltage applied to the electromagnet, and the top graph shows the position of the permanent magnet. The data was collected at a sampling interval of 0.01 seconds to form two time series.

The goal is to develop an NARX model for this magnetic levitation system. First load the training data. Use tapped delay lines with two delays for both the input and the output, so training begins with the third data point. There are two inputs to the series-parallel network, the u(t) sequence and the y(t) sequence, so p is a cell array with two rows.

Create the series-parallel NARX network using the function newnarxsp. Use 10 neurons in the hidden layer and use trainbr for the training function.

Now you are ready to train the network. First you need to load the tapped delay lines with the initial inputs and outputs. The following commands illustrate these steps.

You can now simulate the network and plot the resulting errors for the series-parallel implementation.

The result is displayed in the following plot. You can see that the errors are very small. However, because of the series-parallel configuration, these are errors for only a one-step-ahead prediction. A more stringent test would be to rearrange the network into the original parallel form and then to perform an iterated prediction over many time steps. Now the parallel operation is demonstrated.

There is a toolbox function (sp2narx) for converting NARX networks from the series-parallel configuration, which is useful for training, to the parallel configuration. The following commands illustrate how to convert the network just trained to parallel form and then use that parallel configuration to perform an iterated prediction of 900 time steps. In this network you need to load the two initial inputs and the two initial outputs as initial conditions.

The following figure illustrates the iterated prediction. The solid line is the actual position of the magnet, and the dashed line is the position predicted by the NARX neural network. Although the network prediction is noticeably different from the actual response after 50 time steps, the general behavior of the model is very similar to the behavior of the actual system. By collecting more data and training the network further, you can produce an even more accurate result.

In order for the parallel response to be accurate, it is important that the network be trained so that the errors in the series-parallel configuration are very small.

You can also create a parallel NARX network, using the newnarx command, and train that network directly. Generally, the training takes longer, and the resulting performance is not as good as that obtained with series-parallel training.


 Provide feedback about this page 

Previous page Distributed Time-Delay Neural Network (newdtdnn) Layer-Recurrent Network (newlrn) Next page

 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS