Skip to content

Instantly share code, notes, and snippets.

@hexgnu
Created November 30, 2016 03:42
Show Gist options
  • Save hexgnu/5421d283b493c783523f29adac3de135 to your computer and use it in GitHub Desktop.
Save hexgnu/5421d283b493c783523f29adac3de135 to your computer and use it in GitHub Desktop.
(require plot)
(plot-font-size 24)
(plot-height 800)
(plot-width 800)
(define f (λ (x) (+ (* 3 x) 2 )))
(define xs (range -30 30 0.1))
(define ys (map
(lambda (x)
(+
(f x)
(- (* 40 (random)) 20)
)
)
xs
))
(plot
(list
(function (λ (x) (+ (* 3 x) 2 )) -30 30 #:label "f(x) = 3 * x + 2")
(points (map vector xs ys) #:sym 'dot #:size 10 #:label "f(x) +/- 20 * random")
)
#:x-label ""
#:y-label ""
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment