算法设计与编程
下面利用数学软件MATLAB对水流速度进行计算.
t1=[0 0.921 1.843 2.949 3.871 4.978 5.900 7.006 7.928 8.967];
h1=[9.677 9.479 9.308 9.125 8.982 8.814 8.686 8.525 8.388 8.220];
V1=pi.*17.4.^2.*h1./4;
dV1=-gradient(V1,t1);
t2=[10.594 12.032 12.954 13.875 14.985 15.903 16.826 17.931 19.037 19.959 20.839];
h2=[10.820 10.500 10.210 9.936 9.653 9.409 9.180 8.921 8.662 8.433 8.220];
V2=pi.*17.4.^2.*h2./4;
dV2=-gradient(V2,t2);
t3=[22.958 23.880 24.986 25.908];
h3=[10.820 10.591 10.354 10.180];
V3=pi.*17.4.^2.*h3./4;
dV3=-gradient(V3,t3);
t4=[t1 t2 t3];
V4=[dV1 dV2 dV3];
t=0:0.001:25.908;
V=interp1 (t4,V4,t,'spline');
plot (t4,V4,'+',t,V)