<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JCC</journal-id><journal-title-group><journal-title>Journal of Computer and Communications</journal-title></journal-title-group><issn pub-type="epub">2327-5219</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jcc.2017.53011</article-id><article-id pub-id-type="publisher-id">JCC-75135</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  A Study of WiFi-Aided Magnetic Matching Indoor Positioning Algorithm
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Enliang</surname><given-names>Wang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Mei</surname><given-names>Wang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Zhibin</surname><given-names>Meng</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Xiangyu</surname><given-names>Xu</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>Key Laboratory of Cognitive Radio &amp;amp; Information Processing, Ministry of Education, Guilin University of Electronic Technology, Guilin, China</addr-line></aff><pub-date pub-type="epub"><day>08</day><month>03</month><year>2017</year></pub-date><volume>05</volume><issue>03</issue><fpage>91</fpage><lpage>101</lpage><history><date date-type="received"><day>January</day>	<month>9,</month>	<year>2017</year></date><date date-type="rev-recd"><day>Accepted:</day>	<month>March</month>	<year>10,</year>	</date><date date-type="accepted"><day>March</day>	<month>13,</month>	<year>2017</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
   
   Aiming at the shortcomings of the existing indoor location algorithm, such as low accuracy of positioning, high deployment and maintenance cost, and unstable robustness, this paper proposes a method of indoor location based on the integration of smartphone with WiFi and magnetic field using multi-sensor fusion. In the initial stages of positioning, rough location is achieved by Wi-Fi-RSSI fingerprints which provides an initial location and geomagnetic matching area for indoor positioning based on particle filter magnetic field matching. This paper proposes the use of median filter algorithm to deal with the original magnetic field data and covariance interpolation algorithm to generate magnetic field map, and effectively reduce the interference which caused by geomagnetic fluctuations, thereby it will improves the positioning accuracy. Finally, through conducting comprehensive experiments and tests, the results show that the proposed technique can reliably achieve 0.836 meters precision in current experimental environment. 
  
 
</p></abstract><kwd-group><kwd>Indoor Positioning</kwd><kwd> Magnetic Field</kwd><kwd> Particle Filter</kwd><kwd> Smartphones</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>As the most people spend 70% to 90% of their time using mobile location-based services (LBS) in indoor environments, the need for indoor location technology is increasing and becoming critical. In recent years, with the rapid development of wireless communication technology and the widespread popularity of intelligent terminals, wireless location technology has also become a research focus. At present, the widely used global positioning system in the outdoor field can achieve relatively accurate positioning and navigation, but the GPS signal in the indoor serious degradation or even unavailable [<xref ref-type="bibr" rid="scirp.75135-ref1">1</xref>]. The indoor positioning system based on the wireless network framework is widely studied because it does not need to add other hardware, and has low cost, wide deployment and other advantages [<xref ref-type="bibr" rid="scirp.75135-ref2">2</xref>] [<xref ref-type="bibr" rid="scirp.75135-ref3">3</xref>]. However, WiFi signals may be affected by attenuation, multipath fading, human obstruction and so on, which may lead to a decrease in positioning accuracy, although positioning can be achieved by WiFi fingerprint or propagation model [<xref ref-type="bibr" rid="scirp.75135-ref4">4</xref>].</p><p>Modern architecture of reinforced concrete or steel frame structure on the indoor magnetic field disruption, the formation of a non-uniform magnetic field environment create the differences of the magnetic field in different tracks. Thus, using of the magnetic field in the indoor environment, unique, stability and the difference between different regions to achieve positioning become possible. Therefore, some teams began to explore the use of geomagnetism to achieve indoor positioning, which is more representative of the University of Oulu, Finland, Janne Haverinen et al. and the use of geomagnetism for indoor positioning. The research team has completed a verification test in a mine tunnel of about 1380 meters with a positioning accuracy of 1.5 meters [<xref ref-type="bibr" rid="scirp.75135-ref5">5</xref>]. At the Massachusetts Institute of Technology (MIT), the researchers rely on indoor magnetic fingerprint matching and inertial sensor combination to locate in the office environment. The results showed that the cumulative error of 0.71 meters was 50%, 1.64 meters probability was 90% [<xref ref-type="bibr" rid="scirp.75135-ref6">6</xref>]. Due to the complexity of the indoor environment, all kinds of technology have limitations, so many indoor positioning methods are difficult to achieve a wide range of popularization. Therefore, it can achieve the goal of low cost, high precision, favorable timeliness and strong universality by merging the multi-indoor positioning technology, taking advantage of various methods and complementing the deficiency [<xref ref-type="bibr" rid="scirp.75135-ref7">7</xref>]. Combined with the advantages and shortcomings of existing single positioning technology, mobile phone which combined with WiFi and geomagnetic fingerprint fusion positioning is proposed. In the positioning phase, the magnetic matching region is selected by the RSSI positioning result. Subsequently, it is precisely positioned by the geomagnetic field. This combination method can effectively overcome the positioning error caused by multipath effect of RSSI and solve the problem of too slow convergence rate of particle filter in magnetic field localization.</p></sec><sec id="s2"><title>2. Correlation Algorithm</title><sec id="s2_1"><title>2.1. Location Model</title><p>In the office environment, the first set walking path in accordance with certain laws, and then experimental personnel holding a smartphone to walk at a constant speed in the set route, collecting and recording the magnetic field used to generate line magnetic filed map. Secondly, a reference point (RP) which corresponds to an absolute coordinate is used to assist the positioning of the target is set on the route. At the same time, the RSS of WiFi and the magnetic field are captured at each reference point for positioning. Mobile users in the environment has access to map data, the use of handheld terminals, real-time data acquisition and the use of existing algorithms to obtain real-time positioning results.</p><p>In this paper, the feasibility and data acquisition and processing of magnetic field for indoor location are introduced. As shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>, the magnetic matching indoor positioning algorithm assisted by WiFi is introduced. Compared with the wireless fingerprint positioning method, the geomagnetic matching location error is small [<xref ref-type="bibr" rid="scirp.75135-ref8">8</xref>], but due to the non-uniqueness of the geomagnetic field, the mismatch ratio of the magnetic matching algorithm is seriously. In order to reduce the mismatch ratio of magnetism positioning, and WiFi fingerprint algorithm is combined to improve positioning accuracy [<xref ref-type="bibr" rid="scirp.75135-ref9">9</xref>] [<xref ref-type="bibr" rid="scirp.75135-ref10">10</xref>].</p></sec><sec id="s2_2"><title>2.2. Geomagnetic Data Acquisition and Processing</title><p>With the development of micro-electro-mechanical systems (MEMS), mobile intelligent terminals are embedded with sensors, such as magnetometers and the like for mobile users to use and magnetic field positioning, and it provides the possibility. In order to prove the stability of the geomagnetic signal, two sets of data are collected at different time periods in the same place. As shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>, the geomagnetic signal has a certain stability, but there is some fluctuation in the local, which provides a theoretical basis for making full use of the geomagnetic field to do indoor positioning.</p></sec><sec id="s2_3"><title>2.3. Median Filter Algorithm</title><p>Median filtering is essentially a method of determining the filter output response by minimizing the sum of the absolute values of the errors [<xref ref-type="bibr" rid="scirp.75135-ref11">11</xref>]. Let a set of observations <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x2.png" xlink:type="simple"/></inline-formula> be the sum of the absolute values <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x3.png" xlink:type="simple"/></inline-formula> of the approximations<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x4.png" xlink:type="simple"/></inline-formula>.</p><disp-formula id="scirp.75135-formula99"><label>(1)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x5.png"  xlink:type="simple"/></disp-formula><p>To the minimum, it must have</p><fig id="fig1"  position="float"><label><xref ref-type="fig" rid="fig1">Figure 1</xref></label><caption><title> Algorithm architecture</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x6.png"/></fig><fig-group id="fig2"><label><xref ref-type="fig" rid="fig2">Figure 2</xref></label><caption><title> Stability and local fluctuation of geomagnetic field with (a) at different days and (b) different mobile phones.</title></caption><fig id ="fig2_1"><label> (b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x7.png"/></fig><fig id ="fig2_2"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x8.png"/></fig></fig-group><disp-formula id="scirp.75135-formula100"><label>(2)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x9.png"  xlink:type="simple"/></disp-formula><p>To satisfy the Formula (2), the value in the middle position after the size order should be taken. As shown in <xref ref-type="fig" rid="fig3">Figure 3</xref>, the collected geomagnetic field intensity data, even in the same sampling point, for a period of time, the data will be 2uT jitter, so we use the median filter and the original data Smoothing filter. The filtered data can improve the match rate when the original data is retained, which is the main feature of the original data.</p></sec><sec id="s2_4"><title>2.4. Covariance Interpolation Algorithm</title><p>Because of the characteristics of geomagnetic space fluctuation, the covariance interpolation algorithm is more effective than other interpolation algorithms. Kriging is a mathematical statistical method for spatial interpolation [<xref ref-type="bibr" rid="scirp.75135-ref12">12</xref>]. Being used to weight around the measurements to arrive at the location of the forecast is not measured. Commonly used formula is:</p><disp-formula id="scirp.75135-formula101"><label>(3)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x10.png"  xlink:type="simple"/></disp-formula><p>where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x11.png" xlink:type="simple"/></inline-formula> is the position <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x12.png" xlink:type="simple"/></inline-formula> of the magnetic field value; <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x13.png" xlink:type="simple"/></inline-formula>is the number of measured values .In order to reduce the computational complexity of the interpolation algorithm, only the local magnetic field around the estimated point is</p><fig id="fig3"  position="float"><label><xref ref-type="fig" rid="fig3">Figure 3</xref></label><caption><title> Median filtering of geomagnetic data</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x14.png"/></fig><p>calculated every time, and then it fused to the global grid map. And the magnetic field predicted value <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x15.png" xlink:type="simple"/></inline-formula> of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x16.png" xlink:type="simple"/></inline-formula> is obtained. As shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>, a set of geomagnetic field strength data is measured in a 27-meter-long and 1- meter-wide corridor. The median filtering algorithm is used to smooth out the singular value of the field strength. Then, Interpolation algorithm to obtain interpolated geomagnetic field map.</p></sec><sec id="s2_5"><title>2.5. Particle Filtering Algorithm</title><p>The use of smartphone that owns magnetometer to read the magnetic field data is relative to the phone’s coordinate system. In terms of the same position to change the attitude of the mobile phone, reading the magnetic field vector is different, while the smartphone carried by the magnetometer itself exists measuring noise, and the error is random. This also leads to the non-uniqueness of geomagnetic fingerprints in the region. The particle filter algorithm can solve this problem. Particle filter algorithm, including the following basic steps:</p><p>1) Initialization. The particle set <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x17.png" xlink:type="simple"/></inline-formula> is generated by a priori probability<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x18.png" xlink:type="simple"/></inline-formula>, and all the particle weights are<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x19.png" xlink:type="simple"/></inline-formula>.</p><p>2) Particle update.</p><disp-formula id="scirp.75135-formula102"><label>(4)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x20.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.75135-formula103"><label>(5)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x21.png"  xlink:type="simple"/></disp-formula><p>Which <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula> represents the step size, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula>represents the direction of the user changes in the value of the direct use of compass and gyroscope measured, that <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula> is the direction of the particles <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula> at the moment<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x26.png" xlink:type="simple"/></inline-formula>, similarly, that <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x27.png" xlink:type="simple"/></inline-formula> represents the particles <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x28.png" xlink:type="simple"/></inline-formula> at the time of the location coordinates. Respectively, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x29.png" xlink:type="simple"/></inline-formula>are subject to <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x29.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x30.png" xlink:type="simple"/></inline-formula> and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x29.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x30.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x31.png" xlink:type="simple"/></inline-formula> gaussian noise.</p><fig id="fig4"  position="float"><label><xref ref-type="fig" rid="fig4">Figure 4</xref></label><caption><title> Spatial distribution of interpolated magnetic field</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x32.png"/></fig><p>3) Importance of resampling</p><p>Based on the Monte Carlo method, the objective function is fitted by random sampling. At the moment<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x33.png" xlink:type="simple"/></inline-formula>, for a set of particles<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x33.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x34.png" xlink:type="simple"/></inline-formula>, the state of each particle is updated to <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x33.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x34.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x35.png" xlink:type="simple"/></inline-formula> produce random particles around the new position to get a new set of particles<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x33.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x34.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x36.png" xlink:type="simple"/></inline-formula>.</p><p>4) Weight calculation.</p><p>Since each particle represents a possibility of the target state, the purpose of system observation to make the particle similar to the actual situation obtains a larger weight, and the particle with the larger difference from the actual situation gets a smaller weight. Consequently, the weighting of exponential distribution is calculated:</p><disp-formula id="scirp.75135-formula104"><label>(6)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x37.png"  xlink:type="simple"/></disp-formula><p>Weighted normalization:</p><disp-formula id="scirp.75135-formula105"><label>(7)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x38.png"  xlink:type="simple"/></disp-formula><p>5) Estimate the user location</p><p>The current location is estimated using the particles sampled in the previous step.</p><disp-formula id="scirp.75135-formula106"><label>(8)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x39.png"  xlink:type="simple"/></disp-formula></sec></sec><sec id="s3"><title>3. Experimental and Results</title><sec id="s3_1"><title>3.1. Experimental Setup</title><p>In order to verify the fingerprint model and proposed algorithm in this paper, an experimental building was chosen as the experimental environment. In the experiment, we select the Huawei honor-7 smartphone as a receiving device. TP- link dual-band router is as the WiFi access point to construct the WiFi fingerprint library and auxiliary magnetic matching positioning. The experimental scenarios were selected in the back hall corridor of the Science and Technology Building hall. In this area, four APs were deployed. In the corridor, according to the established route, setting a RP reference point every 0.5 meters, and recording the RP’s WiFi signal RSSI which generates fingerprints database. Then, on the same route, according to the uniform velocity motion, the geomagnetic field is collected, and the collected data is filtered through the median filter, mapped to the route uniformly. Finally, covariance interpolation is used to generate the geomagnetic map.</p></sec><sec id="s3_2"><title>3.2. Experimental Simulation and Analysis</title><p>In the positioning phase, first, the use of WiFi fingerprints obtain the initial position and rough location of the delineation. In combination with the error of the RSSI localization algorithm in the experiment, we will delimit the rough position and then retrieve the magnetic filed data of the database in the coarse position and use the particle filter algorithm to match the geomagnetic data in the geomagnetic map, and the geomagnetic data is collected in the actual movement. Secondly, the use of mobile phones with accelerometer and electronic compass inferres the direction and displacement of the user movement. Subsequently, using the geomagnetism distribution in the coarse region, the particle filter algorithm is used to realize the accurate indoor location, and finally determine the moving trajectory of the user.</p><p>In the use of WiFi positioning phase, we use the commonly used location fingerprint method. In the known indoor area, n WiFi access points (AP1, AP2, AP3... APn) is deployed. Furthermore, the RSS values <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x40.png" xlink:type="simple"/></inline-formula> from the n different APs collected at the m reference point <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x40.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x41.png" xlink:type="simple"/></inline-formula> are stored in the database, as a fingerprint use to location, the database is offline phase of the fingerprint library. In the positioning phase, the fingerprint database is used as a map of the location area. The data in the fingerprint library is used as a known map map during the positioning. The corresponding RSSI spatial distribution of an AP in the database, as shown in <xref ref-type="fig" rid="fig5">Figure 5</xref>.</p><p>As shown in <xref ref-type="fig" rid="fig5">Figure 5</xref>, WiFi signal strength as the user and the AP access point distance increases gradually weakened. In the online positioning phase, the signal strength values <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x42.png" xlink:type="simple"/></inline-formula> sent from n different APs are collected in real time by the smart phone, and then matched with the fingerprints <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x42.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x43.png" xlink:type="simple"/></inline-formula> in the fingerprint database. In the match-</p><fig id="fig5"  position="float"><label><xref ref-type="fig" rid="fig5">Figure 5</xref></label><caption><title> WiFi RSSI spatial distribution</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x44.png"/></fig><p>ing, K nearest neighbor algorithm is used. Instead of using the nearest distance as the location of the mobile terminal, the nearest K (<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x45.png" xlink:type="simple"/></inline-formula>) sampling points are selected and the K sampling points are calculated by the Formulas (9) and (10) of the average coordinates, as the target location coordinates.</p><disp-formula id="scirp.75135-formula107"><label>(9)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x46.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.75135-formula108"><label>(10)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/75135x47.png"  xlink:type="simple"/></disp-formula><p>Here the distance is calculated using the Euclidean distance. In Equation (9), <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x48.png" xlink:type="simple"/></inline-formula>represents the position coordinates of the i sample point. With <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/75135x49.png" xlink:type="simple"/></inline-formula> as the center and 3 times the standard deviation of the RSSI as the radius to determine the matching area of the magnetic field, to achieve accurate matching of magnetic field by particle filter.</p><p>According to the specific circumstances of the experimental scene, the next phase of the magnetic filed data generated by the map is shown in <xref ref-type="fig" rid="fig6">Figure 6</xref>. It can be seen from <xref ref-type="fig" rid="fig6">Figure 6</xref> that the color of the energy distribution is closer to red in the one-meter wide corridor, indicating that the energy is stronger near the coordinate point (2750, 750), because the energy is the strongest point near the floor for the building body pillars.</p><p>In this paper, the particle filter algorithm for magnetic matching positioning can use the location of the results of geomagnetic matching to provide a search range. At the same time, the geomagnetic data collected online includes the location information at this moment, (magnetic field data and direction angle, which the online data and database map to match.) The resulting positioning of the trajectory is shown in <xref ref-type="fig" rid="fig7">Figure 7</xref>.</p><p>The error analysis of WiFi-RSSI and geomagnetic field in <xref ref-type="fig" rid="fig8">Figure 8</xref> shows that the average error of WiFi-RSSI positioning is 2.23 meters, at the same time, due</p><fig id="fig6"  position="float"><label><xref ref-type="fig" rid="fig6">Figure 6</xref></label><caption><title> The geomagnetic map after interpolation</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x50.png"/></fig><fig id="fig7"  position="float"><label><xref ref-type="fig" rid="fig7">Figure 7</xref></label><caption><title> WiFi-RSSI and geomagnetic fusion positioning of the trajectory</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x51.png"/></fig><fig id="fig8"  position="float"><label><xref ref-type="fig" rid="fig8">Figure 8</xref></label><caption><title> Error of WiFi-RSSI and magnetic field fusion positioning</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/75135x52.png"/></fig><p>to the location of WiFi-RSSI, the convergence of the particle filter is obviously improved, and the run-time is saved, and the mean of positioning error is 0.836 meters. Because the measured value is disturbed by the surrounding environment, the effect of the whole algorithm is in a fluctuating state. The accuracy and stability of the algorithm are determined by the RSSI algorithm that was originally used. At the same time, the whole consideration is used in the algorithm, instead of judging the position of one or several data, so the degree of susceptibility to interference is better than that of wifi.</p></sec></sec><sec id="s4"><title>4. Conclusion</title><p>In order to solve the problem which is high mismatching rate in the process of matching the location of the magnetic field, this paper proposes a fusion location algorithm of WiFi aid magnetic field, which is simple and low cost, and it combines with particle filter algorithm to achieve ideal the positioning effect. The experimental results show that this method has potential advantages in improving the accuracy and real-time performance. Future work will continue to optimize the algorithm and research to improve positioning accuracy and timeliness.</p></sec><sec id="s5"><title>Acknowledgments</title><p>This work is suported by the National Natural Science Foundation of China (No.61371107), the Guangxi Experiment Center of Information Science (No.LD16061X), the Guangxi Natural Science Foundation (No.2016GXNSFBA38014), and the China Postdoctoral Science Foundation (No.2016M602921XB), the Innovation Project of GUET Graduate Education (YJCXS201517).</p></sec><sec id="s6"><title>Cite this paper</title><p>Wang, E.L., Wang, M., Meng, Z.B. and Xu, X.Y. (2017) A Study of WiFi-Aided Magnetic Matching Indoor Positioning Algorithm. Journal of Computer and Communications, 5, 91-101. https://doi.org/10.4236/jcc.2017.53011</p></sec></body><back><ref-list><title>References</title><ref id="scirp.75135-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Liang, D., Zhang, Z. and Peng, M. (2015) Access Point Reselection and Adaptive Cluster Splitting-Based Indoor Localization in Wireless Local Area Networks. IEEE Internet of Things Journal, 2, 573-585. https://doi.org/10.1109/JIOT.2015.2453419</mixed-citation></ref><ref id="scirp.75135-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Yang, J., Chen, Y., Martin, R.P., Trappe, W. and Gruteser, M. (2012) On the Performance of Wireless Indoor Localization Using Received Signal Strength. Handbook of Position Location, 395-424.</mixed-citation></ref><ref id="scirp.75135-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Milioris, D., Tzagkarakis, G., Papakonstantinou, A., Papadopouli, M. and Tsakalides, P. (2012) Low-Dimensional Signal-Strength Fingerprint-Based Positioning in Wireless Lans. Elsevier Ad Hoc Networks.</mixed-citation></ref><ref id="scirp.75135-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Zampella, F., Jimenez Ruiz, A.R. and Seco Granja, F. (2015) Indoor Positioning Using Efficient Map Matching, RSS Measurements, and an Improved Motion Model. IEEE Transactions on Vehicular Technology, 64, 1-1.  
https://doi.org/10.1109/TVT.2015.2391296</mixed-citation></ref><ref id="scirp.75135-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Haverinen, J. and Kemppainen, A. (2011) A Geomagnetic Field Based Positioning Technique for Underground Mines. IEEE International Symposium on Robotic and Sensors Environments. IEEE, 7-12.</mixed-citation></ref><ref id="scirp.75135-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Priyantha, B.N. Chakraborty, A. and Balakrishnan, H. (2000) The Cricket Location-Support System. In: 6th Annual In-ternational Conference on Mobile Computing and Networking. https://doi.org/10.1145/345910.345917</mixed-citation></ref><ref id="scirp.75135-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Li, Y., Zhuang, Y., Lan, H., et al. (2015) WiFi-Aided Magnetic Mathicng for Indoor Navigation with Consumer Portable Devices. Micromachines, 2015, 747-764.  
https://doi.org/10.3390/mi6060747</mixed-citation></ref><ref id="scirp.75135-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Shu, Y., Bo, C., Shen, G., et al. (2015) Magicol: Indoor Localization Using Pervasive Magnetic Field and Opportunistic WiFi Sensing. IEEE Journal on Selected Areas in Communications, 33, 1-1. https://doi.org/10.1109/JSAC.2015.2430274</mixed-citation></ref><ref id="scirp.75135-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Li, D., Zhang, B. and Li, C. (2015) A Feature Scaling Based k-Nearest Neighbor Algorithm for Indoor Positioning Systems. 3, 436-441.</mixed-citation></ref><ref id="scirp.75135-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Carrillo, D., Moreno, V., úbeda, B., et al. (2015) MagicFinger: 3D Magnetic Fingerprints for Indoor Location. Sensors, 15, 17168-94.  
https://doi.org/10.3390/s150717168</mixed-citation></ref><ref id="scirp.75135-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Boles, W.W., Kanefsky, M. and Simaan, M. (1990) A Reduced Edge Distortion Median Filtering Algorithm for Binary Images. Signal Processing, 21, 37-47.</mixed-citation></ref><ref id="scirp.75135-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Beagum, S.S., Hundewale, N. and Sathik, M.M. (2015) Improved Adaptive Median Filters Using Nearest 4-Neighbors for Restoration of Images Corrupted with Fixed-Valued Impulse Noise. IEEE International Conference on Computational Intelligence and Computing Research. IEEE.</mixed-citation></ref></ref-list></back></article>