数据拟合-在c++中拟合正态分布到直方图
data fitting - fiitting a normal distribution to a histogram in C++
我正在研究c++中的频谱传感,直到现在我的问题是如何估计噪声的确切值。所以我做了数据的直方图,我想把高斯分布拟合到这个直方图上,然后我得到了这个拟合分布的均值,就像在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);
// now I need to fit this histogram by a normal distribution "Normal"
// and finally I get the mean of this distribution: normal.get_setup();
}
提前感谢您的帮助!
正态分布使得这很容易:
mean = sum(spectrum_sensed)/N
variance = sum((spectrum_sensed-mean)^2)/N
你不是拟合直方图,而是拟合数据。在正态分布的情况下,没有拟合,因为一切都是分析性的。
相关文章:
- 改变或缩放两个正态分布以具有特定的相关系数
- 从 C++ 函数与 Python 函数返回的不一致值用于偏斜正态分布
- 逆生存函数与正态分布的PPF(ICDF)?
- C 中高斯的随机正态分布
- C :实用程序名称空间中的正态分布
- MT19937和正态分布
- 生成C++中的正态分布随机数
- 如何从限于一定间隔的正态分布进行采样,即C 实现
- 带参数的累积正态分布函数的逆
- 在.h文件中声明正态分布生成器
- Box Muller Transform在实现正态分布PRNG时的问题
- 接受拒绝算法 C++ 正态分布
- 在C 中实现正态分布的统一比率
- 如何创建一个在单独的方法中工作的c++随机正态分布
- 如何在C++中随机采样具有给定平均值和标准误差的正态分布
- C++中对数正态分布的累积函数的逆
- C++生成范围内服从正态分布的随机数
- 在 gmp 任意精度上生成正态分布
- 如何计算 CDF C++中正态分布概率
- 数据拟合-在c++中拟合正态分布到直方图