An example to draw Amplitude Modulation curve: y = c * sin (x/a) * sin (x/b) . You can easily modify the codes to create your own oscilloscope application!
<?php
header ("Content-type: image/png");
$myImage = @imagecreatetruecolor(640, 480)
or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($myImage, 255, 255, 224);
$poly_color = imagecolorallocate($myImage, 124, 120, 224);
$points = array();
for ($i=1; $i<640; $i=$i+1)
{
$x = $i; $y = 150*sin($x/80)*sin($x/5);$points[] = $x; $points[] = 240-$y; }
$totalPoints = count($points)/2;
$title = "Final Plot ($totalPoints points)";
imagestring($myImage, 3, 5, 5, $title, $text_color);
for ($i=0; $i<$totalPoints-1; $i++)
{
imageLine($myImage, $points[2*$i], $points[1+2*$i], $points[2+2*$i], $points[3+2*$i], $poly_color);
}
imagepng($myImage);
imagedestroy($myImage);
?>