PDA

查看完整版本 : 【求助】非线性最小二乘法拟合 双参数函数


紫佈拉吉
2008-02-17, 00:11
:sweat: 疯了疯了,实在不明白。
我用 xi是组数据,Fn是该数据的经验分布
beta0初值也设定
beta = nlinfit(xi,Fn,fun,beta0)
要拟合的是 一个双参数的gamma分布,而matlab的gamma函数是一个参数的,gamcdf倒是双参数的累加分布,但是不太懂gamcdf能调用出来么?自己不太会编写函数。
能用beta = nlinfit(xi,Fn,@gamcdf,beta0)吗?
错误
??? Error using ==> nlinfit at 123-----------------
【 error('stats:nlinfit:ModelFunctionError',...
['The model function ''%s'' generated the following ', ...
'error:\n%s'], func2str(model),errMsg);】


The model function 'gamcdf' generated the following error:
Error using ==> gamcdf at 66
Non-scalar arguments must match in size.


请各位指教下。自己摸索的,实在不懂。

紫佈拉吉
2008-02-17, 00:16
我知道一定是函数错了,不能用 gamcdf,可是如果想直接引用这个双参数的伽玛分布的分布函数,应该怎么做呢??