home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l196 / 3.ddi / SINEWAVE.BA$ < prev    next >
Encoding:
Text File  |  1990-06-24  |  717 b   |  27 lines

  1. SCREEN 2
  2.  
  3. ' Viewport sized to proper scale for graph:
  4. VIEW (20, 2)-(620, 172), , 1
  5. CONST PI = 3.141592653589#
  6.  
  7. ' Make window large enough to graph sine wave from
  8. ' 0 radians to pi radians:
  9. WINDOW (0, -1.1)-(2 * PI, 1.1)
  10. Style% = &HFF00         ' Use to make dashed line.
  11. VIEW PRINT 23 TO 24  ' Scroll printed output in rows 23, 24.
  12. DO
  13.     PRINT TAB(20);
  14.     INPUT "Number of cycles (0 to end): ", Cycles
  15.     CLS
  16.     LINE (2 * PI, 0)-(0, 0), , , Style%  ' Draw the x axis.
  17.     IF Cycles > 0 THEN
  18.  
  19.         '  Start at (0,0) and plot the graph:
  20.         FOR X = 0 TO 2 * PI STEP .01
  21.      Y = SIN(Cycles * X) ' Calculate the y coordinate.
  22.      LINE -(X, Y)     ' Draw a line to new point.
  23.         NEXT X
  24.     END IF
  25. LOOP WHILE Cycles > 0
  26.  
  27.