a6_cee3804_2011_sol

# a6_cee3804_2011_sol - CEE 3804: Computer Applications in...

This preview shows pages 1–4. Sign up to view the full content.

CEE 3804: Computer Applications in Civil Engineering Spring 2011 Assignment 6: Matlab Functions Date Due: Solutions Instructor: Trani Problem 1 A civil engineer is designing a rainstorm water management system for a shopping mall. During a severe thunderstorm, the water runoff generated by the large parking lot at the shopping mall is given by the function: runoff = k 2 + k 1 sin( t / k 3 ) e ( t / k 4 ) Where runoff is the runoff volume (cubic meters per second) generated by the parking lot, t is the time (in seconds) after the thunderstorm starts and k 1 through k 4 are parameters of the runoff function. Task 1 Create a Matlab function to calculate the runoff for a given value of time t. As part of the input variables to the function runoff, include the four input parameters k1 through k4 for a 100 year storm with numerical values as follows: k1 = 50; k2 = 2; k3 = 1500; k4 = 800; ________________________ % Function to estimate runoff volume at a shopping mall function [runoff] = function_Runoff(k1,k2,k3,k4,t) % runoff is the runoff volume (cubic meters per second) % generated by the shopping mall into the ponding area % t is the time (in seconds) after the thunderstorm starts % k1, k2, k3 and k4 are model coef±cients. runoff = k1 * sin(t/k3) .* exp(-t/k4) + k2; ________________________ Task 2 Create a Matlab script to call the function created in Task 1. Test the function for values of time (t) starting at t=0 and ending at t=4500 seconds. Plot the runoff as a function of time. Label appropriately. In your plot use the following plot attributes: a) Marker of plotted values = square b) Line type = dashed black line (10 point) ________________________ % Function to call the function runoff volume at a shopping mall CEE 3804 Trani Page 1 of 13

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

View Full Document
% Ponding volume at a shopping mall % Calls function Runoff clc clear % qRunoff is the runoff volume (cubic meters per second) % generated by the shopping mall into the ponding area % t is the time (in seconds) after the thunderstorm starts k1 = 50; % multiplicative parameter of the function k2 = 2; % additive parameter of the function k3 = 1500; % parameter of sinusoidal term k4 = 800; % parameter of exponential term tLast = 4500; % Fnal time to do the calculation t=1:1:tLast; % create an array with values of time qRunoff(t) = function_Runoff(k1,k2,k3,k4,t); % Make a nice plot Fgure plot(t,qRunoff, 'o' ) xlabel( 'Time (seconds)' ) ylabel( 'Volume (cu. meters/second)' ) grid % Make a plot of the derivative of runoff derQin = gradient(qRunoff); Fgure plot(t,derQin, '^' ) xlabel( 'Time (seconds)' ) ylabel( 'Gradient of qRunoff (cu. meters/second^2)' ) grid CEE 3804 Trani Page 2 of 13
Figure 1. Runoff Function. _______________________ Task 3 Modify the Matlab script created in Task 2 to find the area under the curve of the runoff as a function of time. Use the Matlab “quad” function to estimate the integral. Plot the results and output the result of the area under the curve in the command window using the “disp” function in Matlab. How much runoff is produced in the 4500 second storm event? State the units of the answer.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/01/2012 for the course CEE 3804 taught by Professor Aatrani during the Spring '07 term at Virginia Tech.

### Page1 / 13

a6_cee3804_2011_sol - CEE 3804: Computer Applications in...

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

View Full Document
Ask a homework question - tutors are online