%Task1 % %Calculates the velocity and the discharge at a point given the channel %shape, roughness, and slope parameters. % %Author: Wendy Bohon with significant help from David Raleigh, Feb. 26, %2009. % INPUTS: width feet % depth feet % roughness feet % slope unitless % verbose 1 or 0 % OUTPUT discharge ft^3/sec %Roughness coefficient(n)=L^2 or just n^2 ; values off chart. %Hydralic Radius (R)= (w*d)/(w+2d) ; which is A/P %Q=discharge %roughness parameter n [L^1/6] %slope (s [dimensionless]) %hydralicRadius = area / wettedPerimeter; %This is the equation that determines velocity (v). velocity = %(1.49./roughness) .* hydralicRadius.^(2/3) .* slope.^(1/2) function [discharge velocity hydralicRadius] = task1(width , depth , roughness , slope , verbose) % if verbose you don't want to print out the statements if verbose == 0 %Wetted perimeter (P) = w+2d wettedPerimeter = width + 2 .* depth; %Hydralic Radius (R)= (w*d)/(w+2d) ; which is also A/P hydralicRadius = (width .* depth) ./ (width + 2 .* depth); % I have no idea where the unit of time comes from. velocity = (1.49./roughness) .* hydralicRadius.^(2/3) .* slope.^(1/2); % area channelArea = width .* depth; %area = width .* depth; discharge = velocity .* channelArea; % if verbose does not equal 0 you want to print out all your pretty statements elseif verbose ~= 0 %Wetted perimeter (P) = w+2d wettedPerimeter = width + 2 .* depth %Hydralic Radius (R)= (w*d)/(w+2d) ; which is also A/P hydralicRadius = (width .* depth) ./ (width + 2 .* depth) % I have no idea where the unit of time comes from. velocity = (1.49./roughness) .* hydralicRadius.^(2/3) .* slope.^(1/2) % area channelArea = width .* depth %area = width .* depth; discharge = velocity .* channelArea end