捕鱼问题源代码
源代码在线查看: myfun1.m
function f=myfun1(k)
f=(17.86*0.42*k*(1-exp(-(0.8+0.42*k)*2/3))/(0.8+0.42*k)+exp(-0.8-0.42*2*k/3)*22.99*k*(1-exp(-(0.8+k)*2/3))/(1-exp(-0.8-2*k/3))/(0.8+k))*1.22*exp(-1.6)/(1+1/(1.109e5*(0.5+1/(exp(0.8+2*k/3)-1))*exp(-(6.4+0.42*2*k)/3)-1));
r=0.8;
%{
kmax=17.362917339999999200017555267550;
k=0
31.392513072061475852111566099358;
n=0.5*1.109e5*N3*exp(-(0.42*k+r)*2/3)+1.109e5*N4*exp(-(k+r)*2/3);
N1=(1.22e11*n)/(1.22e11+n);
N2=exp(-r)*N1;
N3=exp(-r)*N2;
N4=N3*exp(-(0.42*k*2/3+r))+N4*exp(-(k*2/3+r));
%}
n=(1.109e5*(0.5+1/(exp(0.8+2*k/3)-1))*exp(-(6.4+0.42*2*k)/3)-1)*1.22e11
N1=1.22e11*n/(1.22e11+n)
N2=exp(-r)*N1
N3=exp(-2*r)*N1
N4=exp(-0.42*2*k/3)/(1-exp(-r-2*k/3))*exp(-3*r)*N1
%{
[n,N1,N2,N3,N4]=solve('n=0.5*1.109e5*N3*exp(-(0.42*k+r)*2/3)+1.109e5*N4*exp(-(k+r)*2/3)','N1=(1.22e11*n)/(1.22e11)','N2=exp(-r)*N1','N3=exp(-r)*N2','N4=N3*exp(-(0.42*k*2/3+r))+N4*exp(-(k*2/3+r))')
n=length(k);
p=zeros(1,n);
for i=1:n
p(i)=myfun1(k(i));
end
[fval,pos]=max(p);
k=vpa(k(pos));
%}