Digital integration of raw startle data
The Matlab program digIntStartle provides the ability to digitally integrate raw startle data for studies where failure of the analog integrator has resulted in significant loss of data. Since this program can not match exactly the results of the analog filtering and integration it is not meant to be used to fill in bad data. It should be used to process all the data in a study so that the data are processed in a consistent manner.
% function err = digIntStartle(fileName,studyName)
%
% fileName: the startle STM file
% studyName: the name of the study for which the data was acquired
%
% example: digIntStartle('MS777012.STM','MIDUS');
%
% this function digitally highpass filters, rectifies, and integrates the RAW
% startle data on rawChannel and writes it to intChannel replacing the old
analog
% processed signal and writes a new STM file with the extension _intRAW
%
% The following studies are currently supported:
% ALLREG MIDUS
digIntStartle first passes the raw startle data through a 30 Hz highpass filter, then rectifies it, and integrates it with a time constant of 20 milliseconds (set up to match the analog 30-1000Hz bandpass, rectification, and analog integrator with 20 ms time constant).. Shown below is an example startle comparing the analog(green) and digital(blue) processed data.

Figure 1
The horizontal scale is in milliseconds with the probe at time zero. Vertical scale is A/D units. Notice that there is approximate agreement. Below is the rectified raw startle data for this probe.

Figure 2
The digital integration with a time constant of 20 milliseconds is simply convolution with exp(-t/0.020). Shown below is output (top plot) for a unit impulse (lower plot) occurring at 1 second:

Figure 3
And for completeness the plots below show the same impulse input (bottom plot), output from the 30 Hz highpass filter (middle plot) and from the integrator (top plot):

Figure 4
Notice that this offline highpass filtered data produces a small signal even before the impulse signal occurs. The digital data is sampled at 1000 Hz with anti-aliasing filtering removing any signal content over 500 Hz so that there is less high frequency content in the digitized signal. Differences between the analog and digital highpass filters and in frequency content probably account for most of the differences shown in Figure 1.