Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have this matlab code . It has a function which with input arguments the diameter d and the flow depth h of the horseshoe

i have this matlab code .It has a function which with input arguments the diameter d and the flow depth h of the horseshoe
cross section, returns the wetted perimeter P and the wetted cross-sectional area A. :function [P, A]= horseshoeFlow(d, h)
% Calculate h1
h1=(d./2).*(1-(1+(7^(1/2))/4));
if h >=0 && h < h1
% Case 1: 0<= h < h1
A =(h - d).*(h .*(2* d - h)).^(1/2)+ d.^2.*((sin((h - d)./d)).^(-1)+ pi/2);
Wetp =2* d .*(cos(1- h./d)).^(-1);
elseif h1<= h && h <(d/2)
% Case 2: h1<= h < diameter/2
h2=(d /2)- h1;
C1=1-(1+7^(1/2))/2;
C2= C1/2*(1-(1-(C1^2)/4).^(1/2))- sin(C1/2)^(-1);
A1=(h - d/2).*(h .*(d - h)).^(1/2)+(d^2/4).* sin((2* h - d)/ d).^(-1);
A2= d^2.*(C2+(sin(2* h - d)/(2* d)).^(-1))-(h - d/2).*(d -(d^2-(h - d/2)^2).^(1/2))+ A1;
Wetp1=2* d .*((cos((d -2* h)/(2* d))).^(-1)-(cos(-C1/2)).^(-1));
Wetp2=2* d .*((cos((d -2* h)/(2* d))).^(-1)-(cos(-C1/2)).^(-1))+ Wetp1;
A = A2;
Wetp = Wetp2;
elseif (d/2)<= h && h < d
% Case 3: diameter/2<= h < diameter
h3= d /2;
C1=1-(1+7^(1/2))/2;
C2= C1/2*(1-(1-(C1^2)/4).^(1/2))- sin(C1/2)^(-1);
A2=(h - d/2).*(h .*(d - h)).^(1/2)+(d^2/4).* sin((2* h - d)/ d).^(-1);
A3=(h - d/2).*(h .*(d - h)).^(1/2)+(d^2/4).* sin((2* h - d)/ d).^(-1)+ A2;
Wetp2=2* d .*((cos((d -2* h)/(2* d))).^(-1)-(cos(-C2/2)).^(-1));
Wetp3= d .*((cos(1-(2* h)/ d)).^(-1)- pi/2)+ Wetp2;
A = A3;
Wetp = Wetp3;
else
error('Invalid input for flow depth h.');
end
% Calculate hydraulic radius, velocity, and flow rate
Rh = A / Wetp;
V =(1/ n)* Rh^(2/3)*(s)^(1/2);
Q = V * A;
% Output wetted perimeter and cross-sectional area
P = Wetp;
A = A;
end
how can I make a code that reads the diameter,depth(h),manning,slope and discharge from .dat files? for exmple this one named mix1.dat:MANNING: 0.016
DIAMETER: 1.0 #m
SLOPE: 0.5 # per cent (actual slope is 0.005)
DEPTH1: 0.4 #m
DISCHARGE1: 0.6 #m3/sec
It has to read other dat files too they are smilar but the have different orders fot the data
thanks! !!IN MATLAB CODE PLEASE!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

How might HR technology affect the various HR functions?

Answered: 1 week ago