function [v,q] = vanq(w,d,n,s) %[v,q] = vanq(w,d,n,s) %This function determines the velocity (v) and discharge (q) %at a point in a channel using the Manning equation %for velocity given these independent variables for a rectangular %channel with a single roughness (English Units): % w = width of channel (feet) % d = depth of channel (feet) % s = channel local slope in rise/run % n = mannings roughness coefficient in ft^1/6 % see http://geology.asu.edu/~glg410/Labs/manning.html % Internal variables: % a = channel cross-sectional area % p = wetted perimeter (2w + d) % r = hydraulic radius (a/p) %JRA, 11/29/1999 %write parameters fprintf('Channel width is %.3f feet, depth is %.3f feet, slope is %.5f, and n is %.3f\n', w,d,s,n); %calculate internal variables a = w*d; p = (2*d+w); r = (a/p); fprintf('Channel area is %.3f feet^2, wetted perimeter is %.3f feet, and the hydraulic radius is %.3f feet\n',a,p,r); %calculate velocity and discharge; v = ((1.49/n)*(r^(2/3))*(s^(1/2))); q = v*a; fprintf('Flow velocity is %.3f ft/sec, and discharge is %.3f cfs\n',v,q);