#!/usr/bin/perl
#
# simulate a spectral line produced by an object rotating at some speed
#

# speed in km/sec
$v = 200.0;
$c = 300000.0;

# center of line
$center = 6563.0;

$delta = $v/$c;

$max = 2.0 * $v;
$min = 2.0 * (0.0 - $v);
$step = $v/50.0;
$sigma = $center * ($v/$c);

for ($vel = $min; $vel < $max; $vel += $step) {

  $new = $center * (1 + ($vel/$c));
  $arg = ($new - $center)*($new - $center);
  $inten = exp(-($arg/$sigma));

  printf("%12.5lf %12.5lf %12.5lf \n", $vel, $new, $inten);

}


exit 0;

