fitting a skew distribution

2 次查看(过去 30 天)
Victor Lim
Victor Lim 2015-5-23
I generated some data using a function representing a skew distribution (contains an error function). I try to fit the function using a starting point of the same variables to generate the data but the fit comes out wrong. Not sure why it doesn't fit correctly. Here is the code:
x = (-10:.01:20)';
var = [2 10 6 -0.45 ];
y = var(1)*exp(-(x-var(2)).^2/(var(3)^2)).*(1+erf((x-var(2))*var(4)));
ftype=fittype('a*exp(-(x-b)^2/c^2)*(1+erf(x-b)*d)','coeff',{'a','b','c','d'})
f=fit(x(:),y(:),ftype,'startpoint',var)
plot(f,x,y)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by