Must be in Matlab Coding! Thankyou 2- Manning\'s equation can be used to compute
ID: 3717321 • Letter: M
Question
Must be in Matlab Coding! Thankyou
2- Manning's equation can be used to compute the velocity of water in a rectangular open channel B+Where y- velocity (m/s,S- channel slope, n roughness coeffient, B- width (m), and H-depth m). The following data is available for five channels: Write a function called Channel that computes the velocity for each of these channels. The data should be input as a matrix when you called the function. The output should be a matrix with a fifth column containing the velocities. Your function should work for a matrix containing data for any number of channels not just these five channels. The results for the given data: 0.035 0.0001 10 2 0.020 0.0002 8 1 0.015 0.0010 20 1.5 0.030 0.022 0.0003 15 2.5 0.0007 24 3 0.0350 0.0001 10.0000 2.0000 0.3624 0.0200 0.0002 8.0000 1.0000 0.6094 0.0150 0.0010 20.0000 1.5000 2.5167 0.0300 0.0007 24.0000 3.0000 1.5809 0.0220 0.0003 15.0000 2.5000 1.1971Explanation / Answer
------------------------Channel.m--------------------
function [V] = Channel(arr)
V = arr;
% get the dimensions of arr
[n , m] = size(arr);
for i = 1 : n
% get the values from arr
n = arr(i , 1);
S = arr(i , 2);
B = arr(i , 3);
H = arr(i , 4);
% calculate the velocity
V(i , 5) = ( sqrt( S ) / n ) * ( ( ( B * H ) / ( B + ( 2 * H ) ) )^( 2 / 3 ) );
end
end
-------------------------main.m--------------------
arr = [ 0.035 , 0.0001 , 10 , 2 ; 0.020 , 0.0002 , 8 , 1 ; 0.015 , 0.001 , 20 , 1.5 ; 0.03 , 0.0007 , 24 , 3 ; 0.022 , 0.0003 , 15 , 2.5 ];
V = Channel( arr );
V
Sample Output
V =
0.0350 0.0001 10.0000 2.0000 0.3624
0.0200 0.0002 8.0000 1.0000 0.6094
0.0150 0.0010 20.0000 1.5000 2.5167
0.0300 0.0007 24.0000 3.0000 1.5809
0.0220 0.0003 15.0000 2.5000 1.197
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.