A New Indoor Location Algorithm Based on Radio Frequency Fingerprint Matching

Indoor positioning technology plays an important role in the production and life of today’s society. Modern people’s clothing, food, housing, and transportation are increasingly closely related to Location Based Service. In this paper, an indoor location algorithm based on the radio frequency fingerprint matching is offered. In the offline phase, by deploying a small number of radio signal intensity location regions, the location selection mechanism is used to predict the location of mobile terminals, which can avoid the instability of radio frequency signals caused by time-lapse and the impact of changes in Access Point (AP) facilities. In the online stage, the location engine receives real-time Radio Frequency fingerprints and updates the fingerprint location by mapping time and equipment. Finally, several main localization algorithms are simulated and compared to the aspect of location accuracy. The proposed new method reduces the location error, improves the location accuracy by 1 to 2 meters, and achieves 100% within 2.5 meters.

the real-time location of the device when it needs to be invoked and reduce the time devoted to searching. At the same time, it can realize data statistics functions such as asset inventory, import and export management, etc. In the mobile trajectory query, the historical trajectory of the target can be accessed at any time. Event traceability can be achieved by querying the historical trajectory. In the field of the electronic fence, by sett up an electronic fence in a certain area, when the positioned personnel or materials enter or leave the area without authorization, the system immediately warns to prevent accidents, or material security, regional security and so on. In the aspect of one-key alarm and help-seeking, the function of ''one-key alarm'' can be integrated into the intelligent positioning terminal. When a person is in danger or encounters an accident, press the ''one-key alarm'' buttoned to notify the managers to go to the rescue, and block the location of the alarm personnel, to achieve rapid rescue. In the aspect of data statistical analysis, it can realize comprehensive data statistics, check the number of real-time personnel and equipment, thermal distribution, time of entry and exit, and avoid the omission of personnel management.
At present, many scientific research institutions and scholars at home and abroad have been studying indoor positioning technology. Position fingerprint matching is realized by using Gauss kernel function, and the error is reduced by a Kalman filter algorithm [3]. The positioning accuracy of the moving target of 3 m is 100%, and the single positioning time is within 1 s. A position fingerprint location method based on Support Vector Machine (SVM) is proposed. In the offline stage, the strength of the position signal received in each region is considered as the training sample set of SVM, and the optimal classification model is obtained. In the online stage, the real-time collected position signal intensity is invoked as the test set, and the SVM classification model is used to predict and judge the region. Upright positioning results are obtained [4]. The results of WiFi localization in mobile scenes are preliminaries corrected by Pedestrian Dead Reckoning [5], [6], and the corrected results are evaluated by defining a trusted space of adaptive size, which eliminates the untrustworthy WiFi localization estimates before data fusion and improves the accuracy and robustness of the localization system [7]. To improve the reliability of signal strength data, characteristics of ZigBee [8], [9] signal strength are analyzed by combining theory about practice. To improve the matching efficiency of location fingerprint, the classical clustering algorithm K-Means is put in place to realize the clustering division of location fingerprint database and the regional location of the target. Kalman filter with reliable real-time performance is selected to realize the location and tracking of moving targets [10]. Being dependent on the standard deviation of received signal strength, the selection of initial clustering centers is optimized. Then the fingerprint data are clustered and located online. It not only shortens the positioning time but also effectively improves positioning accuracy [11]. Being aiming at the problem of noise influence in the two stages of WiFi signal acquisition [12], which are offline database building an online location, dual filtering is introduced. Aiming at the low efficiency of fingerprint matching, an improved algorithm built on the Nearest Neighbor (NN) method is proposed, and a strategy of data classification is proposed based on the weighted K Nearest Neighbor (KNN) method [13], [14]. The improved algorithm effectively improves the matching efficiency of position fingerprint and also improves the indoor positioning accuracy [15]. Radiofrequency fingerprint database is established by partitioning a distinctive indoor space and measuring the wireless signal intensity of each point. Considering the distance between the reference point and the test point, the closer the reference point is the test point, the greater its contribution to positioning. An improved equal duster algorithm is proposed, and a better positioning effect is obtained [16].
All the above documents are about the research of indoor positioning technology and have achieved excellent positioning results. However, there are some practical problems that have not meant well addressed. Firstly, most of the positioning algorithms are complex, which leads to the low positioning efficiency. Secondly, WLAN technology is adopted for positioning. Due to the influence of indoor complex environmental factors, such as human movement, temperature and humidity changes, antenna direction and other obstacles, the RF signal propagation is often multi-path propagation and shadow effect, resulting in a large positioning error of the positioning algorithm and still low positioning accuracy.
As showed in table 1, the comparison of various positioning technologies shows that WiFi fingerprint positioning is based on the original communication, without additional costs, and can realize indoor positioning of families, hotels, cafes, airports, and shopping malls.
So, in this paper, a radio frequency fingerprint matching localization algorithm is proposed. By deploying a small number of radio signal intensity localization areas, sensing access points, using linear regression, building reference nodes, mobile positioning, RSSI mapping relationship, the problem of characteristic radio frequency fingerprint is addressed. The location of off-line training in space is obtained by radio frequency fingerprint, and the fingerprint model is established. The simulation results show that the cumulative positioning error is reduced, the positioning accuracy is enhanced by 1 to 2 meters, and the positioning accuracy is 100% within 2.5 meters.
The structure of this paper is as follows: the first part of the introduction; the second part analyses the location technology of wireless fingerprint matching. The third part is the simulation results and analysis, mainly is to design the positioning algorithm experiments, and the experimental results are evaluated; Part IV summary.

II. A NEW INDOOR LOCATION ALGORITHM BASED ON THE RADIO FREQUENCY FINGERPRINT MATCHING
A. ANALYSIS OF RADIO FRQUENCY FINGERPRINT MATCHING AND LOCATION TECHNOLOGY 1) POSITIONING MECHANISM Fingerprint localization technology is tantamount to estimate the location of unknown nodes directly by using the strength of multiple received signals at the current location, which is different from using the strength of signals to locate distances. The usual method is to construct a high-dimensional position vector from multiple signal strength at a specific location, which is called the wireless fingerprint at that location. Unknown node information is estimated by calculating the similarity comparison between the collected fingerprint and the fingerprint databases. RADAR [17] and Horus [18] are the most classical indoor positioning systems in fingerprint positioning; both of them include the core method of fingerprint location. Fingerprint positioning systems generally included offline and online two phases; the off-line phase is mainly to build the signal strength database [19].
In the offline stage, the system is required to locate the location in the area and can use a known location area as a reference point. Radio Frequency Fingerprint Data is then collected at the reference point to construct a fingerprint location database associated with the location. The on-line stage, namely the online stage, provides location services according to the constructed fingerprint location database. Mobile terminals need to be positioned to collect radio frequency fingerprints, and then by comparing the location of the fingerprint database server and a radio frequency fingerprint, the estimated location the nearest to the mobile terminal can be discovered. As showing in FIGURE 1, the fingerprint location mechanism.
First, the mobile terminal requests the location to be sent; In the second step, the location server accesses the location server via the Internet or mobile network, then the location server receives the request and measures the mobile terminal to locate the RF fingerprint [20], [21]; In the third step, the server uses mobile devices to locate fingerprints in the fingerprint database; Fourth, the location fingerprint database returns the search results. In the fifth and sixth steps, the server uses the returned results to find the predicted location and then returns the predicted location to the mobile terminal's access network. The mobile terminal can display the final location.

2) POSITION PRINCIPLE
The off-line phase task of the RF fingerprint location algorithm is to establish a RF fingerprint database; in the online stage, the main task is to locate the location according to RSSI received by the mobile station. The principle of the location algorithm is shown in FIGURE 2. The RSSI average value of accurate sampling time is stored in each position fingerprint, and then the node position is estimated according to the deterministic algorithm.

B. A NEW INDOOR LOCATION ALGORITHM 1) LOCATION ALGORITHM MODEL
Firstly, RF signal intensity is collected, the signal intensity vector is formed, and the fingerprint database is established. The distance between real-time received signal and fingerprint signal is compared built on Euclidean Distance. In the formula (1), o (t) is the vector observed by the signal of the AP for the second time, F (l i ) is the Fingerprint corresponding to l i .
Formula (1) denotes the mean of the RF signal vector of upper l i , k positions with the smallest signal distance can be calculated. {l (1), l (2), . . . l (k)}, it indicates that the signal distances are sorted from large to small corresponding K position sets. Then the estimated position is a formula (3): The weight of all k positions is the same. That is, the smaller the distance, the greater the weight of the corresponding position. The estimated position is a formula (4): In the formula, D (o (t), F (l i )) represents the distance between the real-time received signal and the fingerprint signal. The smaller the distance between the two factors, the greater the denominator, which acts as a weight. ε is a very small number and plays the role of eliminating zero denominators.
Maximum Likelihood Estimation assumes that the location of RF signals coincides with the location, for example, the common distribution of Gauss distribution or histogram is consistent with the characteristics of the RF signal. By obtaining the conditional probability density function of the observed signal probability equation at each location, the position corresponding to the maximum probability is the estimated position. As showing in Formula (5): In the off-line training phase, if the RF signal characteristics are assumed to obey the Gauss distribution, the average value and the variance between the signal intensity vectored RF signal at each position needs to be calculated. The model for each location is as follows (6). (6) In the upper form µ j , σ j represents the mean and standard variance of the J AP. The range of values for J is 1 ≤ j ≤ m. The probability density function of radio frequency signal intensity is constructed. If the signal intensities of each AP is independent of each other, the signal intensities of the J AP received from the terminal's the observation value is shown in equation (7).
In addition, the probability can also be calculated by using the kernel density estimation function. Kernel Density Estimation Function is a non-parametric estimation method of data distribution, without any assumptions, but from the way of data samples themselves to study the characteristics of data distribution. A common kernel density estimation function is the Gauss kernel density function as following: In the formula above, W is the most important parameter for estimating nuclear density, i.e. nuclear width. The standard deviation is usually used as the kernel width of the Gauss kernel method. The kernel density estimation based on likelihood function is shown in equation (9): In the formula, P is the size of training samples and K is the function of kernel density estimation. To improve the accuracy, sometimes the maximum likelihood estimation is associated with KNN. The maximum likelihood probability chooses the location of k and then searches for the estimated location. Of course, it can also be used to calculate the conditional probability of the weight of the corresponding positions on further to improve the positioning accuracy, such as formula (10).
It should be pointed out in equation (10) that when k = 1.L ML (k) =L ML−KNN (t). The maximum likelihood estimation algorithm is usually used to locate discrete space or discrete mesh.
Unlike maximum likelihood estimation, a naive Bayesian localization algorithm also needs to consider the prior information about the location. The statistical characteristics of the RF fingerprint positioning method, searching and observing fingerprints with the most similar characteristics of training fingerprints, improve the positioning accuracy and reduce the computational area of complex mobile orbit positioning according to the historical positioning results or optimization results from mobile terminals users. Namely, By calculating the likely probability and the prior probability of each position, the posterior probability is obtained, and the position of the maximum posterior probability is the estimated position. Of course, Naive Bayesian localization conforms to continuous spatial localization, calculating the posterior probability and position expectation, as follows: The likelihood probability of naive Bayesian location P (o (t) |l i ) is the same as that of the maximum likelihood estimation location.
Prior probability P (l i ) computing depends on the rules of mobile terminals target users. Usually, based on the Markov model, the next group of reachable locations can be deduced by learning to track user behavior data, obtaining location information, or set a configurable value at the last location and the probability of the user movement. As showing in Formula (14).
In the upper form, the probability of k-time arriving at the position l i is the sum of the probability of k-1 time transferring from the set of positions adjacent to position l i to position l i .

2) LOCALIZATION ALGORITHM FLOWS
The basic idea of a RF fingerprints location algorithm is to establish an offline database first, and then to match online. The following detailed process is outlined. Radiofrequency fingerprints localization algorithm includes two stages: offline training and on-line localization. The former is responsible for sampling, data acquisition management organization to build a fingerprint database, the latter is responsible for receiving real-time observation of fingerprints and using historical location data to locate, in FIGURE 3.
The training process includes fingerprint database construction, time migration process, migration processing, and location equipment model construction. Through fingerprint, fingerprint data should be organized and processed before training mode, and the fingerprint database should be established. Then, according to the time and device identification, fingerprint processing time and device relocation process migration, the module is voluntary. According to fingerprint model characteristics after fingerprint training, the files generated by the location model (including time offset mode, device migration model and fingerprint touch model) are used for the location module. The location module includes three parts: the selection of Region of Interest (ROI), the selection of location AP and the calculation of posterior probability.
When receiving the real-time fingerprint location engine, the specific flow shown in Fig.3 can map the fingerprint location model according to the migration of observation time and device migration, and then select ROI and AP, which is part of the purpose of reducing the computational complexity. Then Bayesian localization is carried out, the posterior probability is calculated, and the location with the highest probability is selected. At this time, it is worth not that according to the empirical posterior probability and the posterior probability control process threshold, if it is greater than the threshold, the return result is the estimated location, otherwise, the location is located globally in space, and then the new location result is returned.

III. SIMULATION RESULTS AND ANALYSIS
In the simulation environment, the error cumulative distribution functioned is obtained by using the MATLAB platform and its accuracy is compared with another algorithm, and the simulation results are analyzed accordingly. The parameters are shown in Table 2:

A. PARAMETER SETTING
Selection of AP. Aiming at the difference between AP set in each fingerprint, that is to say, in a fingerprint acquisition, the intensity of AP signal that does not appear is set to the signal intensity that the terminal can perceive, the minimum range are from − l00db to − ll0db. The precondition is that we need to know the set of all AP in the environment beforehand, which brings extra overhead to the actual operation, and it is difficult to maintain the signal strength of non-AP simply set to the minimum, which can't distinguish which AP has weak signal strength.
This is an improved clustering method of KNN, which compares the distance between real-time received signals and fingerprint signals based on Euclidean distance. In other words, all grid points that obtain information about matching AP form a Cluster. The method to determine the Cluster is based on the probability that each grid point can detect the AP signal. In this way, each location is searched and calculated in the cluster (instead of the entire network). When the number of fingerprint locations is large, the search and calculation overhead can be reduced and the system stability can be improved.
Location area ROI. Because of the instability of indoor radio frequency signals, the fingerprints observed at the same location are likely to differ greatly from those observed at the offline stage. Moreover, if the number of fingerprint locations in the offline phase is too large, and every location is searched and calculated in all locations, it will inevitably lead to the overhead of location. Therefore, to solve these two problems, a pre-processing method based on fingerprint clustering will be adopted in the offline stage, so that the target location area in the positioning stage is limited to a specified set of locations.

B. PERFORMANCE ANALYSIS OF ALGORITHMS 1) SELECTION OF LOCATION AP
In this paper, the number of AP is considered as one as the objectives of the study. Set the number of AP to be 2, 3, 5, 6 and 10, a change in positioning accuracy is obtained. With the increase in the number, a state map similar to the normal distribution will be generated. FIGURE 4 compares the positioning performance of different AP numbers. As can be observed in the figure, when the number of AP is 3 and 5, the positioning accuracy is the highest, and when the error distance is 3 m, the positioning accuracy is about 85%. When the number of AP increases to 10, the positioning accuracy decreases, and the positioning accuracy is most. When the selected number of AP can distinguish the fingerprint features of the location area, the location accuracy will be the best thing. When the number of AP is 2, it is difficult to distinguish fingerprint features; at the same time, when the number of AP reaches 10, it will make some APs less differentiated, thus, it brings more risk of observation noise and reduces the overall positioning performance, thus reducing the positioning accuracy. But when AP is taken from 3 to 5, better positioning accuracy is obtained. It can be seen that the proper number of AP directly affect the positioning accuracy.

2) LOCATION ROI SELECTION
The location area is analyzed. D is the radius of the location ROI. In the global scope the different values of D and the nonuse of location ROI selection can experiment and the results are analyzed and compared respectively. The experimental results are shown in FIGURE 5. As can be observed in Fig. 5, when D = 2 and D = 3, the positioning accuracy is the highest, especially at 3m, the positioning accuracy has reached nearly 90%. However, with the increase in the range, the positioning accuracy will decrease. The reason is that indoor WiFi signal propagation is affected by environment, weakness, multipath, space-time interference, etc. The real-time fingerprint received by the mobile terminal does not necessarily match the fingerprint of the training fingerprint database perfectly. With the increase of location range, the possibility of matching observation fingerprint and other position fingerprint is further increased. Especially without prior selection, in the global state, the location area is not self-selected by using the historical location information of the mobile terminal, and the location result is unstable. Therefore, the selection of ROI and D based on historical location can improve positioning accuracy and stability. In this paper, a location area selection mechanism is therefore proposed to predict the terminal location. This mechanism is implemented in the location stage and is independent of AP and offline RF fingerprints in the location environment. Therefore, it avoids the influence of time-lapse on the instability of RF signals and the change of AP facilities. At the same time, by sett the radius D of the positioning area to be 2, 3, 5 and 6 respectively, the positioning accuracy is higher when the positioning radius is 2, especially when the error distance is 3 m, the positioning accuracy has reached nearly 90%. However, with the increase of the range, the positioning accuracy decreases. The experimental results show that there method not only reduces the location overhead but also improves the location accuracy.

3) DIFFERENCE COMPARISON OF ERROR ACCUMULATION
The proposed fingerprint localization algorithm NEW-FR and KNN compared the cumulative probability distribution of error. As shown in FIGURE 6. In this paper, the error cumulative distribution functioned is used to evaluate the error, and the error distance is placed at be 0-5 meters. Under the condition of an error probability distribution, the error distance reaches 100% when it is 5 meters, that is to say, its accurate positioning accuracy is 5 meters, which improves relative to outdoor positioning accuracy, but the positioning accuracy is not too high for the complex indoor environment. As showed in Figure 6, the positioning accuracy of NEW-FR is higher than that of KNN. The cumulative probability of NEW-FR is close to 1 at 2.5 meters, that just says, the positioning accuracy of NEW-FR is 100% within 2.5 meters. KNN has a 90% probability positioning accuracy of 4.5 meters. Because KNN does not take into consideration the time-varying characteristics of the signal, the positioning accuracy is relatively low. Within 1 meter, the positioning accuracy is about 30%. Therefore, it is concluded that the weighted KNN algorithm can reduce the error and obtain better positioning accuracy throughBayes multiple reference point samples. As shown in Figure 6, the positioning accuracy of the Bayes algorithm is higher than that of NN algorithm, so the probability distribution based on fingerprint matching can be seen, the main reason are that the calculation of location distribution probability reduces the location range and eliminates some noise interference. The model based on the Bayesian principle has a better localization effect than that of NN. It improves the fingerprint recognition ability and adaptability of nodes but requires a higher sample size, such as a large number of data involved in the prior calculation.
In FIGURE.7, comparisons of Location Errors of Different Location Algorithms the NEW-FR algorithm have better positioning accuracy than other algorithms. The cumulative errors of NN, K-Nearest Neighbor 4 (KNN4), NEW-FR and Bayes experiments are 2.0813 m, 1.3958 m, 0.835029 m and 1.9554 m, respectively. NN algorithm is to identify the item which is most similar to the target data from the database according to the similarity of the data. Such similarity is usually quantified the distance between the data in space. It can be considered that the closer the distance between the data in space is. The higher the similarity between the data is. KNN method, the positioning area is divided into 1 m × 1 m grids, each grid is regarded as a type, represented by the grid label, count the votes on K grid labels, and select the grid with the most votes as the positioning result. The training data used throughout this process is not ''learned''. KNN4 is one way to improve KNN. It optimizes the measurement of distance and the selection of K value. The Naive Bayes (Bayes) indoor location algorithm ignores the correlation between the signals of each wireless access point, which eventually leads to the decrease of positioning accuracy.

IV. SUMMARY
Wireless positioning technology is commonly used in the production and life of today's society. The research of wireless positioning technology has become a hot spot; the video fingerprints localization algorithm proposed in this paper is simulated on the platform of MATLAB. In the offline propagation model, several commonly used fingerprint localization algorithms, such as NN and KNN, are selected to compare, without considering the loss of signal intensity caused by multipath effect, reflection and refraction, the simulation results show that the fingerprint localization algorithm proposed to this paper has high accuracy, high stability and good localization effect in complex localization environment. Later research direction is mainly to find other more effective and stable information to replace the signal strength information and to add additional information for positioning assistance to improve positioning accuracy. The research uses usergenerated content to generate a fingerprint database location, reduce the need to collect data time, and even automatically generate, update, maintenance capabilities.