紧急!求助!我正在利用matlab建立三维copula函数模型,正利用极大似然估计方法估计copula函数中的参数,但是卡在这里了。这个似然函数非常的长
下面是我的程序:function siranhanshu=myfun(theta,U,V,W,Xpdf,Ypdf,Zpdf)h=(theta^2*(1/theta + 1)*(1/theta + 2))/(U(:).^(theta + 1)*V(:).^(theta +1)*W(:).^(theta + 1)*(1/U(:).^theta + 1/V(:).^theta + 1/W(:).^theta - 2)^(1/theta +3))*Xpdf*Ypdf*Zpdf;
k=prod(h);
siranhanshu=0-log(k);
然后我再命令窗口键入
%在命令窗口输入
[theta,fval]=fminsearch(@(theta) myfun(theta,U,V,W,Xpdf,Ypdf,Zpdf),5.000000001)
其中U,V,W,Xpdf,Ypdf,Zpdf是程序中也求出来的一列多行的矩阵
运行以后报错
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
Error in myfun (line 3)
h=(theta^2*(1/theta + 1)*(1/theta + 2))/(U^(theta + 1)*V^(theta
+1)*W^(theta + 1)*(1/U^theta + 1/V^theta + 1/W^theta - 2)^(1/theta
+3))*Xpdf*Ypdf*Zpdf;
Error in @(theta)myfun(theta,U,V,W,Xpdf,Ypdf,Zpdf)
Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});
Error in P_ET0_IR (line 131)
[theta,fval]=fminsearch(@(theta)
myfun(theta,U,V,W,Xpdf,Ypdf,Zpdf),5.000000001)
而且警告Warning: The value of local variables may have been changed to match the
globals. Future versions of MATLAB will require that you declare
a variable to be global before you use that variable.
> In myfun at 2
In @(theta)myfun(theta,U,V,W,Xpdf,Ypdf,Zpdf)
In fminsearch at 191
In P_ET0_IR at 131
新手上路,能否给予指点!谢谢!