CS 8803: Mobile Computing and IoT Fall 2021

Homework 2

Handed Out: Oct 25th, 2021 Due: 11:59pm, November 29th, 2021

Q1: (15 point) We have studied localization over many lectures in this course. This

question will give you a chance to write a solver function to convert obtained distance

measurements into locations. The task is to localize the position of 5 tags. You are given a file

“positioning.mat”, which provides the position of 4 anchors (a 4×2matrix) and the distance

from each tag to the anchor (a 5 × 4 matrix). All distances and positions are measured in

centimeters. Your goal is to use these distance measurements and anchor positions to solve

for each tag’s position location. You are also given a starter code “HW2_startercode.m”

which sets up everything for you, except the solver itself. The starter code is in Matlab but

you can rewite with python as well. In python, you can use module “python-scipy” to read

a .mat file. Only python and matlab will be accepted for this homework.

For this question, you need to implement “function positioning(x, dist, anchors)”. You

also need to provide a screenshot which gives the calculated positions of every tag.

Q2: (10 + 5 points) The distance measurements are not mathematically accurate, but

rather erroneous ranging measurements. This question will show you how a small precision

error dilutes to a significant location error based on the geometry of the anchors and the

tag.

(1) Add a Gaussian error to the given distance of all tags using σ of 5cm and µ of 10cm.

Redo the calculation of positioning in Q1 and observe what happens to the results. In this

sub-question, you need to implement function Q2_1(dist, anchors) to complete the

above task. You also need to provide a scatter picture. In the picture, using black dots

to show the position of anchors, blue dots to show the ground-truth position of tags and red

dots to show the calculated position of tags.

(2) Randomly sampling with the above Gaussian distribution, add noise to tag1 and tag2

for 300 times. Plot the cumulative distribution function of the localization error of tag1 and

tag2 (error is the Euclidean distance between the true position and the calculated position).

In this sub-question, you need to implement function Q2_2(dist, anchors) to complete

the above task. You also need to produce the cumulative distribution plot. Finally,

write your thoughts about what you observe (Write a 2 sentence explanation for the

observed results).

Q3: (20 points) Three unknown liquids were tested using the setup in the LiquID paper.

The depth of the container was 2cm and the thickness of the container was negligible. The

transmitter and receiver antennas were kept at a distance of 20cm from each other. Delay

between the first peak and the second peak in the CIR (derived and combined from ToF and

phase) was calculated to be 15.66713ns without the liquids. With the liquid placed in the

container, we got the following readings: Liquid1 16.18333ns, Liquid2 15.98560ns, Liquid3

1

15.67792ns. Use the ground truth values from the table in LiquID paper to identify

the Liquid1, Liquid2, and Liquid3. Speed of light to be 299792458m/s. Note: We have

provided higher resolution for the measurements than are practically possible to obtain, for

the purpose of simplicity in this homework question.

Q4: (20 points) The following CIR graph Fig. 1 shows the channel impulse response

obtained from a particular room. It has 1 direct signal and 3 multi-path signals. The room’s

layout is approximately shown below as well Fig. 2. There are a UWB receiver, a UWB

transmitter and some reflective objects in the room. Assume the signal is reflected at most

once, label the various peaks you observe in the CIR with the labels shown in the room.

Channel Impulse Response

Figure 1: Channel Impulse Response (Q4)

Q5: (15 points) Some researchers replicated the Backdoor setup and transmit two ultra-

sonic tones at 40kHz and 45kHz. But instead of just using a regular microphone, they intend

to use a ultrasonic microphone, but end up jumbling some components as follows:

The diaphragm is from an ultrasonic microphone The amplifier is from a regular microphone

The filter is from an ultrasonic microphone (cut off at 100kHz) The ADC is from an ultrasonic

microphone (sampling rate 200kHz) What frequencies would the researchers notice in the

recorded signal?

Q6: (15 points) Suppose your smartphone is static and is collecting IMU data. At some

time, we obtain a measurement that acceleration is [7.53,−2.52, 6.02], and the magnetometer

reading is [4.87,−29.65,−18.51] (Let’s assume that the vector provided by magnetometer is

pointing to the north pole). Use the earth as the reference coordinate system, calculate the

rotation matrix of your smartphone (the order of X, Y, Z in rotation matrix, and the sign

of each axis don’t matter).

2

Rx

Tx

O1

O2

O3

Figure 2: Room layout (Q4)

3

欢迎咨询51作业君