为什么用fittype函数自定义正态分布密度函数去进行拟合,估计出来的参数和用normfit估计出来的参数,相差特别多呢?。
Show older comments
如题,为什么用fittype函数自定义正态分布密度函数去进行拟合,所估计出来的参数和用normfit估计出来的参数,相差特别多呢?
代码如下,第一个
data=textread('E:\残差值\news.txt');
[m,n]=size(data);
x=reshape(data,m*n,1);
[yi,xi]=ksdensity(x);
normm=fittype(@(c,d,x) 0.39894228.*exp(-0.5.*(x-c).^2/d.^2)/d);
normmfit=fit(xi',yi',normm);
c=normmfit.c;
d=normmfit.d;
第二个
data=textread('E:\残差值\news.txt');
[m,n]=size(data);
x=reshape(data,m*n,1);
[a,b]=normfit(x);
Accepted Answer
More Answers (0)
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!