# change detection formula most suited to analyse 3 vector changes

The following data is captured from the magnetic sensor of a device. This data has a time factor. The device is at times in motion and other times still

How can one detect (using formula) if there is a significant change in the magnetic field so as to differentiate between the device being in motion and the device being still.

Columns are as follows (x signal, y signal, z signal, timestamp) Note: we may combine x,y,z into one field using a formula sqrt(x^2 + y^2 + z^2)

            -12.718201, -6.2164307, 62.046814   ,  1538194954316
-43.415833, -12.576294, 62.527466   ,  1538195258969
-19.099426, -20.405579, 53.93982    ,  1538195608542
36.384583, -2.8259277, 125.75989    ,  1538196141515
3.7750244, -52.175903, 7.0632935    ,  1538196696008
-57.774353, -0.17547607, -34.48639  ,  1538197016697
-19.52362, -33.039856, -11.776733   ,  1538197575860
-14.483643, 7.3242188, 49.07837 ,  1538197889355
-61.299133, -10.044861, -10.276794  ,  1538198275366
-7.598877, -27.565002, 38.954163    ,  1538198604350
6.6818237, -19.360352, 45.41931 ,  1538198916440
5.3466797, -20.59021, 44.63806  ,  1538199218767
4.4311523, -21.595764, 43.948364    ,  1538199662156
20.075989, -32.650757, 91.15448 ,  1538200082654
14.196777, -17.500305, 56.92444 ,  1538200408499
14.120483, -17.33551, 56.60858  ,  1538200722135
14.961243, -16.825867, 57.299805    ,  1538201524650
14.060974, -17.636108, 55.8136  ,  1538202502702
16.416931, -10.900879, 59.924316    ,  1538203467708
34.70,  1538, -42.219543, -12.271118    ,  1538203770037
26.541138, -33.729553, 42.088318    ,  1538204432606
-2.9037476, -46.420288, 27.973938   ,  1538205300693
28.746033, -42.57965, 12.928772 ,  1538205775288
27.441406, -40.000916, 6.7489624    ,  1538206205786
39.141846, -42.070007, 1.7837524    ,  1538206565996
11.735535, -40.135193, -8.190918    ,  1538207068072
33.441162, -34.03015, 4.109192  ,  1538207429684
30.140686, -35.84442, 4.019165  ,  1538207922966
-4.823303, -46.780396, 26.098633    ,  1538208284175
-8.934021, -47.27478, 23.068237 ,  1538208716472
56.64673, -32.35016, 3.5079956  ,  1538209153066
0.8468628, 21.784973, 56.489563 ,  1538209521175
1.5808105, 22.340393, 56.56433  ,  1538209824603
0.7720947, 22.7005, 55.604553   ,  1538210815860
0.2166748, 24.18518, -59.835815 ,  1538211721937
-0.05340576, 23.62976, -59.925842   ,  1538212665907
-11.079407, 23.675537, 45.49408 ,  1538213486000
-8.4991455, 36.860657, 44.06891 ,  1538213789633
-0.05340576, 22.219849, 56.89392    ,  1538214091858
0.35095215, 22.399902, 55.79834 ,  1538214416776
-14.604187, 33.54492, 45.7489   ,  1538214757598
2.0462036, 21.679688, 57.658386 ,  1538215059916
2.2705078, 22.070312, 56.217957 ,  1538215463919
4.6417236, 23.464966, -55.485535    ,  1538215776043
4.9560547, 23.480225, -55.770874    ,  1538216078469
-6.3095093, 44.000244, 38.36975 ,  1538216396388
10.08606, -19.270325, 65.608215 ,  1538263082893
10.08606, -19.270325, 65.608215 ,  1538263082893
15.606689, -14.515686, 55.18341 ,  1538263760629
2.7053833, -24.6109, 38.14392   ,  1538264179725
2.7053833, -24.6109, 38.14392   ,  1538264179725
3.9367676, -24.624634, 38.7146  ,  1538264484521
3.9367676, -24.624634, 38.7146  ,  1538264484521
4.0115356, -23.980713, 38.684082    ,  1538264830196
4.0115356, -23.980713, 38.684082    ,  1538264830196
3.3660889, -25.645447, 37.709045    ,  1538265135334
3.3660889, -25.645447, 37.709045    ,  1538265135334
3.4866333, -24.549866, 38.77411 ,  1538265439125
3.4866333, -24.549866, 38.77411 ,  1538265439125
3.9520264, -24.760437, 38.323975    ,  1538265738751
3.9520264, -24.760437, 38.323975    ,  1538265738751
3.90625, -24.264526, 38.789368  ,  1538266042583
3.90625, -24.264526, 38.789368  ,  1538266042583
4.0115356, -24.925232, 38.128662    ,  1538266361898
4.0115356, -24.925232, 38.128662    ,  1538266361898
4.0863037, -24.085999, 38.414   ,  1538266666426
4.0863037, -24.085999, 38.414   ,  1538266666426
4.1015625, -23.905945, 38.789368    ,  1538266972752
4.1015625, -23.905945, 38.789368    ,  1538266972752
3.6514282, -24.685669, 38.15918 ,  1538267571704
8.480835, -22.03064, 50.48828   ,  1538267875317
8.570862, -20.87555, 49.96338   ,  1538268178843
8.511353, -21.040344, 50.02289  ,  1538268482369
8.976746, -21.220398, 50.143433 ,  1538268785994
-1.4938354, -19.239807, 49.394226   ,  1538269583765
9.965515, -21.174622, 34.918213 ,  1538270525838
10.626221, -20.994568, 34.214783    ,  1538271159386
11.735535, -20.080566, 35.264587    ,  1538271788831
11.557007, -19.570923, 36.149597    ,  1538272087257
9.516907, -21.76056, 34.709167  ,  1538272403782
9.486389, -20.890808, 35.23407  ,  1538272702208
9.306335, -21.534729, 35.24933  ,  1538273006933
9.231567, -21.76056, 34.843445  ,  1538273314658
8.840942, -21.775818, 35.23407  ,  1538273619714
9.156799, -22.30072, 34.843445  ,  1538273927994
8.992004, -22.239685, 35.534668 ,  1538275489504
8.557129, -22.450256, 34.36432  ,  1538275787028
8.390808, -22.929382, 36.523438 ,  1538276691072
7.6705933, -22.975159, 36.98883 ,  1538277352472
7.7163696, -22.735596, 36.883545    ,  1538278611579
7.852173, -23.57483, 37.31842   ,  1538279282128
2.4368286, 21.31958, -56.536865 ,  1538280332534
2.7053833, 21.995544, -56.37207 ,  1538280937891
2.6168823, 22.340393, -56.565857    ,  1538281844967
2.9907227, 22.48993, -57.510376 ,  1538282750451
-26.54419, 26.434326, 44.503784 ,  1538283048971
24.066162, 5.104065, 61.079407  ,  1538283383594
23.76709, 5.4504395, 61.33423   ,  1538283863574
23.87085, 1.3549805, 60.598755  ,  1538284538406
24.336243, 1.2054443, 61.288452 ,  1538285494179
24.020386, 1.5945435, 61.228943 ,  1538286514128
-17.408752, 34.71527, 45.133972 ,  1538287869792
24.276733, 4.7454834, -59.74579 ,  1538288474649
24.14093, 4.234314, -60.375977  ,  1538289084002
-12.579346, 40.87982, 40.12451  ,  1538289775226
-16.358948, 32.974243, 46.273804    ,  1538290103548
7.446289, -15.234375, 49.768066 ,  1538301760672
11.302185, -1.0757446, -55.036926   ,  1538302063111
41.15143, -20.500183, -38.746643    ,  1538302490209
49.23706, 8.360291, 19.708252   ,  1538302955188
55.14679, 5.899048, 0.55389404  ,  1538303257514
10.296631, -51.96991, -5.836487 ,  1538303592431
5.555725, -52.149963, 3.8986206 ,  1538303913855
15.156555, -48.519897, -0.105285645 ,  1538304216080
55.252075, 0.78430176, 4.5440674    ,  1538304513209
14.901733, -6.6848755, -50.31128    ,  1538304814535
17.556763, -4.9453735, -49.531555   ,  1538305258231
17.07611, -4.43573, -50.341797  ,  1538305885274
16.80603, -4.0145874, -50.656128    ,  1538306849839
16.911316, -5.064392, -50.35553 ,  1538307934275
2.7069092, -9.054565, -54.196167    ,  1538311487005
7.762146, -7.044983, -55.111694 ,  1538318042202
8.226013, -7.029724, -54.571533 ,  1538318348333
28.881836, -20.724487, 34.6344  ,  1538322159796
55.836487, 2.0751953, 4.034424  ,  1538322473121
55.40161, 0.74005127, 2.1881104 ,  1538322775548
55.656433, -0.44555664, -0.6011963  ,  1538323077773
6.111145, -53.260803, -5.041504 ,  1538323403594
4.6569824, -53.260803, 3.237915 ,  1538323706020
4.147339, -52.915955, 1.7837524 ,  1538324008146
16.056824, -49.031067, -14.460754   ,  1538324310571
16.671753, -38.830566, -33.00171    ,  1538324607800
12.696838, -42.234802, -29.986572   ,  1538324904227
15.2908325, -42.715454, -28.831482  ,  1538325200955
15.802002, -41.410828, -30.33142    ,  1538325504501
25.115967, -37.58545, -30.421448    ,  1538325806906
26.000977, -31.40564, -36.106873    ,  1538326109333
38.82599, 8.479309, -38.687134  ,  1538326411561
2.6763916, -15.1901245, 54.553223   ,  1538326714988
11.091614, -11.425781, 55.34973 ,  1538327101994
5.2719116, -13.525391, 54.733276    ,  1538327760734
3.5461426, -13.510132, 54.808044    ,  1538328693404
3.7109375, -55.78003, -2.0858765    ,  1538328998328
2.5558472, -56.289673, -4.470825    ,  1538329304253
2.0767212, -55.97534, -6.826782 ,  1538329613277
56.106567, -2.8305054, -1.7562866   ,  1538329943497
6.126404, -55.23987, -6.3308716 ,  1538330245922
4.685974, -54.699707, -10.140991    ,  1538330548249
55.911255, -5.769348, 2.5482178 ,  1538330850574
39.11133, 12.739563, -37.12616  ,  1538331152901
-45.06836, 0.14038086, -38.160706   ,  1538331455232
17.390442, 23.554993, 55.903625 ,  1538347134220
-20.439148, 7.460022, -38.430786    ,  1538347747579
7.8216553, -1.361084, 38.668823 ,  1538348220161
7.8216553, -1.361084, 38.668823 ,  1538348220161
-18.263245, -5.529785, 44.413757    ,  1538349874458
-16.912842, -4.2099, 43.933105  ,  1538350264958
-16.299438, -3.4606934, 44.248962   ,  1538350888812
-17.408752, -3.2043457, 43.75305    ,  1538351816582
-17.21344, -2.859497, 43.963623 ,  1538352751656
-15.0390625, 18.469238, 39.65912    ,  1538353830887
14.840698, 1.8951416, -48.661804    ,  1538354344165
14.945984, 1.9851685, -47.98584 ,  1538355025003
-20.063782, 19.309998, 33.494568    ,  1538355508777
14.196777, -1.2557983, -48.435974   ,  1538355811207
14.256287, -1.1352539, -48.616028   ,  1538356307085
45.20111, 5.2993774, -1.725769  ,  1538356801760
13.490295, -4.135132, -48.690796    ,  1538357330936
13.116455, -4.4662476, -48.616028   ,  1538357983879
-21.833801, 37.864685, 17.36908 ,  1538358586625
-20.904541, 34.205627, 36.98883 ,  1538376675008
-20.904541, 34.205627, 36.98883 ,  1538376675008
-20.904541, 34.205627, 36.98883 ,  1538376675008
-54.803467, -13.960266, 19.213867   ,  1538377228431
12.892151, 18.515015, 49.409485 ,  1538377529758
-19.299316, -15.115356, -50.37079   ,  1538377828945
27.410889, 30.439758, 17.173767 ,  1538378132271
33.14209, -121.65985, 58.439636 ,  1538378799010
25.29602, -19.210815, -1.9210815    ,  1538379096134
31.70166, 18.455505, -25.186157 ,  1538379398086
-13.418579, -1.8707275, -58.546448  ,  1538420544161
-13.418579, -1.8707275, -58.546448  ,  1538420544161
-13.62915, -1.84021, -58.605957 ,  1538421151809
-13.62915, -1.84021, -58.605957 ,  1538421151809
-12.849426, -1.4953613, -58.410645  ,  1538422062386
-12.849426, -1.4953613, -58.410645  ,  1538422062386
-11.888123, -1.045227, -58.39691    ,  1538422970267
-11.888123, -1.045227, -58.39691    ,  1538422970267
-13.508606, 2.2994995, -58.621216   ,  1538426539190
-13.508606, 2.2994995, -58.621216   ,  1538426539190
-21.218872, 21.424866, 44.892883    ,  1538429695519
-21.218872, 21.424866, 44.892883    ,  1538429695519
23.81134, 1.1001587, -54.286194 ,  1538430409350
23.81134, 1.1001587, -54.286194 ,  1538430409350
-18.188477, 41.56952, 33.374023 ,  1538430735066
-18.188477, 41.56952, 33.374023 ,  1538430735066
56.570435, 4.849243, -1.876831  ,  1538431244046
56.570435, 4.849243, -1.876831  ,  1538431244046
-36.819458, 29.225159, 35.038757    ,  1538431665892
-36.819458, 29.225159, 35.038757    ,  1538431665892
-121.02814, -63.459778, -74.16077   ,  1538432237155
-121.02814, -63.459778, -74.16077   ,  1538432237155
5.4214478, -22.390747, -32.70111    ,  1538432879063
5.4214478, -22.390747, -32.70111    ,  1538432879063
22.805786, -68.98041, -22.291565    ,  1538433213184
22.805786, -68.98041, -22.291565    ,  1538433213184
15.306091, 17.480469, 71.15936  ,  1538433516174
15.306091, 17.480469, 71.15936  ,  1538433516174
-14.663696, -52.81067, 18.148804    ,  1538434199096
-14.663696, -52.81067, 18.148804    ,  1538434199096

• What are the units of the signals, including time? – Adrian Keister Dec 10 '18 at 14:54
• the time is in milliseconds since Unix Epoch, the x,y,z are signal strengths – hyena Dec 13 '18 at 7:50
• Thanks for the time units. You have not yet provided the units for the other signals, since "signal strengths" is not a physical unit. Are we talking magnetic field strength, like Federico assumed? In that case the units might be Teslas. What we need here is a recognized physical unit for the three other signals. – Adrian Keister Dec 13 '18 at 13:56
• am trying to use a magnetic sensor as opposed to accelerometer because of power consumption, as the device will be getting this values every ~ 5 min – hyena Dec 14 '18 at 21:40
• also accelerometer is more suited for small changes where us the magnetic field could be used to infer that the device has moved from one location to another. – hyena Dec 14 '18 at 21:44

Since we don't have any information on the orientation of the device, I only looked at the norm of the magnetic field. Here is a plot:

As you can see, there are intervals over which the norm of the magnetic field is relatively constant (from 50 to 100 and around 130).

EDIT

Given we have not much additional information on the underlying physical process, the most reasonable thing to do seems to me to just look at some moving variances (see for instance here, here, here, here). What I mean is that you fix some window timeframe and look at how much the data oscillates in that window. If the oscillation is sufficiently low, then the field you are measuring is almost constant in norm, which could mean that you are almost stationary.

• am assuming one axis should be the time stamp, correct me if am wrong – hyena Dec 13 '18 at 7:51
• Oh yes sure, sorry. The horizontal axis is time, the vertical is the norm of the field – Federico Dec 13 '18 at 14:28
• probably i can use several moving variances, where i can treat one of the variance as a signal line – hyena Dec 14 '18 at 21:49
• i took your suggestion and used Knime to get some Moving Averages . the smallest duration is 15 min and the highest duration is 2 hour, plotting a graph using this two lines, i get the lines crossing close to the times, the device was on the move. i have put a link to the Kinme export file. dropbox.com/s/dui57q33a1pdooe/… – hyena Dec 17 '18 at 9:42
• here is a link to the data magnetic signal dropbox.com/s/at1mwuc9osssq5j/… the fields are [guid,source,x,y,z,accuracy,timestamp] the time stamp is in milliseconds since Unix Epoch – hyena Dec 18 '18 at 7:36