Advertisement
Fabi_Math

Taller1

Sep 7th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 2.46 KB | None | 0 0
  1. # Taller 1 Fabián Ramírez
  2.  
  3. # Defino un ruido blanco
  4.  
  5. par(mfrow=c(2,2)); #divido el grafico en 2x2
  6.  
  7. Serie1=rnorm(500,0,1);
  8. Serie2=rnorm(500,0,0.1);
  9. Serie3=rnorm(500,0,10);
  10. Serie4=rnorm(500,0,100);
  11.  
  12. ts.plot(Serie1,main="N(0,1)",xlim = c(0,500), ylim =c(-50,50),col="blue");
  13. ts.plot(Serie2,main="N(0,0.1)",xlim = c(0,500), ylim =c(-50,50),col="red");
  14. ts.plot(Serie3,main="N(0,10)",xlim = c(0,500), ylim =c(-50,50),col="green");
  15. ts.plot(Serie4,main="N(0,100)",xlim = c(0,500), ylim =c(-50,50),col="yellow");
  16.  
  17.  
  18. # Defino una tendencia
  19. a = 5;
  20. b = 10;
  21. x = seq(1:500);
  22. Tendencia = a + b*x;
  23.  
  24. # Defino un ruido blanco con tendencia
  25. X1 = Tendencia + Serie1;
  26. X2 = Tendencia + Serie2;
  27. X3 = Tendencia + Serie3;
  28. X4 = Tendencia + Serie4;
  29.  
  30. par(mfrow=c(2,2)); #divido el grafico en 2x2
  31.  
  32. ts.plot(X1,main="N(0,1)",xlim = c(0,500), ylim =c(0,5000),col="blue");
  33. ts.plot(X2,main="N(0,0.1)",xlim = c(0,500), ylim =c(0,5000),col="red");
  34. ts.plot(X3,main="N(0,10)",xlim = c(0,500), ylim =c(0,5000),col="green");
  35. ts.plot(X4,main="N(0,100)",xlim = c(0,500), ylim =c(0,5000),col="yellow");
  36.  
  37. # Defino una nueva forma de tendencia
  38. Y1 = Tendencia * Serie1;
  39. Y2 = Tendencia * Serie2;
  40. Y3 = Tendencia * Serie3;
  41. Y4 = Tendencia * Serie4;
  42.  
  43. par(mfrow=c(2,2)); #divido el grafico en 2x2
  44.  
  45. ts.plot(Y1,main="N(0,1)",col="blue");
  46. ts.plot(Y2,main="N(0,0.1)",col="red");
  47. ts.plot(Y3,main="N(0,10)",col="green");
  48. ts.plot(Y4,main="N(0,100)",col="yellow");
  49.  
  50. # Defino una nueva forma de tendencia
  51. Z1 = Tendencia / Serie1;
  52. Z2 = Tendencia / Serie2;
  53. Z3 = Tendencia / Serie3;
  54. Z4 = Tendencia / Serie4;
  55.  
  56. par(mfrow=c(2,2)); #divido el grafico en 2x2
  57.  
  58. ts.plot(Z1,main="N(0,1)",col="blue");
  59. ts.plot(Z2,main="N(0,0.1)",col="red");
  60. ts.plot(Z3,main="N(0,10)",col="green");
  61. ts.plot(Z4,main="N(0,100)",col="yellow");
  62.  
  63. # Hacer 1 partido en el anterior
  64.  
  65. par(mfrow=c(2,2)); #divido el grafico en 2x2
  66.  
  67. ts.plot(1/Z1,main="N(0,1)",col="blue");
  68. ts.plot(1/Z2,main="N(0,0.1)",col="red");
  69. ts.plot(1/Z3,main="N(0,10)",col="green");
  70. ts.plot(1/Z4,main="N(0,100)",col="yellow");
  71.  
  72.  
  73. # Hacer un ciclo
  74. # Hacer un vector de senos
  75.  
  76. hola = seq(1:500);
  77. for(i in 1:500){
  78.     hola[i] = sin(i);
  79. };
  80.  
  81. W1 = Serie1 + 4*hola;
  82. W2 = Serie1 + 4*hola;
  83. W3 = Serie1 + 4*hola;
  84. W4 = Serie1 + 4*hola;
  85.  
  86.  
  87.  
  88. ts.plot(W1,main="N(0,1)",col="blue");
  89. ts.plot(W2,main="N(0,0.1)",col="red");
  90. ts.plot(W3,main="N(0,10)",col="green");
  91. ts.plot(W4,main="N(0,100)",col="yellow");
  92.  
  93. # Tarea buscar datos y una serie de la vida real y exponerla ts.plot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement