#!/usr/bin/perl
#
# Compute data which shows the effects of beats
#
# MWR 4/4/2019

$mypi = 3.14159;

$debug = 1;

# first wave
#    amplitude (m)
$A1 = 0.8;
#    angular frequency (rad/s)
$omega_1 = 10;
# second wave
#    amplitude (m)
$A2 = 0.8;
#    angular frequency (rad/s)
$omega_2 = 11;

# plot points at these times
$start_t = 0.0;
$end_t = 50.0;
$dt = 0.02;

for ($t = $start_t; $t <= $end_t; $t += $dt) {

  $y1 = $A1 * sin($omega_1 * $t);
  $y2 = $A2 * sin($omega_2 * $t);

  $sum = $y1 + $y2;

  printf "%8.3f  y1 %8.3f  y2 %8.3f  sum %8.3f \n", 
         $t, $y1, $y2, $sum;


}






exit 0;
