'This program is for determining the normal depth, and critical depth for   Constant flow only'
%Manning eq;  Q=1/n A^(5/3) So^(0.5) / P^(2/3)

'Input the following data'
% the input is numerical numbers 
b=input ('Bottom base=?');
n=input ('roughness factor=?');
So=input ('drainage slope=?');
Q=input ('flow rate=?');
g= input(' gravity g=?');


%1) 
%convert above numbers to strings: ' '
sb = num2str (b);
sn = num2str (n);
sSo = num2str (So);
sQ = num2str (Q);
sg = num2str (g);

%pause

A = ['( ' sb '*x)^(5/3)'];
P = ['(' sb '+2*x)^(2/3)'];
So = [sSo '^0.5'];

' here is the fuction'
F=['1/' sn '*' A '*' So '/' P '-' sQ]

'to find normal depth, press enter'

pause

normaldepth = fzero(F,3)

%2) for critical depth yc. do it in numbers;  use ';' so it not shown 
'to find critical depth, press enter'
pause

sa = (Q/b)^2; 
crtdepth = (sa/g)^(1/3)
   

