Cognitive radio is based on the thought of adaptive frequency allocation. It solves the problems of spectrum lack and spectrum inefficiency in current communication networks. In this paper we propose a solution using Artificial Neural Networks (ANNs) to replace a complicated frequency allocation system in the cognitive radio. The solution will make sure that the frequency allocation working well in an easier system and with less waste of resource. We present the analysis of multi-user with different weights and single user with different time. Simulation result which fits the theoretical analysis is given in the paper.