With the rapid development of wireless communication technology, new wireless applications and services are exploding. These new applications and services usually need wider bandwidth and higher speed. The voice of people calling for a fast and convenient network is getting stronger and stronger, and the wireless network must be the main development direction of the network in the future world. In order to make the development of wireless communication technology not limited by limited resources, resource optimization design has always been a research hotspot of scientists. Among them, the optimal resource algorithm can get the theoretical global optimal solution, while the sub-optimal resource allocation algorithm, as a supplement to the former, can be used to reduce costs and improve efficiency when the system structure is too complex. In this paper, a resource optimization method based on sparse clustering algorithm is proposed, and the matching relationship between spectrum resources and the services carried by cognitive terminals is established, so that the effectiveness of collaboration and cognitive systems is verified.