# Location Fingerprint Extraction for Magnetic Field Magnitude Based Indoor Positioning

Authors: Wenhua Shao; Fang Zhao; Cong Wang; Haiyong Luo; Tunio Muhammad Zahid; Qu Wang; Dongmeng Li
Journal: Journal of Sensors
 (2016)

---

## Abstract

Smartphone based indoor positioning has greatly helped people in finding their positions in complex and unfamiliar buildings. One popular positioning method is by utilizing indoor magnetic field, because this feature is stable and infrastructure-free. In this method, the magnetometer embedded on the smartphone measures indoor magnetic field and queries its position. However, the environments of the magnetometer are rather harsh. This harshness mainly consists of coarse-grained hard/soft-iron calibrations and sensor electronic noise. The two kinds of interferences decrease the position distinguishability of the magnetic field. Therefore, it is important to extract location features from magnetic fields to reduce these interferences. This paper analyzes the main interference sources of the magnetometer embedded on the smartphone. In addition, we present a feature distinguishability measurement technique to evaluate the performance of different feature extraction methods. Experiments revealed that selected fingerprints will improve position distinguishability.


---

## Body

## 1. Introduction

Location-based services (LBS) in smartphones have attracted tremendous attention in recent years, since convenient and high precision localization services improve people’s daily life significantly. These services include navigating a driver to a destination in an unfamiliar area, searching a book inside a large library, or finding a friend at a complex airport.However, traditional localization techniques, GPS, for example, are only available in outdoor scenarios. They become invalid when it comes to indoor areas, because walls and roofs dramatically attenuate signals from GPS satellites.Therefore, many indoor localization techniques have been presented by researchers. These techniques include WiFi [1–4], echo [5, 6], and FM [7–9] based approaches. However, WiFi based localization methods are energy expensive for smartphones. Echo approaches are too sensitive to location change, which makes them improper for continuous positioning in a large area. FM methods often become invalid when radio frequency (RF) signals are attenuated by obstacles.With the development of sensing systems mounted on smartphones, sensing based approaches to indoor localization became available. That is, location-related signals are sensed, and then the user’s location is estimated based on these signals. Indoor magnetic field is one kind of location-related signals, which can be sensed by magnetometers embedded on smartphones.Indoor magnetic field is a pervasive anomalies field induced by geomagnetic field. Because of its location-related, infrastructure-free, and energy efficient features, many researchers have focused on utilizing indoor geomagnetic field for indoor localization purposes. Some experts [10] leverage indoor magnetic anomalies as landmarks, since these anomalies generated by ferromagnetic objects, that is, pillars and doors, are relatively stable. Other researchers [11] construct an indoor magnetic magnitude model, using probability method to estimate user location. In order to improve localization feasibility, experts [10, 12] introduced particle filter framework, which makes it possible to fuse multipositioning methods, including WiFi, Bluetooth, and pedestrian dead reckoning (PDR).The smartphone collects the indoor magnetic field signal by the magnetometer; however, this process is interfered in by hard/soft-iron effect, hand quivers, and electronic noise, which are not location-related. These interferences decrease the distinguishability of location fingerprints in magnetic field based localization systems.The main purpose of this paper is to extract location-related only feature of indoor magnetic fields for indoor localization. Although indoor magnetic field contains location information, this information is interfered in by hard/soft-iron effect, hand quiver, and electronic noise. Therefore, rejecting interference signals and keeping location-related signals are beneficial for improving indoor localization performance.There are two main challenges to magnetic field magnitude (MFM) based location feature extraction. The first one is to ascertain interference sources of magnetometers embedded on the smartphone. This paper first examines the model of magnetometer measurement and then derives the inverse model to estimate indoor magnetic field from magnetometer measurement. With this inverse model as well as related experiments, it is found that the fundamental interference sources of real MFM estimation are coarse-grained soft/hard-iron calibration and sensor electronic noise.Secondly, there are various magnetic field fingerprint extraction methods; hence, it is necessary to select a high discernible one among them. However, a few researchers have studied this problem. Galván-Tejada et al. compared temporal, spectral, and energy features of indoor magnetic field [13]. But their work concentrates on room level classification. Although localization accuracy can reflect fingerprint performance in some degree, it is affected by the localization algorithm. Therefore, to measure fingerprint distinguishability, this paper presents a novel and lightweight distinguishability measurement method (DAME). This method provides an independent way to qualify fingerprint distinguishability, and it has low overhead compared to previous works.In conclusion, our contributions are threefold:(i)
We perform in-depth studies of indoor magnetic field attributes and magnetometer measurement. Then, we present the notion that coarse-grained soft/hard-iron calibration and sensor noise are the fundamental reasons of device heterogeneity and user diversity.(ii)
We propose a novel fingerprint distinguishability measurement method, DAME, which is especially suitable for low discernibility MFM fingerprint.(iii)
With DAME, we perform a study on various fingerprint extraction methods and find that Butterworth low pass filter (LPF) is a high discernible fingerprint extraction method of our experiments.This paper conducts extensive experiments on commercially available smartphones to evaluate the research. Experiment result shows that coarse-grained soft/hard-iron calibration and sensor electronic noise were pervasive in various kinds of smartphones. Butterworth filter fingerprint is a high discernible fingerprint extraction method. Confusion matrixes and their localization errors are also computed to show the localization accuracy improvement with the high discernible fingerprint.This paper is organized as follows. Section2 describes the related work. Section 3 reviews the background of indoor magnetic field formation as well as its advantages and challenges in indoor localization. Section 4 presents the main interferences sources of embedded magnetometer on the smartphone. Section 5 presents the DAME fingerprint distinguishability measurement method and the study for finding a high discernible fingerprint. Section 6 describes the experiments. Finally, Section 7 concludes the paper with a discussion.


## 2. Related Work

Localization technology is an enabling technology in pervasive computing area, which provides a foundation for the context-aware service. Many efforts have been devoted to this field, and there are already numerous commercially available positioning technologies. In recent years, various indoor MFM based localization methods have been presented; however, there are few researches related to MFM location feature extraction.Chavez-Romero et al. presented a robotic wheelchair based indoor localization method using visual markers and particle filter [14]. Their system is mounted on a wheelchair, and the wheels can provide odometry data, which is not available for the pedestrian user holding a smartphone.Li et al. addressed reliable and accurate indoor localization using inertial sensors commonly found on commodity smartphones [15]. They utilized indoor magnetic field based compass to provide orientation for their particle filter localization system.Shu et al. described a fusion indoor localization system with pervasive magnetic field and opportunistic WiFi [16]. They noticed the phenomena where different devices and different smartphone attitudes cause magnetic field measurement offset. So, they remove the mean of MFM sequences to overcome this offset. Besides, their system uses these sequences to update particle weight at each step event.Frassl et al. researched the magnetic maps of indoor environments [17]. They studied the magnetic field intensity and direction distribution features. Based on their analysis, they implemented a high precision indoor localization system using foot mounted inertial sensors as well as a magnetometer.Angermann et al. conducted in-depth studies on the characterization of the indoor magnetic field [18]. They utilized a well calibrated sensor package mounted on a measuring device with code odometry to collect and evaluate indoor magnetic field. In their work, they presented the notion that the multiple measurements along a path showed strong modulation.Le et al. studied magnetic field mapping and fusion method for indoor localization [11]. Their algorithm proves that local magnetic disturbances carry enough information to localize without the help from other sensors. They built a magnetometer measurement probability model to update particle weight in their particle filter based positioning algorithm.Xie et al. built MaLoc, a magnetic fingerprint based indoor localization system [12]. They presented the notion that magnetometer’s sensitivity is different across different smartphones. Hence, they used magnetic magnitude difference to compare real-time sampling data with trained data.Galván-Tejada et al. presented an extension and improvement of their previous indoor localization model [13]. The model tests many magnetic field signal features, including kurtosis, mean, and slope. However, their model is designed for room level classification.Although there are various magnetic field feature extraction methods utilized by different indoor localization systems, they mainly focus on localizing users through original magnetic magnitude fingerprints. However, the original fingerprints are interfered in by coarse-grained soft/hard calibration and sensor electronic noise. Therefore, this paper gives an in-depth study on how to reduce magnetometer interferences and present the DAME algorithm to evaluate the performance of different MFM feature extraction methods.


## 3. Insight into Indoor Magnetic Field

Modern buildings generally adopt steel reinforced concrete in their structures. However, these ferromagnetic materials distort the magnetic field in various manners in different areas. Though this distortion is negative for orientation estimation of pedestrian dead reckoning (PDR), it can be used as indoor location feature.Indoor magnetic field is distorted locally, because of pillars, escalators, and large iron furniture. These ferromagnetic objects change the spread of magnetic lines, so indoor MFM reveals different intensities across different locations. Figure1 illustrates this distortion: the magnitude changes in different locations.Figure 1
Stable and local disturbance of indoor magnetic field. This is the MFM of a 55-meter-long corridor collected in constant speed. The offset between the two signals will be explained in Section5.2.Indoor magnetic field’s distortion patterns are static, because the geomagnetic field varies rather slowly. Moreover, the indoor magnetic anomalies are mainly formed by building ferromagnetic structure. As a result, provided that the structure remains unchanged, the magnetic anomalies will be invariant. For instance, Figure1 demonstrates this stability. The MFM of one corridor was collected twice over 50 days. Although there is a calibration offset between the two signals, the anomalies of the two are similar. The calibration offset will be explained in Section 5.2.Magnetic field has low discernibility. Geomagnetic magnitude at the earth’s surface ranges from 25 to 65μT [19]. Because indoor magnetic field is mainly formed by distortion of the geomagnetic field, this narrow range is also the approximate magnitude scope of indoor magnetic field. As a result, the number of similar distortion patterns will increase with the enlargement of the searching scope. Take the red line in Figure 1 as an example; there is only one location’s magnitude, which is equal to 50 when the search scope is limited in the first one meter. But the location number increases to 3 when the search scope increases to ten meters. Hence, it can be deduced that the longer the search scope is, the more confusing locations there are.As a brief summary, indoor magnetic field is locally distorted and location stable, which are the advantages for indoor localization, but the field’s low discernibility brings about challenges to location feature comparison.


## 4. Indoor Magnetic Field Interferences

In this section, we discuss the process of magnetometer measuring the geomagnetic field and magnetometer noise. Furthermore, we analyze interference sources of magnetometer measurement.


### 4.1. Characteristics of Magnetometers on Smartphones

The complicated inner electromagnetic environment of smartphones and the diversity in user behavior make it difficult to precisely measure environment magnetic field.The magnetometer measures indoor magnetic field’s value of a position relative to the orientation of the phone. This valueBmeasuredPhone is a triple with each element representing the magnitude of the magnetic field along the three dimensions of a phone’s frame. Moreover, given that the expression of a vector V in frame F is VF, then a magnetometer measurement can be represented as follows [20]:(1)Vadd=Vhard+VsensorOffset,(2)Wmultiply=Wsoft·WnonOrthog·Wgain,(3)Bmeasured=Wmultiply·REarthPhone·Breal+VaddEarthPhone.The smartphone magnetometer is interfered with by additive interference and multiplicative interference when measuring geomagnetic field.Additive interferenceVadd in magnetometer measurement consists of two parts: hard-iron effect and sensor offset, as (1) shows. In addition, hard-iron effect Vhard is the fact that permanently magnetized ferromagnetic components on Printed Circuit Boards (PCBs) add an offset field when the magnetometer is measuring geomagnetic field. Sensor offset VsensorOffset is the zero field offset in magnetometer’s factory calibration.Multiplicative interferenceWmultiply in magnetometer measurement consists of three parts: soft-iron effect, magnetometer nonorthogonality, and unequal gains, as (2) reveals. First, soft-iron effect is the fact that outer fields, for example, geomagnetic and speaker field, onto unmagnetized ferromagnetic components on the PCB, induce interfering magnetic field when the magnetometer is measuring geomagnetic field. Second, magnetometer nonorthogonality is the lack of perfect orthogonality between sensor axes and sensor relative to the phone’s coordinate system. Finally, unequal gains are the different gains in magnetometer in all three axes.Equation (3) demonstrates the overall process of smartphone magnetometer measuring geomagnetic field. Firstly, the real geomagnetic field is BrealEarth, which is expressed in north, east, down (NED) frame. However, the magnetometer measurement is in phone frame, so the geomagnetic field in phone frame is REarthPhone·BrealEarth, with REarthPhone representing transform matrix from earth frame to phone frame. Moreover, considering all possible phone frames, the universal set of geomagnetic fields in phone frames can be illustrated as the red sphere in Figure 2. Secondly, the magnetometer is interfered with by multiplicative interference, which makes the magnetic field gain different along different axes. As a result, the universal set becomes an ellipsoid. Finally, additive interference makes the universal set ellipsoid leave the original phone frame, as the blue sphere shows. In other words, one magnetometer measurement BmeasuredPhone is one vector from original to a point of the blue ellipsoid.Figure 2
Soft- and hard-iron effect illustration.Equation (3) reveals that magnetometer measurement BmeasuredPhone is heavily interfered with, which cannot be used for localization. However, one practical way is to estimate BrealEarth from BmeasuredPhone. From (3), the estimated BrealEarth can be easily derived: (4)B~real=R~·W~multiply-1PhoneEarthEarth·Bmeasured-V~addPhone.Furthermore, considering thatREarthPhone is a unit frame transform matrix, the magnitude of B~realEarth can be drawn from (4):(5)B~realEarth=W~multiply-1·Bmeasured-V~addPhone.In (5), W~mulitply-1 and V~add are estimated multiplicative and additive interference parameter. Solving W~multiply-1 and V~add is actually to compute the blue ellipsoid center and its ellipsoid parameters in Figure 2. To solve them, one general way for commodity smartphones is to rotate the device in a figure of 8 in a small space. Consequently, the magnetometer collects omnidirectional data. These data are distributed on the blue ellipsoid in Figure 2. Hence, using Cholesky factorization [21], the ellipsoid center and ellipsoid parameter can be derived, that is, V~add and W~multiply-1. As a result, B~realEarth is computed.As (5) shows, the precision of B~realEarth estimation depends on the precision of estimated V~add and W~multiply-1. Although the smartphone always runs background magnetometer calibration, it is a complicated problem. As a result, only coarse calibration parameter can be computed. Hence, the magnetic magnitude varies as the device rotates. Figure 3 clearly demonstrates these properties, where the magnetic signals were collected within a small cube with 15 cm edges: red dash line signal was collected with parallel movement. Blue full-line signal was collected with omnidirectional rotational movement. In the experiment result, parallel signal fluctuation scope was 3.7 μT, while rotational signal fluctuation scope was 13.3 μT. In contrast, the fluctuation scope of a typical road is approximately 30 μT, as Figure 1 depicted, comparable with that of omnidirectional rotation case. Therefore, random omnidirectional device rotation is interfering enough to pollute location feature, as Figure 4 shows: the magnetic signal is collected during walks along a straight corridor with 4 different attitudes and the last one was collected with rotating the device all the way. Obviously, although different attitude magnitude signals have different mean values, their alternating current (AC) component signals are similar. But, for rotation magnitude signals, they had become ambiguous.Figure 3
Parallel versus rotation data collection illustration.Figure 4
Magnetic magnitude in different attitudes.Therefore, the coarse-grained additive and multiplicative parameters in the smartphone can be characterized as measured magnetic magnitude being sensitive to rotation movement. In other words, magnetic magnitude is only available when the device stays at a relatively stable situation.


### 4.2. Magnetometer Measurement

Smartphone magnetometer suffers from random fluctuation signals, including excitation current, feedback circuit and signal conditioning from the sensor inside [22], and currents within coils outside the sensor [23]. Consequently, these signals will make the magnetometer output signal combined with noise.Figure5 reveals histogram statistical result of the noisy MFM signal collected by a static smartphone. Obviously, the signal obeyed normal distribution, with mean which equaled 54.16 μT and standard deviation of 0.72 μT. So, the indoor magnetic field measure equation (3) should be updated to (6), where Δ is Gaussian noise. Hence,(6)Bmeasured=Wmultiply·REarthPhone·Breal+VaddEarthPhone+Δ.Figure 5
Static magnetic magnitude collection statistics. The phone was put up on a tree in a park, sampling magnetic data for 55 seconds.Therefore, the estimated geomagnetic magnitude is updated to (7), where Δ′ is Gaussian noise. Hence,(7)B~realEarth=W~multiply-1·Bmeasured-V~addPhone+Δ′.In conclusion, this section analyzes interference sources of the magnetometer, including hand movement and senor noise, which are harmful to indoor localization.


## 4.1. Characteristics of Magnetometers on Smartphones

The complicated inner electromagnetic environment of smartphones and the diversity in user behavior make it difficult to precisely measure environment magnetic field.The magnetometer measures indoor magnetic field’s value of a position relative to the orientation of the phone. This valueBmeasuredPhone is a triple with each element representing the magnitude of the magnetic field along the three dimensions of a phone’s frame. Moreover, given that the expression of a vector V in frame F is VF, then a magnetometer measurement can be represented as follows [20]:(1)Vadd=Vhard+VsensorOffset,(2)Wmultiply=Wsoft·WnonOrthog·Wgain,(3)Bmeasured=Wmultiply·REarthPhone·Breal+VaddEarthPhone.The smartphone magnetometer is interfered with by additive interference and multiplicative interference when measuring geomagnetic field.Additive interferenceVadd in magnetometer measurement consists of two parts: hard-iron effect and sensor offset, as (1) shows. In addition, hard-iron effect Vhard is the fact that permanently magnetized ferromagnetic components on Printed Circuit Boards (PCBs) add an offset field when the magnetometer is measuring geomagnetic field. Sensor offset VsensorOffset is the zero field offset in magnetometer’s factory calibration.Multiplicative interferenceWmultiply in magnetometer measurement consists of three parts: soft-iron effect, magnetometer nonorthogonality, and unequal gains, as (2) reveals. First, soft-iron effect is the fact that outer fields, for example, geomagnetic and speaker field, onto unmagnetized ferromagnetic components on the PCB, induce interfering magnetic field when the magnetometer is measuring geomagnetic field. Second, magnetometer nonorthogonality is the lack of perfect orthogonality between sensor axes and sensor relative to the phone’s coordinate system. Finally, unequal gains are the different gains in magnetometer in all three axes.Equation (3) demonstrates the overall process of smartphone magnetometer measuring geomagnetic field. Firstly, the real geomagnetic field is BrealEarth, which is expressed in north, east, down (NED) frame. However, the magnetometer measurement is in phone frame, so the geomagnetic field in phone frame is REarthPhone·BrealEarth, with REarthPhone representing transform matrix from earth frame to phone frame. Moreover, considering all possible phone frames, the universal set of geomagnetic fields in phone frames can be illustrated as the red sphere in Figure 2. Secondly, the magnetometer is interfered with by multiplicative interference, which makes the magnetic field gain different along different axes. As a result, the universal set becomes an ellipsoid. Finally, additive interference makes the universal set ellipsoid leave the original phone frame, as the blue sphere shows. In other words, one magnetometer measurement BmeasuredPhone is one vector from original to a point of the blue ellipsoid.Figure 2
Soft- and hard-iron effect illustration.Equation (3) reveals that magnetometer measurement BmeasuredPhone is heavily interfered with, which cannot be used for localization. However, one practical way is to estimate BrealEarth from BmeasuredPhone. From (3), the estimated BrealEarth can be easily derived: (4)B~real=R~·W~multiply-1PhoneEarthEarth·Bmeasured-V~addPhone.Furthermore, considering thatREarthPhone is a unit frame transform matrix, the magnitude of B~realEarth can be drawn from (4):(5)B~realEarth=W~multiply-1·Bmeasured-V~addPhone.In (5), W~mulitply-1 and V~add are estimated multiplicative and additive interference parameter. Solving W~multiply-1 and V~add is actually to compute the blue ellipsoid center and its ellipsoid parameters in Figure 2. To solve them, one general way for commodity smartphones is to rotate the device in a figure of 8 in a small space. Consequently, the magnetometer collects omnidirectional data. These data are distributed on the blue ellipsoid in Figure 2. Hence, using Cholesky factorization [21], the ellipsoid center and ellipsoid parameter can be derived, that is, V~add and W~multiply-1. As a result, B~realEarth is computed.As (5) shows, the precision of B~realEarth estimation depends on the precision of estimated V~add and W~multiply-1. Although the smartphone always runs background magnetometer calibration, it is a complicated problem. As a result, only coarse calibration parameter can be computed. Hence, the magnetic magnitude varies as the device rotates. Figure 3 clearly demonstrates these properties, where the magnetic signals were collected within a small cube with 15 cm edges: red dash line signal was collected with parallel movement. Blue full-line signal was collected with omnidirectional rotational movement. In the experiment result, parallel signal fluctuation scope was 3.7 μT, while rotational signal fluctuation scope was 13.3 μT. In contrast, the fluctuation scope of a typical road is approximately 30 μT, as Figure 1 depicted, comparable with that of omnidirectional rotation case. Therefore, random omnidirectional device rotation is interfering enough to pollute location feature, as Figure 4 shows: the magnetic signal is collected during walks along a straight corridor with 4 different attitudes and the last one was collected with rotating the device all the way. Obviously, although different attitude magnitude signals have different mean values, their alternating current (AC) component signals are similar. But, for rotation magnitude signals, they had become ambiguous.Figure 3
Parallel versus rotation data collection illustration.Figure 4
Magnetic magnitude in different attitudes.Therefore, the coarse-grained additive and multiplicative parameters in the smartphone can be characterized as measured magnetic magnitude being sensitive to rotation movement. In other words, magnetic magnitude is only available when the device stays at a relatively stable situation.


## 4.2. Magnetometer Measurement

Smartphone magnetometer suffers from random fluctuation signals, including excitation current, feedback circuit and signal conditioning from the sensor inside [22], and currents within coils outside the sensor [23]. Consequently, these signals will make the magnetometer output signal combined with noise.Figure5 reveals histogram statistical result of the noisy MFM signal collected by a static smartphone. Obviously, the signal obeyed normal distribution, with mean which equaled 54.16 μT and standard deviation of 0.72 μT. So, the indoor magnetic field measure equation (3) should be updated to (6), where Δ is Gaussian noise. Hence,(6)Bmeasured=Wmultiply·REarthPhone·Breal+VaddEarthPhone+Δ.Figure 5
Static magnetic magnitude collection statistics. The phone was put up on a tree in a park, sampling magnetic data for 55 seconds.Therefore, the estimated geomagnetic magnitude is updated to (7), where Δ′ is Gaussian noise. Hence,(7)B~realEarth=W~multiply-1·Bmeasured-V~addPhone+Δ′.In conclusion, this section analyzes interference sources of the magnetometer, including hand movement and senor noise, which are harmful to indoor localization.


## 5. Indoor Magnetic Fingerprint Extraction

This section presents several indoor MFM fingerprint extraction methods. In order to compare these methods, firstly, a fingerprint distinguishability evaluation model is presented. Secondly, a series of evaluations were conducted to find a high discernible extracted fingerprint.


### 5.1. Fingerprint Segment Distinguishability Evaluation Method

Indoor magnetic field is a location-related magnetic field induced by geomagnetic field that is steadily distorted by steel reinforced concrete building structures. Hence, it can be utilized as indoor location feature, that is, location fingerprint. A location fingerprint is a static map between location space and feature space whereby one can determine a location from observed features. In other words, an eligible fingerprint has two features: time stability and spatial distinguishability. The time stability of indoor MFM mainly depends on the stabilization of geomagnetic field and building structures discussed in the last section. As to the spatial distinguishability, experts have provided some insights into it [17, 18]; however, as far as we know, there is no study on quantifying distinguishability. In this section, the paper first introduces the feature of MFM distinguishability and then its calculation method.Indoor magnetic field based positioning generally has two phases: model training phase and fingerprint localization phase. In the model training phase, trainers collect spatial fingerprint signal, then mark them with location information, and finally generate the localization model. In the fingerprint localization phase, users collect real-time fingerprint signal and then estimate users’ locations by comparing the real-time fingerprint signals and the localization model. For example, given a localization model (represented asf2 in Figure 6), suppose a user has collected a target segment (represented as f1 in Figure 6). To localize the user is to find the most possible position of the target segment in the localization model. This process is usually implemented by comparing the similarity between the target segment and all candidate segments in the model with a sliding window technique. However, false positions (P1 and P2) sometimes are more similar than the true position P0 due to the interferences analyzed in the last section. This paper defines the ability of a target fingerprint segment to be distinguished from the localization model as fingerprint segment distinguishability.Figure 6
Fingerprints similarity with compare length 2 m (a) and compare length 6 m (b). The dash curve off1 is real-time fingerprint, and that of f2 is magnetic localization model. The bold blue curves are fingerprint segments to be compared. The bold red curves are relative similar segments in the localization model.Fingerprint segment distinguishability is proportional to segment length while it is inversely proportional to model fingerprint length. Figure6 clearly demonstrates these relations: (a) shows that, in the first 20 meters of the model fingerprint, there are only two candidate segments, but the number rises to 3 when model fingerprint extends to 55 meters. However, when target segment length increases to 4 meters, candidate segments number drops from 3 to 1.The signal similarity between a target segment and a candidate segment can be measured with mean Euclidean distance between them. Moreover, the similarities between the target segment and all possible candidate segments in model fingerprint can be calculated through a sliding window. For instance, the similarities between the target segment and possible candidate segments in Figure6 can be illustrated as Figure 7, in which the red stars are the ground truth location of target segment. In (a), the three highest peaks represent the three most similar candidate segment locations in fingerprint 2, and the same goes for (b).Figure 7
Fingerprint distinguishability with compare length 2 m (a) and compare length 6 m (b).
(a) (b)In order to measure the distinguishability of MFM fingerprint segment against a model fingerprint, the segment distinguishability needs to be quantified. Although error distance is one common way to measure the performance of the localization algorithm, it is infeasible to assume that error distance represents distinguishability, because of MFM’s low discernibility. Therefore, the paper proposes a distinguishability measurement method (DAME) based on the number of similar segments and the signal similarity of the Euclidean distance of AC signal component, which is summarized in Algorithm1.Algorithm 1:DAME.
(1) Initialization (2) Given two MFM fingerprints A and B (3) Resample fingerprints with same space density (4) Set AC target segment Stpt in A beginning with pt (5) Set confusion point no Nconfusion=0 (6) Distinguishability Compute (7) for each point pi in B do (8)   Select AC candidate segment Scpi beginning with pi (9)   dcpitpt=meanScpi-StptEuclidean (10)dcpitptinverse=1/dcpitpt (11)end for (12) Find all peaks indinverseset with min peak distance dmp (13) Set thrash distancedthrash=dcpttpt (14)for each peak dcpitptinverse  do (15)ifdcpitptinverse≥dthrash  then (16)Nconfusion = Nconfusion+1 (17)end if (18)end for (19)D=1/NconfusionSegment distinguishability increases as target fingerprint compare length extends. Distinguishability range lies in (0,1]. When target segment distinguishability equals 1, it will represent the notion that, with the corresponding compare length, the segment can be localized within the given fingerprint. Figure 8 reveals this relation of the fingerprints in Figure 6: when target segment length increases by 2.6 m, the segment distinguishability rises to the maximum, and hence its location can be confirmed. Consequently, in order to locate a fingerprint segment from the given localization model, the compare length for this segment should be greater than the value whose distinguishability first equals 1.Figure 8
Fingerprint distinguishability and error distance under different compare lengths.


### 5.2. Location-Related Fingerprint Extraction

Indoor magnetic field signal is location-related; however, it is difficult to precisely collect this signal by the magnetometer of the smartphone, because of coarse-grained calibration parameter and sensor electronic noise, as discussed in Section4. Consequently, these interferences decrease magnetic magnitude distinguishability, causing localization accuracy to decay.In order to improve localization performance, it is important to filter the signals collected by the magnetometer and extract location-related only fingerprints from these signals. There are three main affecting factors in MFM collection: temporal influence and device attitude, body tremble, and sensor electronic noise. For temporal influence, users will inevitably approach ferromagnetic materials, including iron chairs and cars, with their smartphones in daily life. These materials will change the interior magnetic environment inside the devices. Although the calibration routine of the smartphone will automatically calibrate this change, this process is coarse-grained, which will cause calibrated signal shift up or down. This shift will remain stable until another calibration happens, as shown in Figure1. The device attitude has similar effects with temporal influence, as shown in Figure 4. Therefore, it is necessary to remove the direct current (DC) component of the magnetic signal. However, the left AC component will still be interfered with by hand tremble and sensor electronic noise.The body tremble factor is the slight random quiver when a user carrying a device moves around. Affected by coarse-grained hard/soft-iron effect, this tremble will add distorted magnetometer output. Finally, the sensor electronic noise factor is an additive noise to magnetometer output. Because these factors have little relation with locations, it is supposed that the removal of these signals components improves localization performance.Several fingerprint extraction methods are studied to reject location-unrelated signal components: wavelet transform, Savitzky–Golay filter, moving average filter, wavelet denoising, and Butterworth filter. The wavelet transform method computes a series of wavelets on different scales with the given wavelet [24]. The wavelet transform of the signal in Figure 1 is represented as Figure 9. In other words, this method transforms time domain signal into frequency domain signal, and it is expected that this transform might reject location-unrelated signal components. In this transformation, different wavelet factor needs different spatial delay; therefore, 1 meter is chosen as max. tolerance delay, as the blue line shows. Consequently, the fingerprint is shown in Figure 10, and the vertical heads and tails are transition areas that should be discarded.Figure 9
MFM wavelet transform.Figure 10
Haar wavelet transform fingerprint. The vertical heads and tails are caused by Haar wavelet.The Savitzky–Golay filter method fits successive subsets of adjacent data points with a low-degree polynomial by the method of linear least squares, which is also known as convolution [25]. This method is supposed to increase the signal-to-noise ratio without greatly distorting the signal. Consequently, the resulting fingerprint is shown in Figure 11.Figure 11
Savitzky–Golay filter fingerprint.The moving average filter method smooths data using a moving average filter, that is, denoising MFM signal by averaging adjacent measurements, with the sacrifice of some adjacent discernibility. The resulting fingerprint is revealed as Figure12.Figure 12
Moving average filter fingerprint.The wavelet denoising method performs denoising using given wavelets [26]. Typically, there are three steps in the procedure: original signal decomposition to get detail coefficients, detail coefficients modification based on threshold, and signal reconstruction based on modified detail coefficients. The consequent fingerprint is shown in Figure 13.Figure 13
Wavelet denoising fingerprint.The Butterworth filter is a maximally flat magnitude filter that is designed to have as flat a frequency response as possible in the pass band [27]. Considering the indoor MFM mainly distorted by building structures which are much larger than user movement, low pass filter (LPF) is suitable for fingerprint extracting. The magnitude response of the LPF used in the system is depicted in Figure 14, with a pass band from 0 to 0.9 Hz. The resulting fingerprint is shown in Figure 15.Figure 14
Magnitude response.Figure 15
Butterworth filter fingerprint.In order to compare the distinguishability of different fingerprint extraction methods, the experiment gathered statistics of mean DAME distinguishability of each method under different compare lengths, as shown in Figure16. Clearly, as far as the experiments reveal, except for wavelet transform method, other fingerprint extraction methods improved fingerprint distinguishability compared to that of original fingerprint, especially when the compare lengths of fingerprint segments are short. This improvement owes to the denoising of the original signal. In addition, Butterworth filter fingerprint has the highest distinguishability among all these extracted fingerprints, since it rejects noise based on the signal’s frequency rather than simple average adjacent measurements.Figure 16
Mean fingerprint distinguishability under different compare lengths. Two thousand random segments calculate the result for each kind of fingerprint.In conclusion, this section proposes a fingerprint distinguishability measurement method, DAME; furthermore, with this method, Butterworth LPF is found to be a high discernible fingerprint extraction method for indoor magnetic field among the studies.


## 5.1. Fingerprint Segment Distinguishability Evaluation Method

Indoor magnetic field is a location-related magnetic field induced by geomagnetic field that is steadily distorted by steel reinforced concrete building structures. Hence, it can be utilized as indoor location feature, that is, location fingerprint. A location fingerprint is a static map between location space and feature space whereby one can determine a location from observed features. In other words, an eligible fingerprint has two features: time stability and spatial distinguishability. The time stability of indoor MFM mainly depends on the stabilization of geomagnetic field and building structures discussed in the last section. As to the spatial distinguishability, experts have provided some insights into it [17, 18]; however, as far as we know, there is no study on quantifying distinguishability. In this section, the paper first introduces the feature of MFM distinguishability and then its calculation method.Indoor magnetic field based positioning generally has two phases: model training phase and fingerprint localization phase. In the model training phase, trainers collect spatial fingerprint signal, then mark them with location information, and finally generate the localization model. In the fingerprint localization phase, users collect real-time fingerprint signal and then estimate users’ locations by comparing the real-time fingerprint signals and the localization model. For example, given a localization model (represented asf2 in Figure 6), suppose a user has collected a target segment (represented as f1 in Figure 6). To localize the user is to find the most possible position of the target segment in the localization model. This process is usually implemented by comparing the similarity between the target segment and all candidate segments in the model with a sliding window technique. However, false positions (P1 and P2) sometimes are more similar than the true position P0 due to the interferences analyzed in the last section. This paper defines the ability of a target fingerprint segment to be distinguished from the localization model as fingerprint segment distinguishability.Figure 6
Fingerprints similarity with compare length 2 m (a) and compare length 6 m (b). The dash curve off1 is real-time fingerprint, and that of f2 is magnetic localization model. The bold blue curves are fingerprint segments to be compared. The bold red curves are relative similar segments in the localization model.Fingerprint segment distinguishability is proportional to segment length while it is inversely proportional to model fingerprint length. Figure6 clearly demonstrates these relations: (a) shows that, in the first 20 meters of the model fingerprint, there are only two candidate segments, but the number rises to 3 when model fingerprint extends to 55 meters. However, when target segment length increases to 4 meters, candidate segments number drops from 3 to 1.The signal similarity between a target segment and a candidate segment can be measured with mean Euclidean distance between them. Moreover, the similarities between the target segment and all possible candidate segments in model fingerprint can be calculated through a sliding window. For instance, the similarities between the target segment and possible candidate segments in Figure6 can be illustrated as Figure 7, in which the red stars are the ground truth location of target segment. In (a), the three highest peaks represent the three most similar candidate segment locations in fingerprint 2, and the same goes for (b).Figure 7
Fingerprint distinguishability with compare length 2 m (a) and compare length 6 m (b).
(a) (b)In order to measure the distinguishability of MFM fingerprint segment against a model fingerprint, the segment distinguishability needs to be quantified. Although error distance is one common way to measure the performance of the localization algorithm, it is infeasible to assume that error distance represents distinguishability, because of MFM’s low discernibility. Therefore, the paper proposes a distinguishability measurement method (DAME) based on the number of similar segments and the signal similarity of the Euclidean distance of AC signal component, which is summarized in Algorithm1.Algorithm 1:DAME.
(1) Initialization (2) Given two MFM fingerprints A and B (3) Resample fingerprints with same space density (4) Set AC target segment Stpt in A beginning with pt (5) Set confusion point no Nconfusion=0 (6) Distinguishability Compute (7) for each point pi in B do (8)   Select AC candidate segment Scpi beginning with pi (9)   dcpitpt=meanScpi-StptEuclidean (10)dcpitptinverse=1/dcpitpt (11)end for (12) Find all peaks indinverseset with min peak distance dmp (13) Set thrash distancedthrash=dcpttpt (14)for each peak dcpitptinverse  do (15)ifdcpitptinverse≥dthrash  then (16)Nconfusion = Nconfusion+1 (17)end if (18)end for (19)D=1/NconfusionSegment distinguishability increases as target fingerprint compare length extends. Distinguishability range lies in (0,1]. When target segment distinguishability equals 1, it will represent the notion that, with the corresponding compare length, the segment can be localized within the given fingerprint. Figure 8 reveals this relation of the fingerprints in Figure 6: when target segment length increases by 2.6 m, the segment distinguishability rises to the maximum, and hence its location can be confirmed. Consequently, in order to locate a fingerprint segment from the given localization model, the compare length for this segment should be greater than the value whose distinguishability first equals 1.Figure 8
Fingerprint distinguishability and error distance under different compare lengths.


## 5.2. Location-Related Fingerprint Extraction

Indoor magnetic field signal is location-related; however, it is difficult to precisely collect this signal by the magnetometer of the smartphone, because of coarse-grained calibration parameter and sensor electronic noise, as discussed in Section4. Consequently, these interferences decrease magnetic magnitude distinguishability, causing localization accuracy to decay.In order to improve localization performance, it is important to filter the signals collected by the magnetometer and extract location-related only fingerprints from these signals. There are three main affecting factors in MFM collection: temporal influence and device attitude, body tremble, and sensor electronic noise. For temporal influence, users will inevitably approach ferromagnetic materials, including iron chairs and cars, with their smartphones in daily life. These materials will change the interior magnetic environment inside the devices. Although the calibration routine of the smartphone will automatically calibrate this change, this process is coarse-grained, which will cause calibrated signal shift up or down. This shift will remain stable until another calibration happens, as shown in Figure1. The device attitude has similar effects with temporal influence, as shown in Figure 4. Therefore, it is necessary to remove the direct current (DC) component of the magnetic signal. However, the left AC component will still be interfered with by hand tremble and sensor electronic noise.The body tremble factor is the slight random quiver when a user carrying a device moves around. Affected by coarse-grained hard/soft-iron effect, this tremble will add distorted magnetometer output. Finally, the sensor electronic noise factor is an additive noise to magnetometer output. Because these factors have little relation with locations, it is supposed that the removal of these signals components improves localization performance.Several fingerprint extraction methods are studied to reject location-unrelated signal components: wavelet transform, Savitzky–Golay filter, moving average filter, wavelet denoising, and Butterworth filter. The wavelet transform method computes a series of wavelets on different scales with the given wavelet [24]. The wavelet transform of the signal in Figure 1 is represented as Figure 9. In other words, this method transforms time domain signal into frequency domain signal, and it is expected that this transform might reject location-unrelated signal components. In this transformation, different wavelet factor needs different spatial delay; therefore, 1 meter is chosen as max. tolerance delay, as the blue line shows. Consequently, the fingerprint is shown in Figure 10, and the vertical heads and tails are transition areas that should be discarded.Figure 9
MFM wavelet transform.Figure 10
Haar wavelet transform fingerprint. The vertical heads and tails are caused by Haar wavelet.The Savitzky–Golay filter method fits successive subsets of adjacent data points with a low-degree polynomial by the method of linear least squares, which is also known as convolution [25]. This method is supposed to increase the signal-to-noise ratio without greatly distorting the signal. Consequently, the resulting fingerprint is shown in Figure 11.Figure 11
Savitzky–Golay filter fingerprint.The moving average filter method smooths data using a moving average filter, that is, denoising MFM signal by averaging adjacent measurements, with the sacrifice of some adjacent discernibility. The resulting fingerprint is revealed as Figure12.Figure 12
Moving average filter fingerprint.The wavelet denoising method performs denoising using given wavelets [26]. Typically, there are three steps in the procedure: original signal decomposition to get detail coefficients, detail coefficients modification based on threshold, and signal reconstruction based on modified detail coefficients. The consequent fingerprint is shown in Figure 13.Figure 13
Wavelet denoising fingerprint.The Butterworth filter is a maximally flat magnitude filter that is designed to have as flat a frequency response as possible in the pass band [27]. Considering the indoor MFM mainly distorted by building structures which are much larger than user movement, low pass filter (LPF) is suitable for fingerprint extracting. The magnitude response of the LPF used in the system is depicted in Figure 14, with a pass band from 0 to 0.9 Hz. The resulting fingerprint is shown in Figure 15.Figure 14
Magnitude response.Figure 15
Butterworth filter fingerprint.In order to compare the distinguishability of different fingerprint extraction methods, the experiment gathered statistics of mean DAME distinguishability of each method under different compare lengths, as shown in Figure16. Clearly, as far as the experiments reveal, except for wavelet transform method, other fingerprint extraction methods improved fingerprint distinguishability compared to that of original fingerprint, especially when the compare lengths of fingerprint segments are short. This improvement owes to the denoising of the original signal. In addition, Butterworth filter fingerprint has the highest distinguishability among all these extracted fingerprints, since it rejects noise based on the signal’s frequency rather than simple average adjacent measurements.Figure 16
Mean fingerprint distinguishability under different compare lengths. Two thousand random segments calculate the result for each kind of fingerprint.In conclusion, this section proposes a fingerprint distinguishability measurement method, DAME; furthermore, with this method, Butterworth LPF is found to be a high discernible fingerprint extraction method for indoor magnetic field among the studies.


## 6. Experiments

This section first presents the experiment results of soft/hard-iron calibration on different smartphones. Then, the paper compares and evaluates the fingerprint extraction methods of indoor MFM from various aspects.


### 6.1. Implementation

#### 6.1.1. Devices

The devices used in our experiments were three commercially available smartphones: HTC One X, Samsung S4, and Huawei Mate7, with their main CPU and sensor parameters specified in Table1. The algorithm was implemented in Matlab 2016a, running on a PC with Intel i5 dual core CPU, 16 G RAM, and Win10 64-bit OS.Table 1
Experiment smartphones.
Manufacturer HTC Samsung Huawei Phone series One X S4 Mate7 CPU 1.5 G, 4 cores 1.6 G, 4 cores 1.8 G, 4 cores RAM 1 GB 2 GB 3 GB Sensor vendor Panasonic Asahi Kasei Asahi Kasei Resolution 0.16667μT 0.06μT 0.0625μT Max. range 300μT 2000μT 2000μT Max. freq. 100 Hz 100 Hz 100 Hz Real max. freq. 50 Hz 95 Hz 103 Hz


#### 6.1.2. Testing Area

These experiments were conducted in a large building, with a testing area of about 1500 m2. This is a typical office environment.


#### 6.1.3. Fingerprint Collection

The road used in our experiment was about 50 meters long. Testers were required to walk at a natural pace along the road, with the phone held in their hand.


### 6.2. Interference Sources of Indoor Magnetic Field

This part evaluates magnetometer interference sources from two respects: magnetometer calibration error of hard/soft iron and magnetometer electronic noise.


#### 6.2.1. Ubiquitous Hard/Soft-Iron Calibration Error on Smartphones

Testers selected a small free space (0.001 m3 approximately) inside the lab. Then, for the three test devices, testers successively picked up one of them conducting two movements for one minute: first, testers randomly parallel-moved the phone inside the small space keeping its attitude static. Then, testers randomly rotated the phone with omnidirectional movement. The space was so small that the magnetic field inside this space can be seen as a constant field. Consequently, the first parallel movement was a little affected by hard/soft-iron effect; in contrast, the second rotation movement collected MFM from multiple directions of the smartphone, which exhibited the anisotropy of the magnetometer, as Figure 17 reveals.Figure 17
MFM statistics of different devices in the same place. Mean statistics (a), standard deviation statistics (b).
(a) (b)


#### 6.2.2. Relatively Stable Hard/Soft-Iron Calibration Offset on the Same Smartphone

Testers randomly selected three small spaces (0.001 m3 approximately for each) inside the lab. Then, testers conducted two movements as the last experiment did in each space with one device. Clearly, the magnetic fields of the three spaces were different. Figure 18 shows that despite the fact that collecting spaces were different, causing different magnitude mean value, the standard deviation differences between parallel movement and rotation movement are similar, which suggests relative stabilization of hard/soft-iron calibration for the same device.Figure 18
MFM statistics of different places by the same smartphone. Mean statistics (a), standard deviation statistics (b).
(a) (b)


#### 6.2.3. Pervasive Magnetometer Noise on Smartphones

In order to measure magnetometer noise of different smartphones, testers successively put the three smartphones in the same place and then collected MFM for one minute. As Figure19 reveals, all the three clusters of sample data fit normal distribution, which suggests a common Gaussian electronic noise. Furthermore, both the mean and the standard deviation of MFM of the three smartphones are different: firstly, the different means suggests different hard/soft-iron calibration error of different smartphones, while the different standard deviations reveal pervasive but different sensor noise level.Figure 19
Static magnetometer measurement statistics of different smartphones in the same place.


#### 6.2.4. Relatively Stable Magnetometer Noise on the Same Smartphone

In order to examine magnetometer noise level of the same smartphone in different places, testers randomly selected three places in the lab and then put the phone in each place and kept the smartphone static sampling for one minute. As Figure20 reveals, the three distributions have different mean magnitude, but their standard deviations were similar, which suggests relatively stable sensor noise on the same device.Figure 20
Static magnetometer measurement distribution of different places by the same smartphone.In conclusion, as far as the experiment is concerned, the soft/hard calibration offsets and magnetometer noise levels on different smartphones are different; however, these offsets and noise levels are relatively stable on the same device. These two factors are the main sources of magnetometer interferences.


### 6.3. Fingerprint Extraction Evaluation

In this part, testers first examine the distinguishability of MFM fingerprint extracted by different methods. Then, they evaluate the optimum fingerprint by confusion matrix.To evaluate the distinguishability, testers calculate mean DAME distinguishability with different extraction methods between the two fingerprints shown in Figure1. Moreover, distinguishability is affected by fingerprint compare length, so testers need to evaluate distinguishability under different compare lengths. Hence, the mean DAME distinguishability sequence calculation for each extracted fingerprint contains the following steps.Step 1.
Assign a compare lengthlcompare and fingerprint extraction method mextraction.Step 2.
Withmextraction, extract two fingerprints f1extracted and f2extracted from the two original fingerprints in Figure 1.Step 3.
Randomly select a fingerprint segments1 with compare length lcompare from fingerprint f1extracted.Step 4.
Calculate the DAME distinguishability of this fingerprint segments1 against fingerprint f2extracted.Step 5.
Repeat Steps2–4 one hundred times to get 100 DAME distinguishability values and then calculate the mean DAME distinguishability.Step 6.
Assign a new compare length and repeat Steps1–5 to get a DAME distinguishability sequence with different compare length.For each experiment, the two original fingerprints were the reference group. Furthermore, to make the experiments precise, the fingerprint segments selected in Step3 for different fingerprint extraction methods are the same.


#### 6.3.1. Wavelet Fingerprints Extracted by Different Analyzing Wavelets

Testers used different analyzing wavelets in fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. The statistic result is shown in Figure21: morl wavelet performs the best, Haar wavelet has a little improvement, and the other 3 wavelets are even worse than the original fingerprint. This result shows that the performance of wavelet fingerprint extraction depends on wavelet selection.Figure 21
Wavelet fingerprint extraction by different analyzing wavelets.


#### 6.3.2. Savitzky–Golay Fingerprints Extracted by Different Polynomial Orders

Testers changed the polynomial order in Savitzky–Golay filter fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. Figure22 reveals that low order filters have higher distinguishability.Figure 22
Savitzky–Golay fingerprint extraction by different polynomial orders.


#### 6.3.3. Average Moving Fingerprints Extracted by Different Average Lengths

Testers changed the smooth length in average moving fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. Figure23 reveals that moving average filter only improves distinguishability when compare lengths are short.Figure 23
Average moving fingerprint extraction by different average lengths.


#### 6.3.4. Wavelet Denoising Fingerprints Extracted by Different Analyzing Wavelets

Testers used different analyzing wavelets in fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. The statistic result is shown in Figure24: all analyzing wavelets have the ability to improve fingerprint distinguishability, especially rbio2.2.Figure 24
Wavelet denoising fingerprint extraction by different analyzing wavelets.


#### 6.3.5. Butterworth LPF Fingerprints Extracted by Different Low Pass Frequencies

In this experiment, testers changed the low pass frequency in fingerprint extraction to get different fingerprints and then computed their mean DAME distinguishability sequence. The statistic result is shown in Figure25: low frequencies, for instance, 0.5 Hz and 1.0 Hz, improve distinguishability than higher frequencies.Figure 25
Butterworth LPF fingerprint extraction by different low pass bands.


#### 6.3.6. Diversity Fingerprint Extraction

In this experiment, testers selected all the most discernible fingerprints in each previous experiment and compared their distinguishability together. As Figure26 shows, when compare length is less than 7 meters, Butterworth filter has overall the best distinguishability; however, when compare length is greater than 7 meters, there is no big difference between different fingerprint extraction methods.Figure 26
Diversity fingerprints comparison.


#### 6.3.7. Confusion Matrix of Butterworth LPF Fingerprint

In order to intuitively illustrate the improvements between original fingerprints and Butterworth LPF extracted fingerprints, testers leveraged confusion matrix. Each element of the matrix is the similarity between two locations of two fingerprints. The similarity is the mean Euclidean distance of the two fingerprint segments started from these locations. The segments are 5 m long. Testers calculated confusion matrices for the original signal pairs, the Butterworth fingerprint pairs, and the subtracted fingerprint pairs. The relations of the three fingerprint pairs are as follows:(8)f1subtracted=f1original-f1Butterworth,f2subtracted=f2original-f2Butterworth.The three confusion matrices are shown in Figures27, 28, and 29. Clearly, as Figure 27 shows, although the segments of the same location IDs are similar to each other (the highlight main diagonal), there are many confusing points in wrong locations (highlight points outside the main diagonal). Figure 28 reveals that the similarity between the segments of the same locations improved, while similarities between segments of different locations were decreased. In Figure 29, testers can see that there is no highlight main diagonal. This means that one segment in subtracted fingerprint 1 is similar to all segments in subtracted fingerprint 2. In other words, the subtracted fingerprints have no location information.Figure 27
Confusion matrix of original MFM signal.Figure 28
Confusion matrix of Butterworth fingerprint.Figure 29
Confusion matrix of subtracted signal.If testers use most similar points as localization result, then the third quartile of the localization errors for the original fingerprint is 0.78 m and for Butterworth fingerprint is 0.47 m, 40% improved.Therefore, this experiment revealed that Butterworth fingerprint improved fingerprint distinguishability, and the subtracted signal is harmful for localization.


## 6.1. Implementation

### 6.1.1. Devices

The devices used in our experiments were three commercially available smartphones: HTC One X, Samsung S4, and Huawei Mate7, with their main CPU and sensor parameters specified in Table1. The algorithm was implemented in Matlab 2016a, running on a PC with Intel i5 dual core CPU, 16 G RAM, and Win10 64-bit OS.Table 1
Experiment smartphones.
Manufacturer HTC Samsung Huawei Phone series One X S4 Mate7 CPU 1.5 G, 4 cores 1.6 G, 4 cores 1.8 G, 4 cores RAM 1 GB 2 GB 3 GB Sensor vendor Panasonic Asahi Kasei Asahi Kasei Resolution 0.16667μT 0.06μT 0.0625μT Max. range 300μT 2000μT 2000μT Max. freq. 100 Hz 100 Hz 100 Hz Real max. freq. 50 Hz 95 Hz 103 Hz


### 6.1.2. Testing Area

These experiments were conducted in a large building, with a testing area of about 1500 m2. This is a typical office environment.


### 6.1.3. Fingerprint Collection

The road used in our experiment was about 50 meters long. Testers were required to walk at a natural pace along the road, with the phone held in their hand.


## 6.1.1. Devices

The devices used in our experiments were three commercially available smartphones: HTC One X, Samsung S4, and Huawei Mate7, with their main CPU and sensor parameters specified in Table1. The algorithm was implemented in Matlab 2016a, running on a PC with Intel i5 dual core CPU, 16 G RAM, and Win10 64-bit OS.Table 1
Experiment smartphones.
Manufacturer HTC Samsung Huawei Phone series One X S4 Mate7 CPU 1.5 G, 4 cores 1.6 G, 4 cores 1.8 G, 4 cores RAM 1 GB 2 GB 3 GB Sensor vendor Panasonic Asahi Kasei Asahi Kasei Resolution 0.16667μT 0.06μT 0.0625μT Max. range 300μT 2000μT 2000μT Max. freq. 100 Hz 100 Hz 100 Hz Real max. freq. 50 Hz 95 Hz 103 Hz


## 6.1.2. Testing Area

These experiments were conducted in a large building, with a testing area of about 1500 m2. This is a typical office environment.


## 6.1.3. Fingerprint Collection

The road used in our experiment was about 50 meters long. Testers were required to walk at a natural pace along the road, with the phone held in their hand.


## 6.2. Interference Sources of Indoor Magnetic Field

This part evaluates magnetometer interference sources from two respects: magnetometer calibration error of hard/soft iron and magnetometer electronic noise.


### 6.2.1. Ubiquitous Hard/Soft-Iron Calibration Error on Smartphones

Testers selected a small free space (0.001 m3 approximately) inside the lab. Then, for the three test devices, testers successively picked up one of them conducting two movements for one minute: first, testers randomly parallel-moved the phone inside the small space keeping its attitude static. Then, testers randomly rotated the phone with omnidirectional movement. The space was so small that the magnetic field inside this space can be seen as a constant field. Consequently, the first parallel movement was a little affected by hard/soft-iron effect; in contrast, the second rotation movement collected MFM from multiple directions of the smartphone, which exhibited the anisotropy of the magnetometer, as Figure 17 reveals.Figure 17
MFM statistics of different devices in the same place. Mean statistics (a), standard deviation statistics (b).
(a) (b)


### 6.2.2. Relatively Stable Hard/Soft-Iron Calibration Offset on the Same Smartphone

Testers randomly selected three small spaces (0.001 m3 approximately for each) inside the lab. Then, testers conducted two movements as the last experiment did in each space with one device. Clearly, the magnetic fields of the three spaces were different. Figure 18 shows that despite the fact that collecting spaces were different, causing different magnitude mean value, the standard deviation differences between parallel movement and rotation movement are similar, which suggests relative stabilization of hard/soft-iron calibration for the same device.Figure 18
MFM statistics of different places by the same smartphone. Mean statistics (a), standard deviation statistics (b).
(a) (b)


### 6.2.3. Pervasive Magnetometer Noise on Smartphones

In order to measure magnetometer noise of different smartphones, testers successively put the three smartphones in the same place and then collected MFM for one minute. As Figure19 reveals, all the three clusters of sample data fit normal distribution, which suggests a common Gaussian electronic noise. Furthermore, both the mean and the standard deviation of MFM of the three smartphones are different: firstly, the different means suggests different hard/soft-iron calibration error of different smartphones, while the different standard deviations reveal pervasive but different sensor noise level.Figure 19
Static magnetometer measurement statistics of different smartphones in the same place.


### 6.2.4. Relatively Stable Magnetometer Noise on the Same Smartphone

In order to examine magnetometer noise level of the same smartphone in different places, testers randomly selected three places in the lab and then put the phone in each place and kept the smartphone static sampling for one minute. As Figure20 reveals, the three distributions have different mean magnitude, but their standard deviations were similar, which suggests relatively stable sensor noise on the same device.Figure 20
Static magnetometer measurement distribution of different places by the same smartphone.In conclusion, as far as the experiment is concerned, the soft/hard calibration offsets and magnetometer noise levels on different smartphones are different; however, these offsets and noise levels are relatively stable on the same device. These two factors are the main sources of magnetometer interferences.


## 6.2.1. Ubiquitous Hard/Soft-Iron Calibration Error on Smartphones

Testers selected a small free space (0.001 m3 approximately) inside the lab. Then, for the three test devices, testers successively picked up one of them conducting two movements for one minute: first, testers randomly parallel-moved the phone inside the small space keeping its attitude static. Then, testers randomly rotated the phone with omnidirectional movement. The space was so small that the magnetic field inside this space can be seen as a constant field. Consequently, the first parallel movement was a little affected by hard/soft-iron effect; in contrast, the second rotation movement collected MFM from multiple directions of the smartphone, which exhibited the anisotropy of the magnetometer, as Figure 17 reveals.Figure 17
MFM statistics of different devices in the same place. Mean statistics (a), standard deviation statistics (b).
(a) (b)


## 6.2.2. Relatively Stable Hard/Soft-Iron Calibration Offset on the Same Smartphone

Testers randomly selected three small spaces (0.001 m3 approximately for each) inside the lab. Then, testers conducted two movements as the last experiment did in each space with one device. Clearly, the magnetic fields of the three spaces were different. Figure 18 shows that despite the fact that collecting spaces were different, causing different magnitude mean value, the standard deviation differences between parallel movement and rotation movement are similar, which suggests relative stabilization of hard/soft-iron calibration for the same device.Figure 18
MFM statistics of different places by the same smartphone. Mean statistics (a), standard deviation statistics (b).
(a) (b)


## 6.2.3. Pervasive Magnetometer Noise on Smartphones

In order to measure magnetometer noise of different smartphones, testers successively put the three smartphones in the same place and then collected MFM for one minute. As Figure19 reveals, all the three clusters of sample data fit normal distribution, which suggests a common Gaussian electronic noise. Furthermore, both the mean and the standard deviation of MFM of the three smartphones are different: firstly, the different means suggests different hard/soft-iron calibration error of different smartphones, while the different standard deviations reveal pervasive but different sensor noise level.Figure 19
Static magnetometer measurement statistics of different smartphones in the same place.


## 6.2.4. Relatively Stable Magnetometer Noise on the Same Smartphone

In order to examine magnetometer noise level of the same smartphone in different places, testers randomly selected three places in the lab and then put the phone in each place and kept the smartphone static sampling for one minute. As Figure20 reveals, the three distributions have different mean magnitude, but their standard deviations were similar, which suggests relatively stable sensor noise on the same device.Figure 20
Static magnetometer measurement distribution of different places by the same smartphone.In conclusion, as far as the experiment is concerned, the soft/hard calibration offsets and magnetometer noise levels on different smartphones are different; however, these offsets and noise levels are relatively stable on the same device. These two factors are the main sources of magnetometer interferences.


## 6.3. Fingerprint Extraction Evaluation

In this part, testers first examine the distinguishability of MFM fingerprint extracted by different methods. Then, they evaluate the optimum fingerprint by confusion matrix.To evaluate the distinguishability, testers calculate mean DAME distinguishability with different extraction methods between the two fingerprints shown in Figure1. Moreover, distinguishability is affected by fingerprint compare length, so testers need to evaluate distinguishability under different compare lengths. Hence, the mean DAME distinguishability sequence calculation for each extracted fingerprint contains the following steps.Step 1.
Assign a compare lengthlcompare and fingerprint extraction method mextraction.Step 2.
Withmextraction, extract two fingerprints f1extracted and f2extracted from the two original fingerprints in Figure 1.Step 3.
Randomly select a fingerprint segments1 with compare length lcompare from fingerprint f1extracted.Step 4.
Calculate the DAME distinguishability of this fingerprint segments1 against fingerprint f2extracted.Step 5.
Repeat Steps2–4 one hundred times to get 100 DAME distinguishability values and then calculate the mean DAME distinguishability.Step 6.
Assign a new compare length and repeat Steps1–5 to get a DAME distinguishability sequence with different compare length.For each experiment, the two original fingerprints were the reference group. Furthermore, to make the experiments precise, the fingerprint segments selected in Step3 for different fingerprint extraction methods are the same.


### 6.3.1. Wavelet Fingerprints Extracted by Different Analyzing Wavelets

Testers used different analyzing wavelets in fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. The statistic result is shown in Figure21: morl wavelet performs the best, Haar wavelet has a little improvement, and the other 3 wavelets are even worse than the original fingerprint. This result shows that the performance of wavelet fingerprint extraction depends on wavelet selection.Figure 21
Wavelet fingerprint extraction by different analyzing wavelets.


### 6.3.2. Savitzky–Golay Fingerprints Extracted by Different Polynomial Orders

Testers changed the polynomial order in Savitzky–Golay filter fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. Figure22 reveals that low order filters have higher distinguishability.Figure 22
Savitzky–Golay fingerprint extraction by different polynomial orders.


### 6.3.3. Average Moving Fingerprints Extracted by Different Average Lengths

Testers changed the smooth length in average moving fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. Figure23 reveals that moving average filter only improves distinguishability when compare lengths are short.Figure 23
Average moving fingerprint extraction by different average lengths.


### 6.3.4. Wavelet Denoising Fingerprints Extracted by Different Analyzing Wavelets

Testers used different analyzing wavelets in fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. The statistic result is shown in Figure24: all analyzing wavelets have the ability to improve fingerprint distinguishability, especially rbio2.2.Figure 24
Wavelet denoising fingerprint extraction by different analyzing wavelets.


### 6.3.5. Butterworth LPF Fingerprints Extracted by Different Low Pass Frequencies

In this experiment, testers changed the low pass frequency in fingerprint extraction to get different fingerprints and then computed their mean DAME distinguishability sequence. The statistic result is shown in Figure25: low frequencies, for instance, 0.5 Hz and 1.0 Hz, improve distinguishability than higher frequencies.Figure 25
Butterworth LPF fingerprint extraction by different low pass bands.


### 6.3.6. Diversity Fingerprint Extraction

In this experiment, testers selected all the most discernible fingerprints in each previous experiment and compared their distinguishability together. As Figure26 shows, when compare length is less than 7 meters, Butterworth filter has overall the best distinguishability; however, when compare length is greater than 7 meters, there is no big difference between different fingerprint extraction methods.Figure 26
Diversity fingerprints comparison.


### 6.3.7. Confusion Matrix of Butterworth LPF Fingerprint

In order to intuitively illustrate the improvements between original fingerprints and Butterworth LPF extracted fingerprints, testers leveraged confusion matrix. Each element of the matrix is the similarity between two locations of two fingerprints. The similarity is the mean Euclidean distance of the two fingerprint segments started from these locations. The segments are 5 m long. Testers calculated confusion matrices for the original signal pairs, the Butterworth fingerprint pairs, and the subtracted fingerprint pairs. The relations of the three fingerprint pairs are as follows:(8)f1subtracted=f1original-f1Butterworth,f2subtracted=f2original-f2Butterworth.The three confusion matrices are shown in Figures27, 28, and 29. Clearly, as Figure 27 shows, although the segments of the same location IDs are similar to each other (the highlight main diagonal), there are many confusing points in wrong locations (highlight points outside the main diagonal). Figure 28 reveals that the similarity between the segments of the same locations improved, while similarities between segments of different locations were decreased. In Figure 29, testers can see that there is no highlight main diagonal. This means that one segment in subtracted fingerprint 1 is similar to all segments in subtracted fingerprint 2. In other words, the subtracted fingerprints have no location information.Figure 27
Confusion matrix of original MFM signal.Figure 28
Confusion matrix of Butterworth fingerprint.Figure 29
Confusion matrix of subtracted signal.If testers use most similar points as localization result, then the third quartile of the localization errors for the original fingerprint is 0.78 m and for Butterworth fingerprint is 0.47 m, 40% improved.Therefore, this experiment revealed that Butterworth fingerprint improved fingerprint distinguishability, and the subtracted signal is harmful for localization.


## 6.3.1. Wavelet Fingerprints Extracted by Different Analyzing Wavelets

Testers used different analyzing wavelets in fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. The statistic result is shown in Figure21: morl wavelet performs the best, Haar wavelet has a little improvement, and the other 3 wavelets are even worse than the original fingerprint. This result shows that the performance of wavelet fingerprint extraction depends on wavelet selection.Figure 21
Wavelet fingerprint extraction by different analyzing wavelets.


## 6.3.2. Savitzky–Golay Fingerprints Extracted by Different Polynomial Orders

Testers changed the polynomial order in Savitzky–Golay filter fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. Figure22 reveals that low order filters have higher distinguishability.Figure 22
Savitzky–Golay fingerprint extraction by different polynomial orders.


## 6.3.3. Average Moving Fingerprints Extracted by Different Average Lengths

Testers changed the smooth length in average moving fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. Figure23 reveals that moving average filter only improves distinguishability when compare lengths are short.Figure 23
Average moving fingerprint extraction by different average lengths.


## 6.3.4. Wavelet Denoising Fingerprints Extracted by Different Analyzing Wavelets

Testers used different analyzing wavelets in fingerprint extraction to get different fingerprints and computed their mean DAME distinguishability sequence. The statistic result is shown in Figure24: all analyzing wavelets have the ability to improve fingerprint distinguishability, especially rbio2.2.Figure 24
Wavelet denoising fingerprint extraction by different analyzing wavelets.


## 6.3.5. Butterworth LPF Fingerprints Extracted by Different Low Pass Frequencies

In this experiment, testers changed the low pass frequency in fingerprint extraction to get different fingerprints and then computed their mean DAME distinguishability sequence. The statistic result is shown in Figure25: low frequencies, for instance, 0.5 Hz and 1.0 Hz, improve distinguishability than higher frequencies.Figure 25
Butterworth LPF fingerprint extraction by different low pass bands.


## 6.3.6. Diversity Fingerprint Extraction

In this experiment, testers selected all the most discernible fingerprints in each previous experiment and compared their distinguishability together. As Figure26 shows, when compare length is less than 7 meters, Butterworth filter has overall the best distinguishability; however, when compare length is greater than 7 meters, there is no big difference between different fingerprint extraction methods.Figure 26
Diversity fingerprints comparison.


## 6.3.7. Confusion Matrix of Butterworth LPF Fingerprint

In order to intuitively illustrate the improvements between original fingerprints and Butterworth LPF extracted fingerprints, testers leveraged confusion matrix. Each element of the matrix is the similarity between two locations of two fingerprints. The similarity is the mean Euclidean distance of the two fingerprint segments started from these locations. The segments are 5 m long. Testers calculated confusion matrices for the original signal pairs, the Butterworth fingerprint pairs, and the subtracted fingerprint pairs. The relations of the three fingerprint pairs are as follows:(8)f1subtracted=f1original-f1Butterworth,f2subtracted=f2original-f2Butterworth.The three confusion matrices are shown in Figures27, 28, and 29. Clearly, as Figure 27 shows, although the segments of the same location IDs are similar to each other (the highlight main diagonal), there are many confusing points in wrong locations (highlight points outside the main diagonal). Figure 28 reveals that the similarity between the segments of the same locations improved, while similarities between segments of different locations were decreased. In Figure 29, testers can see that there is no highlight main diagonal. This means that one segment in subtracted fingerprint 1 is similar to all segments in subtracted fingerprint 2. In other words, the subtracted fingerprints have no location information.Figure 27
Confusion matrix of original MFM signal.Figure 28
Confusion matrix of Butterworth fingerprint.Figure 29
Confusion matrix of subtracted signal.If testers use most similar points as localization result, then the third quartile of the localization errors for the original fingerprint is 0.78 m and for Butterworth fingerprint is 0.47 m, 40% improved.Therefore, this experiment revealed that Butterworth fingerprint improved fingerprint distinguishability, and the subtracted signal is harmful for localization.


## 7. Conclusions

This paper firstly discusses the main interference sources for the data collection of a smartphone; that is, due to coarse-grained hard/soft-iron calibration, slight hand tremble brings about interference in magnetometer measurement. Sensor electronic noise is another source of magnetometer interference.Then, we present DAME, a distinguishability evaluation model for MFM based fingerprint. With this model, the distinguishability of one fingerprint segment against another fingerprint can be represented. Moreover, given compare length, the distinguishability between two fingerprints can be quantified by mean DAME distinguishability.Finally, utilizing the DAME distinguishability, we compare several extraction methods for MFM based fingerprint. Consequently, we find that Butterworth filter fingerprint is the most discernible one as far as our experiments are concerned.Moreover, the experiments confirm the effectiveness of distinguishability measurement method, DAME, as well as the superiority of Butterworth filter fingerprint.



---

*Source: 1945695-2016-12-13.xml*