data fitting - fiitting a normal distribution to a histogram in C++ -


i working on spectrum sensing in c++ , problem until how estimate exact value of noise. did histogram of data , want fit gaussian distribution histogram , have mean of fitting distribution in matlab [mean,variance]=normfit(x).

vec noise::gauss_fit(vec spectrum_sensed,int nfft) {     histogram<double> hist;     hist.setup(min(spectrum_sensed),max(spectrum_sensed),nfft);     // need fit histogram normal distribution "normal"     // , mean of distribution: normal.get_setup(); } 

thanks in advance help!

the normal distribution makes quite easy:

mean = sum(spectrum_sensed)/n  variance = sum((spectrum_sensed-mean)^2)/n 

you don't fit histogram, fit data. , in case of normal distribution, there's no fitting involved analytical.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -