CONST xs = 100
DIM a(xs, 2)
SCREEN 12: CLS
WINDOW (-1.6, -1.2)-(1.6, 1.2)
INPUT "输入第二个信号相对于第一个信号频率的倍数(0.1-10)"; f
n = 0: t = 0
a = 0
x1 = SIN(a): y1 = COS(a * f)
a(n, 1) = x1: a(n, 2) = y1
DO
x = SIN(a)
y = COS(a * f)
LINE (x1, y1)-(x, y)
n = n + 1
IF n > xs THEN
n = 0: t = 1
END IF
IF t = 1 THEN
s = n + xs
IF s > xs THEN s = 0
m = n + 1
IF m > xs THEN m = 0
LINE (a(n, 1), a(n, 2))-(a(m, 1), a(m, 2)), 0
END IF
a(n, 1) = x: a(n, 2) = y
x1 = x: y1 = y
a = a + .01
LOOP UNTIL INKEY$ <> ""
END