
Hi all I want to obtain a normal fit from a set of data obtained from experimental results. Since i am starting with python, I dont know where to start. Here's my experimental data. Its a particle size distribution. I want to obtain mean and std. x is the size and y the frequency.
Thank you in advance for any help!
import matplotlib.pyplot as plt
import numpy as np
x=([0.251839516,0.490440575,0.744647994,0.990643452,1.244142316,1.488611658,1.741274792,1.986416351,2.232538986,2.495993944,2.736393641,2.985059803,3.241792581,3.497435276,3.744829674,3.991788039,4.23860106])
y=([0.271164269,0.492366389,1.256781226,2.468772142,4.479769871,8.376708554,11.85803482,14.57231794,15.56056321,14.05547313,11.11227252,7.625604845,3.947070401,2.186355791,0.937144587,0.455061317,0.228687358])
plt.scatter(x,y,color='red',label='Experiment')
If you want to use SciPy you have scipy.stats.norm:
from scipy.stats import norm
mu, std = norm.fit(data)
use this code
from scipy.stats import norm as normalDist
x=([0.251839516,0.490440575,0.744647994,0.990643452,1.244142316,1.488611658,1.741274792,1.986416351,2.232538986,2.495993944,2.736393641,2.985059803,3.241792581,3.497435276,3.744829674,3.991788039,4.23860106])
y=([0.271164269,0.492366389,1.256781226,2.468772142,4.479769871,8.376708554,11.85803482,14.57231794,15.56056321,14.05547313,11.11227252,7.625604845,3.947070401,2.186355791,0.937144587,0.455061317,0.228687358])
points = list(zip(*(x, y)))
mu, std = normalDist.fit(points)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With