#! /bin/sh # file: hrfft G. Moody 14 June 1995 # # Derive a heart rate power spectrum (using tach and fft) and plot it while [ $# -gt 1 ] do case $1 in -a) ANNOTATOR=$2 ;; -f) START=$2 ;; -p) PLOT=$2 ;; -r) RECORD=$2 ;; -t) END=$2 ;; -T) DEVICE=$2 ;; esac shift shift done if [ x$PLOT = x ]; then if [ -x /usr/local/bin/plt ]; then PLOT=/usr/local/bin/plt elif [ -x /usr/local/bin/plot2d ]; then PLOT=/usr/local/bin/plot2d else echo "No plot utility found -- exiting" exit 1 fi fi if [ x$RECORD = x ]; then echo -n "Enter the record name: " read RECORD fi if [ x$ANNOTATOR = x ]; then echo -n "Enter the annotator name: " read ANNOTATOR fi if [ x$START = x ]; then START=0 fi if [ x$END = x ]; then END=e fi if [ x$DEVICE = x ]; then PLOTOUT="" else PLOTOUT="-T $DEVICE" fi tach -r $RECORD -a $ANNOTATOR -f $START -t $END -F 4 | \ fft -f 4 -P -w Welch -Z - | \ $PLOT 0 1 -x "Frequency (Hz)" -y "Power" \ -t "Record $RECORD ($START - $END): Heart rate spectrum (FFT)" \ -X 0 1 $PLOTOUT