Skip to content

Instantly share code, notes, and snippets.

@phelipetls
Last active June 6, 2019 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phelipetls/ad7bd867a480bed9a6fa4fa344dd54e8 to your computer and use it in GitHub Desktop.
Save phelipetls/ad7bd867a480bed9a6fa4fa344dd54e8 to your computer and use it in GitHub Desktop.
# gerar uma sequência de -2pi até 2pi, com discretização de 2000
t <- seq(from = -2*pi, to = 2*pi, length.out = 2000)
# função para gerar os valores de x
X <- function(t, a, A = 1, d = pi/2) {
A*sin(a*t+d)
}
# para gerar os valores de y
Y <- function(t, b, B = 1) {
B*sin(b*t)
}
# parâmetros para gerar os gráficos em um plot device
# com 4 linhas e 4 colunas
par(mfrow = c(4, 4))
# plotar 16 vezes os pontos gerados com aquelas funções
for(i in 1:16) {
a <- sample(1:10, 1)
b <- sample(1:10, 1)
plot(X(t, a), Y(t, b), main = paste0("a: ", a, " b: ", b))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment