Sine Wave Plot Program

This program uses the lbar command to plot a sine wave.

Program


---

Plot a sine wave with the lbar command.

---


prog_vars =

d/run_no 0

d/angle 0.0

d/raw_sin 0.0

d/sin_value 0.0

prog_vars.


prog_start =

print "Plot a sine wave"

prog_start.


prog_loop =

-- Calc sine of the abgle

sin /angle -> /raw_sin

-- Scale the Sine wave to fit.

mapf -1 1 0 50 /raw_sin -> /sin_value


-- Plot the sine wave.

tbar * /sin_value 25 40 "Sine /angle = /sin_value"

inc /angle 0.1 -- 0.1 best


-- Check if we should exit.

any /run_no > 100 -> exitprog

inc /run_no

prog_loop.


prog_stop =

print "Good bye"

prog_stop.