有没有大神会中突发失效的利用MTLAB中的fminsearch函数对比例危险模型突发失效似然函数进行求解。我写了程序有错误求指教function ml = likelihood(param)t1=[5 5.5 7 7 7 7.5];
yt1=[20.47065 22.84195 30.14247 30.14247 30.14247 32.63146];
mu =3.216;sigma =0.032;c =1.150;D=33;L=0;
global t yt
function f1=fun11(t)
f1 =(param(1)./param(2)).*(t./param(2)).^(param(1)-1).*exp(param(3).*yt)...
.*(1./sqrt(2*pi*sigma.^2.*(t.^c)))...
.*exp(-((yt-mu*t.^c).^2)./(2.*(sigma.^2).*(t.^c)));
end
function f2=fun22(yt,t)
f2 =(param(1)./param(2)).*(t./param(2)).^(param(1)-1).*exp(param(3).*yt)...
.*(1./sqrt(2*pi*sigma.^2.*(t.^c)))...
.*exp(-((yt-mu*t.^c).^2)./(2.*(sigma.^2).*(t.^c)));
end
for i=1:6
t=t1(i);yt=yt1(i);
L=L+log(integral(@fun11,0,D).*exp(-quad2d(@fun22,0,D,0,5)));
end
ml = -L;
end
x0 =[0 0 0.25]
[x,fval] = fminsearch(@likelihood,x0,optimset('TolX',1e-19,'MaxFunEvals',1000,'MaxIter',1000))