|
楼主 |
发表于 2006-5-20 16:49
|
显示全部楼层
回复:(happy)回复:(haode123)[原创]哪位高手帮一...
<P>原函数程序如下:<BR>function [f,g]=fun_zheng(x)<BR>a=x(1);<BR>b=x(2);<BR>c=x(3);<BR>d=x(4);<BR>e=x(5);<BR>[qz,qf]=weibull_plot_double('E:\data\pd\hunhe\fengzhi.txt',0);<BR>qz=qz(find(qz>0));<BR>f=-sum(log(x(5)*(x(1)/x(2))*(qz./x(2)).^(x(1)-1).*exp(-(qz./x(2)).^x(1))))-sum(log((1-x(5))*(x(3)/x(4))*(qz./x(4)).^(x(3)-1).*exp(-(qz./x(4)).^x(3))));<BR><BR>主程序如下:<BR>function [b1,a1,b2,a2,p]=double_canshu_zheng(file,b10,b20,p0)<BR>[qz,fz,qf,ff]=weibull_plot_double(file,0);<BR>a10=qz(find(fz>=0.632*p0));<BR>a20=qz(find(fz>=0.632*(p0-1)+p0));<BR>a10=a10(1);<BR>a20=a20(1);<BR>x0=[b10,a10,b20,a20,p0];<BR>A=[];<BR>b=[];<BR>Aeq=[];<BR>beq=[];<BR>lb=[0.01,0.01,0.01,0.01,0.01];<BR>ub=[inf,inf,inf,inf,0.99];<BR>%options=optimset('GradObj','on');<BR>%options=optimset('largescale','off','display','iter');<BR>[x,fval]=fmincon(@fun_zheng,x0,A,b,Aeq,beq,lb,ub,@mycon_zheng,options);<BR>b1=x(1)<BR>a1=x(2)<BR>b2=x(3)<BR>a2=x(4)<BR>p=x(5)</P> |
|