Anomaly detection for remote sensing has drawn a lot of attention lately. An anomaly has distinct spectral features from its neighborhood, whose spectral signature is not known a priori, and it usually has small size with only a few pixels. It is difficult to detect anomalies, and it is more challenge to detect anomalies without any information of the background environment in hyperspectral data with hundreds of co-registered image bands. Several methods are devoted to this problem, such as the well-known RX algorithm which takes advantage of the second-order statistics. The RX algorithm assumes Gaussian noise and uses sample covariance matrix for data whitening. However, when the anomalies pixel number exceeds certain percentage or the data is ill distributed, the sample covariance matrix can not represent the background distribution. In this case, the RX algorithm will not perform well. In order to solve this problem, in this paper we propose a weighted covariance matrix for anomaly detection. It gives weight to the each pixel in the covariance matrix by its distance to the data center, and then followed by the anomaly detection approach based on second-order statistics. We will compare the experimental results with the original RX methods.