Approximating a sine wave using neural network

Lets try to generalize a sine wave using neural network.  The NN will learn the data and will approximate. We will need atleast 20 hidden neurons for the NN to model properly.  For a NN to generalize to a non-linear output, it needs atleast 20 neurons in the hidden layer.

I used about 20 neurons in the hidden layer and trained for about 800 epocs below you see the result of the learning capability of the neural network.

Red –  Original Training data
Blue – NN output after learning

figure_out1
Neural network output after training