{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW_4 - file called max_min.m(25 points 2 Darcy’s Law is...

Info icon This 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
Image of page 1

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

View Full Document Right Arrow Icon
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. Darcy’s 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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern