If your last (family) name begins with A-N, please complete the "Appl. Assignment 2 Quiz" on WebCT **after finishing** work on this assignment. If your last (family) name begins with O-Z, please complete the "Appl. Assignment 2 Quiz" on WebCT **PRIOR TO STARTING** work on this assignment. The quiz is found in the "Assessments" tab of the WebCT page.

Last Name Begins With | When To Take the Quiz |
---|---|

A-N | After completing the assignment |

O-Z | BEFORE STARTING the assignment |

In this assignment, you will find and analyze the conditional distributions of the received signal strength (RSS) at the two nodes, which we call node *a* and node *b*. This means that we will answer questions about probabilities of the RSS at one node given some information about the RSS at the second node. From your measurements of RSS at both ends of the link, you will

- Compute the conditional distribution of the measurement at node
*a*given that node*b*had a measurement in a small range.*Turn in:*a plot, and answers to two questions. - Compute the conditional distribution of the measurement at node
*a*given that node*b*encoded its measurement to a particular bit value.*Turn in:*a plot. - For a given quantization schemes, compute the probability of bit disagreement.
*Turn in:*the numerical answer.

You will need Matlab, a text file from an RSS measurement experiment, and some way to produce a document (eg., Word, OpenOffice). Create one PDF containing the outputs of your assignment, and the Matlab code you used to generate them. Turn it into the WebCT assignment drop box, by midnight on the due date.

Load the data file as you did in assignment 1:

data = load('-ascii','filename.txt');

Convert the data from the 'data' matrix into two separate vectors, one for the measurements at node 'a' and another for the measurements at node 'b':

[rssa, rssb] = separateData(data);

where separateData.m has been downloaded into your working directory.

During the experiment, the channel can be measured only in one direction at a time. Nodes measure the channel quickly, but regardless, the measurements in one direction (a to b) are taken at different times compared to the measurements in the other direction (b to a). We use interpolation to address this. Interpolation estimates, from the two sequences of measurements, what they would have been if they had been taken simultaneously.

Interpolation is not a topic of this class -- it is covered in 5520. So you do not need to investigate interpolation for this project. Use my provided interpolation function to make the times of the samples in the two RSS vectors agree. Type:

[interpa, interpb] = interpolateRSS(rssa, rssb);

where interpolateRSS.m has been downloaded into your working directory.

Figure 1: Example of interpolated RSS signals at nodes *a* and *b*.

Now, verify for yourself that the measurements in the two directions agree. Use these commands:

len = length(interpa);

plot(1:len, interpa, 'ro-', 1:len, interpb, 'kx-', 'LineWidth',2)

set(gca,'FontSize',20)

grid

xlabel('Sample Number')

ylabel('RSS (dB)')

Then zoom in to show a small segment of the x-axis so that you can verify that the two signals are approximately the same shape.

Figure 1 shows an example of this plot. You do not need to turn in your plot, it is just to show you how well the two signals agree. Note that:

- After interpolation, the RSS values are no longer only integers - they are real-valued.
- There is likely a consistent difference between the two lines; this is a difference in the mean between the two marginal distributions. For example, one node might have a somewhat higher transmit power than the other.

To correct for the difference in mean, do the following:

interpa = interpa - mean(interpa);

interpb = interpb - mean(interpb);

Define an event C to be that the measurement at node a is within a given 1-dB range, for example, between -10 to -11. The indices for which event C occurs are:

ind = find(( interpa > -2) & (interpa <= -1))

I had more than 500 indices for which this was true. If you had less than 200, select a different 1-dB range. Then, the values of interpb given that C occurred are:

interpb_given_C = interpb(ind)

In assignment 1, you plotted a pmf. Here, you need to plot an estimated pdf from `interpb_given_C`

, which requires a somewhat different procedure:

[n, x] = hist(interpb_given_C,30)

deltax = x(2)-x(1)

pdf = n./sum(n)./deltax

The 2nd input argument of `hist`

is the number of bins. If you make it smaller, you will have a smoother pdf estimate, but you will have fewer bins and see fewer features of the pdf.

You should check to make sure that the pdf *integrates* to one. This isn't just the sum of `pdf`

! An integral is an area -- remember you always have a $dx$ in an integral. Your dx is determined by the `hist`

function, as calculated above. This is the integral of the pdf:

sum(pdf)*deltax

Make sure it is equal to one.

Plot and turn in the pdf with:

plot(x, pdf,'x--', 'LineWidth',2, 'MarkerSize',11)

set(gca,'FontSize',20)

xlabel('Value (dB)')

ylabel('Probability Density')

grid

Also turn in your answers to the following. One sentence is sufficient for each.

- Qualitatively, what kind of variation do you see in the RSS measurement on link
*b*when the measurement on link*a*is in your given 1-dB range? - How does the variation compare to the variation you found in the pmf at one node in Application Assignment 1?

Now, consider the following proposed quantization scheme. In this scheme, based on the measured RSS at a node, we will have three possible events:

- C
_{1}: The RSS falls into a certain set which makes the node encode the measurement with the bit*1*. - C
_{0}: The RSS falls into another set (disjoint from set C_{0}) which makes the node encode the measurement with the bit*0*. - C
_{C}: The RSS falls into third set (disjoint from both sets C_{0}and C_{1}) which makes the node decide to censor the measurement, that is, not encode it at all. This set is values in-between C_{0}and C_{1}to provide a 'buffer zone' so that small errors (of the type you saw in your conditional pdf in part 1) do not cause a bit disagreement. In a real implementation, nodes would communicate to tell the other the indices of the measurements it wants to censor.

The events C_{0}, C_{1}, and C_{C} form a partition; they are mutually exclusive and their union is S, the sample space. You should choose your own events; you can pick different intervals; or different arrangements of the sets, as long as they form a partition. The following code assumes this example partition: let $C_1=[3,\infty)$, $C_0=(-\infty, -2]$m, and $C_C=(-2,3)$. *Be sure* to modify the code for your partition!

Plot and turn in the estimated conditional pdf of `interpb`

given that event C_{0} occurs at node *a*.

ind_C0a = find(interpa < -2)

interpb_given_C0a = interpb(ind_C0a)

Use the procedure above to plot the estimated pdf of this data.

First, find the indices for the measurements when C_{C} occurs at *either* node:

ind_Censored = find(((interpa > -2) & (interpa < 3)) | ((interpb > -2) & (interpb < 3)))

ind_Not_Censored = setdiff(1:len, ind_Censored)

The matlab function `setdiff`

returns what we called the set minus operator; in this case it removes all indices from 1:len which are censored. Then remove the censored values from the set of measurements:

notCensored_a = interpa(ind_Not_Censored)

notCensored_b = interpb(ind_Not_Censored)

Now, find the cases which:

- C
_{0}occurs at node*a*and C_{1}occurs at node*b* - C
_{1}occurs at node*a*and C_{0}occurs at node*b*

For example, for (1), you can find the indices with:

ind_C0a_and_C1b = find((notCensored_a <= -2) & (notCensored_b >= 3))

and compute a probability as

Prob_C0a_and_C1b = length(ind_C0a_and_C1b) / length(notCensored_a)

Note that I am implicitly conditioning on the case that the measurement does NOT get censored. (It will never disagree when the measurement is censored, but this shouldn't count, because we do not generate a bit in this case.)

Report the total probability of bit disagreement as your solution to (3.)

Submit your results as described above.

If your last (family) name begins with A-N, please complete the "Appl. Assignment 2 Quiz" on WebCT now.