Matlab files used for Weighted Averaging

Introduction to Weighted Averaging

Weighted averaging is a technique that improves the signal to noise ratio by "weighting" the recorded data according to its variance prior to summation and then dividing the sum by its "weight". In other words, trials that have, on average, more varience than other trials have less of an impact on the overall average response over many trials. This a proportionality effect in that the trials contribution to the overall averaged response is inversly proportional to its varience.

Instructions for the Weighted Averaging MATLAB routines

  1. Download the zipped MATLAB files here (be sure to fill out the short form)
  2. Unzip using Winzip (click here for Winzip web site, if you need the unpacking software)
  3. Read all the comments in the m files
  4. Place your CNT files in the same directory as the unzipped files
  5. Edit run_weight.m so that the file names match your CNT files
  6. Type "run_weight.m" in the MATLAB Command window
  7. If you have any difficulties, please review "Potential Problems" below
  • Any errors? Please review "Potential Problems" below

Interpretting the results

The run_weight.m routine outputs 2 files:
  1. filename.txt and
  2. filenamew.txt.
The first file is the summary of the analysis. It can be imported into a spread sheet program like Excel. The first row gives only a title to the data in the columns. The first column gives the filename. The second column gives the number of files processed. The third column gives information as to the type of averaging (1=normal, 2=weighted averaging). The remaining columns give F values (F), significances (S), amplitudes (A), phase values (P), and noise levels (N).

In the default settings there are 8 signals present with 8 characteristic modulation frequencies (remember that each modulation frequency has a characteristic carrier frequency i.e. Left: 750, 1500, 3000, and 6000 Hz Right: 500, 1000, 2000, and 4000 Hz). These are signals 1 to 8. Signals 9 to 12 are false alarms. The modulation frequencies of these are different than the previous 8. These false alarms have no real signal in them and thus should represent just noise. If one of these 4 signals should have a significant value, then this would represent a false alarm (i.e. a real signal where there should not have been). Remember that at P=0.05, 5% of all significant responses will be arise from chance alone.

Potential Problems

  • You must have the MATLAB Signal Processing Toolbox installed in your version of MATLAB because the routines call upon upon statistical functions found only in the Signal Processing Toolbox
  • Make sure your CNT files are in the same directory as the unzipped files
  • Make sure you read the comments in run_weight.m and change the default file names "en2km51", "en2km52", "en2km53" etc. to your CNT filenames. Do not use the CNT extension
  • Make sure you have the correct number files to average (default is 6)

Matlab Resources