fitting a skew distribution
조회 수: 7 (최근 30일)
이전 댓글 표시
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 Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!