Reputation: 75
I have a equation y=9x+6. I want to extract 10 random points from this function. How should I proceed?
Upvotes: 0
Views: 731
Reputation: 3175
Generate 10 random x-values, in this example uniformly distributed (function runif
), and then calculate the corresponding y-values following your equation.
You can control the x-range by setting different min
and max
parameters to function runif
.
x <- runif(10, min = 0, max = 1)
y <- 9*x+6
plot(x,y)
Upvotes: 5