HW_4 - file called max_min.m. (25 points) 2. Darcys Law is...

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

View Full Document Right Arrow Icon
PGE 310: Numerical Methods with Matlab Homework #4 Due Feb 26 2009 *** Important notes about this and all future homework*** You must turn in a hard copy of all ‘.m’ files and any plots/results in the command window. Additionally, you must upload electronic versions of .m files to blackboard. We will randomly select a few each week and check to see if they run. Be sure to include lots of comments, a prologue (see book/pp notes) for function files, and meaningful variable names in all .m files. 1. (a) Create a function file, called max_min.m that went sent a vector “x” it returns to find the maximum and minimum value of the vector. In the command window, create two different vectors (or different lengths) and call the function file to show it works. (25 points) (b) Now, refer to the CorvRain.dat file we did in class, and write a script file that reads in data file, makes a plot of April rainfall versus year, and then prints the maximum and minimum rainfall for April. To do this, you must call your function
Background image of page 1

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

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

Unformatted text preview: file called max_min.m. (25 points) 2. Darcys Law is an expression that relates the velocity of a fluid to pressured gradient in a porous medium. It can be expressed as ( 29 ( 29 2 ` 1 2 1 x x p p k v--= , or ( 29 2 1 1 2 x x k v p p--= . (a) Write a function file called darcy.m that calculates p 2 given x 1 , x 2 , p 1 , k, and v. Call your function file in command window, to make sure it works for different inputs. (25 points) (b) We are interested in the pressure values at x=1,4,6,7. We now have the information below: k=1 x 10-7 , =2, q=2 for every point at x=1, p=1000 write a script file using the function file created in (a) to calculate the pressure value at x=4,6,7. (hint: pressure at x=6 is determined by pressure at x=4, so you need to calculate pressure at x=4 before you calculate the pressure at x=6. in other words, you need to use a loop to call your function file to complete the calculation at every step. (25 points)...
View Full Document

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

Page1 / 2

HW_4 - file called max_min.m. (25 points) 2. Darcys Law is...

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