Answer to Question #250187 in Electrical Engineering for Mangi

Question #250187
Derive discharge coefficient
1
Expert's answer
2021-10-13T04:57:16-0400

Function 'calFlowRate' :-

function [Q] = calFlowRate(Cd, theta, h)

%Converting angles into radians

theta = theta.*(pi()/180);

  

g = 9.81;

%l_Cd is the length of the vector Cd

l_Cd= length(Cd);

  

%Initializing the discharge matrix which size is same as size of Cd

Q = zeros(l_Cd,1);  


%Using for loop to calculate discharge for corresponding Cd,theta and h

  

for i = 1:l_Cd

%Computing discharge by formula of V notch

Q(i,1) = (8/15)*Cd(i)*((h(i))^2.5)*sqrt(2*g)*tan(theta(i)/2);

  

end

  

end

Script 'LastnameLabProb1' :-

%defining our Cd, theta and h matrices

Cd = [0.52, 0.82];

theta = [60, 45];

h = [1.7, 3.4];

%Calling the function calFlowRate to calculate the discharge

Q = calFlowRate(Cd,theta,h);

%Displaying the discharge matrix

disp('Discharge matrix = ');

disp(Q);

First, copy the code of function in MATLAB editor and save it.

Then copy the code of script in another window of the editor and save the run it.

The output of the given problem is

Discharge matrix =

2.6725

17.1034


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS