#!/usr/bin/perl

# ----------------------------------------------------------------
# John Kerl
# kerl.john.r@gmail.com
# 2005-01-14
#
# This is a data generator.  Example usage:
#
# phatgen 10 4 6 2
#      0.00000000000      0.00000000000
#      0.00000000000      0.00000000000
#      0.00000000000      0.00000000000
#      0.00000000000      0.00000000000
#      2.00000000000      0.00000000000
#      2.00000000000      0.00000000000
#      2.00000000000      0.00000000000
#      0.00000000000      0.00000000000
#      0.00000000000      0.00000000000
#      0.00000000000      0.00000000000
# ----------------------------------------------------------------

sub usage() {
	die "Usage: $0 {N} {klo} {khi} [mag [phz]]\n",
}

$mag = 1.0;
$phz = 0.0;
$pi  = 4.0 * atan2(1.0, 1.0);

usage() if @ARGV < 3;
$N   = shift @ARGV;
$klo = shift @ARGV;
$khi = shift @ARGV;
$mag = shift @ARGV if (@ARGV);
$phz = shift @ARGV if (@ARGV);
$phz *= 2.0 * $pi;

$re  = $mag * cos($phz);
$im  = $mag * sin($phz);

for ($j = 0; $j < $N; $j++) {
	if ($j >= $klo && $j <= $khi) {
		$ore = $re;
		$oim = $im;
	}
	else {
		$ore = 0.0;
		$oim = 0.0;
	}
	printf "%18.11f %18.11f\n", $ore, $oim;
}
