#!/usr/bin/perl
#
# fit slopes to data in the Michelson interferometer
#

$debug = 1;


# look for relationship between fringes and temperature
printf "number_of_fringes vs. Temp(C) \n";
$cmd = "grep -v '#' mwr_michelson.dat | awk '{ print (\$1), (\$2) }'";
$cmd .= " | fitline ";
$ret = exec_cmd($cmd);
printf "\n";


exit 0;




##############################################################################
# PROCEDURE: exec_cmd
#
# DESCRIPTION: Execute the given shell command line.  If the $debug flag
#              is set, we print to stdout the command line, and
#              also print out the result string.
#
# RETURNS:
#              the result of the command
#
#
sub exec_cmd {

  my($cmd, $ret);

  $cmd = $_[0];

  if ($debug > 0) {
    printf "cmd is ..$cmd.. \n";
  }
  $ret = `$cmd`;
  if ($debug > 0) {
    printf "ret is ..$ret.. \n";
  }

  return($ret);
}


