还是一个喷泉的代码。MATLAB的
源代码在线查看: tu.m
function bb=abc(u,h,h0,pa,pw,d,r0,m,hh)
for i=1:50;
p=[0.0000008 0 0 0 1.19 -h];
s=roots(p);
h1=s(5,1);
v=sqrt(2*9.8*h);
t1=(v-sqrt(v^2-2*9.8*h1))/9.8;
vx=sqrt(v^2-2*9.8*h1);
t2=vx/9.8+sqrt((h0+h)/4.8);
y1=pa*t1*t1*u*u/(2*pw*3.14*d);
y2=pa*u*u*t1*t1/(pw*3.14*d);
r=3*pa*u*u*t2*t2/(16*pw*(r0-y1-y2));
q=3.14*d*d*sqrt(2*9.8*h)/4;
if(r v=0;
end
if(r>0.003)&(r hf=@fun;
p=quad(hf,0.003,r);
a=p*(3-r)^3/(p*(3-r)^3+(1-p)*(5-r)^3);
v=q*a;
end
if(r>=0.005)
v=q;
end
while(v>m)
h=h-hh;
p=[0.0000008 0 0 0 1.19 -h];
s=roots(p);
h1=s(5,1);
v=sqrt(2*9.8*h);
t1=(v-sqrt(v^2-2*9.8*h1))/9.8;
vx=sqrt(v^2-2*9.8*h1);
t2=vx/9.8+sqrt((h0+h)/4.8);
y1=pa*t1*t1*u*u/(2*pw*3.14*d);
y2=pa*u*u*t1*t1/(pw*3.14*d);
r=3*pa*u*u*t2*t2/(16*pw*(r0-y1-y2));
q=3.14*d*d*sqrt(2*9.8*h)/4;
if(r v=0;
end
if(r>0.003)&(r hf=@fun;
p=quad(hf,0.003,r);
a=p*(3-r)^3/(p*(3-r)^3+(1-p)*(5-r)^3);
v=q*a;
end
if(r>=0.005)
v=q;
end
end
u_shuzu(i)=u;
h_shuzu(i)=h;
u=u-02.;
end
u_shuzu1=0:0.05:10;
h_shuzu1=inter1(u_shuzu,h_shuzu1,'spline')
plot(u_shuzu1,h_shuzu1)
hold on