In this paper we discuss how an analog signal can be encoded using biophysically realistic neural networks. Such a network differs from a standard artificial neural network because of the fact that a biological cell generates spikes and information is encoded as activity of this spike generator and transmitted through a synapse between two cells. Thus a Biological Neural Network is a dynamic ensemble of cells that interact perhaps to approximate a function, perform a recursive computation such as solving a differential equation, or retain a variable in its memory. The interaction between the cells is controlled by choosing a set of synaptic weights that have to be optimized in order that a portion of the network encode a suitable function. A new optimization algorithm for finding a set of optimal synaptic weights has been proposed and successfully implemented using a software program called GENESIS. The algorithm is illustrated by implementing a memory which is a simple network of cells encoding the identify function, together with a unity feedback.