Please accept my apologies for the mess — the site is under construction.


about / contact

the site
the webmaster

full cv (pdf)



the Lorentz boost (coming soon)

MATLAB | findCalibrationValues.m
01:17 01-Sep-12

A somewhat well-documented matlab code that will read the PDP calibration files, allow the user to find the linear range, show some statistics, then save a .mat file with relevant information.

I won't really go into the specifics of how calibration works, or how the code works, as I think it is sufficiently explained in the code file itself. Rather, I'll talk briefly about how the directory should be organized, and what will be encountered on the user-end when running the code.

[This code was published 1 September 2012, GW]

directory structure:
The findCalibrationValues.m file should be placed in whatever RX folder the calibration data exists in, in the uppermost directory. Within that directory, the calibration data should be in a folder named "Folder Number #" where # is defaulted to 1 in the program, however can be changed to whatever number is appropriate.

Within this folder should be new folders, one corresponding to each different measurement taken at a certain RX attenuation level. The folders should be named "# dB" where # corresponds to the RX attenuator level. Within these folders should be text files, names starting with "PDP".

The files themselves should be comma separated, with two columns, the first corresponding to time, the second to voltage-squared values (unscaled power). For this part of post-processing, the time column is not necessary; however, in its current form, the program will only look for power levels in the second column.

running the code:
Assuming that all of the files and folders are in their proper places, running the code is easy! The program displays an image similar to the one below and prints the following
Please enter extrema of linear range.
Min (dB): 20
Max (dB): 50

The user identifies the linear range of the graph and enters the minimum and maximum x-axis values. The code then replots the graph (reproduced below) and asks the user if the new line is a good fit (for the linear range). In this example, the linear range extends from about 20dB to 50dB. The new line, shown in green, should run with the data in the linear range specified before. The program asks if the line is good enough, if so, requesting the user enter the number "1".

Please enter extrema of linear range.
Min (dB): 20
Max (dB): 50
If new line fits, enter 1: 1

The graph closes and statistics are printed.

This section is meant to provide numerical confirmation that
the numbers entered are correct.
For the linear range that you entered, the path
loss(es) calculated follow(s):
20 dB ~ 0.16746
30 dB ~ -0.28775
40 dB ~ 0.073125
50 dB ~ 0.047166
The above numbers are in dB and should be close
to zero, whereas the following number (ratio) is
in linear and should be close to 1: 1.0008
If the above values are not satisfactory, rerun the program!

The first four numbers are the literal difference between the slope/intercept-calculated points for corresponding attenuations (points on the green line). The last number that is printed is the mean of the dB offsets represented in linear (i.e. ratios). The closer the first numbers are to zero, the better (0dB means no variance); the closer the last number is to one, the better (1:1 ratio).

The full program code can be found here.

This website is run and maintained by George Wong. This webpage was last modified 01:17 01-Sep-12 est.
You opened this page on and its subsidiaries are copyright 2003-2014.