# Matlab files used for Weighted Averaging

- Download the MATLAB files here
- As seen in: Weighted Averaging of Steady-State Responses, John et al. Clinical Neurophysiology (2001)

## 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

- Download the zipped MATLAB files here (be sure to fill out the short form)
- Unzip using Winzip (click here for Winzip web site, if you need the unpacking software)
- Read all the comments in the m files
- Place your CNT files in the same directory as the unzipped files
- Edit run_weight.m so that the file names match your CNT files
- Type "run_weight.m" in the MATLAB Command window
- 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:- filename.txt and
- filenamew.txt.

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)