Plot a Cos Wave

This program uses the plot command to graph a cos wave.

Program


---

Plot a cos wave with the plot command.

---


prog_vars =

d/run_no 0

d/angle 0.0

d/Xpos 0

d/raw_cos 0.0

d/cos_value 0.0

prog_vars.


prog_start =

pclear

ptl 10 0 ^ts=24^tc=blue^ "Plot a Cos wave"

prog_start.


prog_loop =

-- Calc cost of the abgle

cos /angle -> /raw_cos

-- Scale the Cos wave to fit.

mapf -1 1 0 50 /raw_cos -> /cos_value


-- Plot the Cos wave.

plot 10 50 ^t1n=COS^xdp=100^xp=/Xpos^v1=/cos_value^

inc /angle 0.1 -- 0.1 best

inc /Xpos


-- Check if we should exit.

any /run_no > 100 -> exitprog

inc /run_no

prog_loop.


prog_stop =

print "Good bye"

prog_stop.