Guest User

Untitled

a guest
May 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. import scipy.stats as st
  4. mu, sigma = 0, 1.0 # media y desvio estandar
  5. datos = np.random.normal(mu, sigma, 10000) #creando muestra de datos
  6. x=np.linspace(-4,4,num=1000)
  7. y=st.norm.pdf(x,0,1)
  8.  
  9. plt.plot(x,y,'r')
  10. # histograma de distribución normal.
  11. plt.hist(datos, 30,color='c',histtype='bar',cumulative=False,edgecolor='black', linewidth=0.7,density=True,label="Datos")
  12. plt.plot(x,y,'r--',label="PDF distribucion Normal ")
  13. plt.ylim(0,0.5)
  14. plt.ylabel('frequencia')
  15. plt.xlabel('valores')
  16. plt.title('Histograma - Variable aleatoria normal')
  17. plt.legend(loc="upper right")
  18. plt.show()
  19.  
  20. # -*- coding: utf-8 -*-
  21.  
  22. from matplotlib import rcParams
  23. import matplotlib.pyplot as plt
  24. import numpy as np
  25. import scipy.stats as st
  26.  
  27.  
  28. rcParams['font.family'] = 'sans-serif'
  29. rcParams['font.sans-serif'] = ['DejaVu Sans', 'Tahoma']
  30.  
  31.  
  32. mu, sigma = 0, 1.0 # media y desvio estandar
  33. datos = np.random.normal(mu, sigma, 10000) #creando muestra de datos
  34. x = np.linspace(-4, 4, num=1000)
  35. y = st.norm.pdf(x, 0, 1)
  36.  
  37.  
  38. plt.plot(x, y, 'r--', label=(u"μ={}, σ²={}".format(mu, sigma)))
  39. plt.legend(loc="upper right")
  40. plt.show()
  41.  
  42. import matplotlib.pyplot as plt
  43. import numpy as np
  44. import scipy.stats as st
  45.  
  46. mu, sigma = 0, 1.0 # media y desvio estandar
  47. datos = np.random.normal(mu, sigma, 10000) #creando muestra de datos
  48. x = np.linspace(-4, 4, num=1000)
  49. y = st.norm.pdf(x, 0, 1)
  50.  
  51.  
  52. plt.plot(x, y, 'r--', label=("$\mu$={}, $\sigma^2$={}".format(mu, sigma)))
  53. plt.legend(loc="upper right")
  54. plt.show()
Add Comment
Please, Sign In to add comment