PGE 310 - HW3 -Solution

PGE 310 - HW3 -Solution - The University of Texas at Austin...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 The University of Texas at Austin PGE 310: Formulation and Solution in Geosystems Engineering Homework #3: Functions and Loops in MATLAB SOLUTION By HosseinRoodi 1. In each of the following, write I. The first line (by hand) of the MATLAB function file that would do the assigned task. II. The command (by hand) to call the function file from the interactive mode. a. I) A function called Manning.m that when sent the coefficient of roughness (n), the slope of water surface (S) and the hydraulic radius(R) , the velocity of water (V) is returned. function V= Manning(n,S,R) II) Call the function when the hydraulic radius is 5 and the slope of water surface is 0.0001 and coefficient of roughness is 0.05 and store the result in a variable called velwat . velwat= Manning(0.05,0.0001,5) b. I) A function called random_gen.m that returns three random numbers called a, b and c without sending any input. function [a,b,c]= random_gen II) Call the function in a single line, and store returned random numbers in rnd1 , rnd2 and rnd3 [rnd1,rnd2,rnd3]= random_gen c. I) A function called hydraulic.m that returns the cross sectional area of flow (acs), wetted perimeter of channel (p) and hydraulic radius (rh) when sent the channel width (b),
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/12/2011 for the course PGE 310 taught by Professor Klaus during the Spring '06 term at University of Texas.

Page1 / 7

PGE 310 - HW3 -Solution - The University of Texas at Austin...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online