'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test I. Rebecca A. Simmons & Michael R. Gustafson II

Similar documents
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2 Solutions. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test III. Rebecca A. Simmons & Michael R. Gustafson II

Test 2 Solutions - Python Edition

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 224 Spring Test II. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. ECE 110 Fall Test II. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. ECE 110 Fall Test I. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 224 Spring Test II. Michael R. Gustafson II

Test II Michael R. Gustafson II

Test 2 - Python Edition

Companion. Jeffrey E. Jones

Chapter 1 Linear Equations. 1.1 Systems of Linear Equations

LAB 1: MATLAB - Introduction to Programming. Objective:

New Mexico Tech Hyd 510

ENGR Spring Exam 2

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

Project 2: Using linear systems for numerical solution of boundary value problems

MATH 1040 Test 2 Spring 2016 Version A QP 16, 17, 20, 25, Calc 1.5, 1.6, , App D. Student s Printed Name:

On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from

Name: Math 1120, Final. December 12, Net id: PLACE AN X IN THE BOX TO INDICATE YOUR SECTION

Test 2 Version B. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

Identity Matrix: EDU> eye(3) ans = Matrix of Ones: EDU> ones(2,3) ans =

L3: Review of linear algebra and MATLAB

By providing my signature below I acknowledge that this is my work, and I did not get any help from anyone else:

Section Summary. Definition of a Function.

CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 3: Diagonalization & Halting Problem Due: One week after shown in slides

Spis treści Contents List of Examples Preface to Third Edition 21

Investigating Limits in MATLAB

Linear Algebra Using MATLAB

Test 3 Version A. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

MthSc 107 Test 1 Spring 2013 Version A Student s Printed Name: CUID:

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

Project One: C Bump functions

Matrix Basic Concepts

DETAILED SOLUTIONS AND CONCEPTS - SEQUENCES AND SERIES

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

Phasor mathematics. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

9.1 SEQUENCES AND SERIES

Chapter 2: Numeric, Cell, and Structure Arrays

August 7, 2007 NUMERICAL SOLUTION OF LAPLACE'S EQUATION

ORF 523 Final Exam, Spring 2016

Lab 13: Ordinary Differential Equations

Biostatistics Student Seminar An Introduction To L A T E X

MITOCW MITRES2_002S10nonlinear_lec05_300k-mp4

EGR 111 Heat Transfer

The Geodatabase Working with Spatial Analyst. Calculating Elevation and Slope Values for Forested Roads, Streams, and Stands.

EEE161 Applied Electromagnetics Laboratory 1

Without fully opening the exam, check that you have pages 1 through 11.

ORF 363/COS 323 Final Exam, Fall 2015

Lynch 2017 Page 1 of 5. Math 150, Fall 2017 Exam 1 Form A Multiple Choice

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

DISCRETE RANDOM VARIABLES EXCEL LAB #3

Designing Information Devices and Systems I Fall 2017 Homework 3

1 Introduction & Objective

CS 221 Lecture 9. Tuesday, 1 November 2011

Using Microsoft Excel

TOPIC 2 Computer application for manipulating matrix using MATLAB

Linear Motion with Constant Acceleration

4:3 LEC - PLANNED COMPARISONS AND REGRESSION ANALYSES

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

Hour Exam #1 Math 3 Oct. 20, 2010

Read this before starting!

Student s Printed Name:

Chapter 4 Sequences and Series

CSCE 155N Fall Homework Assignment 2: Stress-Strain Curve. Assigned: September 11, 2012 Due: October 02, 2012

MA 262, Fall 2017, Final Version 01(Green)

6A Lab Post-test. Instructions for printed version. Week 10, Fall 2016

Math 1310 Final Exam

MTH 234 Exam 1 February 20th, Without fully opening the exam, check that you have pages 1 through 11.

Lab 6: Linear Algebra

Matlab Section. November 8, 2005

At the end of the exam you must copy that folder onto a USB stick. Also, you must your files to the instructor.

Maple for Math Majors. 3. Solving Equations

MAT 343 Laboratory 6 The SVD decomposition and Image Compression

Remember that C is a constant and ë and n are variables. This equation now fits the template of a straight line:

Test 3 Version A. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional)

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,

Number Theory: Representations of Integers

Chapter 14: Finding the Equilibrium Solution and Exploring the Nature of the Equilibration Process

Experimental Uncertainty (Error) and Data Analysis

MthSc 107 Test 1 Spring 2013 Version A Student s Printed Name: CUID:

Octave. Tutorial. Daniel Lamprecht. March 26, Graz University of Technology. Slides based on previous work by Ingo Holzmann

MATH 19B FINAL EXAM PROBABILITY REVIEW PROBLEMS SPRING, 2010

Student s Printed Name: KEY_&_Grading Guidelines_CUID:

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations.

Linear Equations. Find the domain and the range of the following set. {(4,5), (7,8), (-1,3), (3,3), (2,-3)}

PHYS 114 Exam 1 Answer Key NAME:

Fin System, Inc. Company Report. Temperature Profile Calculators. Team 1 J. C. Stewards, Lead A. B. Williams, Documentation M. D.

Assignment 6, Math 575A

Problem 1 (10 points)

1. Type your solutions. This homework is mainly a programming assignment.

FIT100 Spring 01. Project 2. Astrological Toys

Package AMA. October 27, 2010

Student s Printed Name:

8-15. Stop by or call (630)

STUDENT NAME: STUDENT SIGNATURE: STUDENT ID NUMBER: SECTION NUMBER RECITATION INSTRUCTOR:

Lab Activity: The Central Limit Theorem


Transcription:

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 53L Fall 2008 Test I Rebecca A. Simmons & Michael R. Gustafson II Name (please print) In keeping with the Community Standard, I have neither provided nor received any assistance on this test. I understand if it is later determined that I gave or received assistance, I will be brought before the Undergraduate Judicial Board and, if found responsible for academic dishonesty or academic contempt, fail the class. I also understand that I am not allowed to speak to anyone except the instructor about any aspect of this test until the instructor announces it is allowed. I understand if it is later determined that I did speak to another person about the test before the instructor said it was allowed, I will be brought before the Undergraduate Judicial Board and, if found responsible for academic dishonesty or academic contempt, fail the class. Signature: Problem I: 0 pts. Basic Programming Write all the MATLAB statements required to plot sin(x) versus cos(2x) from 0 to 2π in steps of π/0. The points should be connected by a black dotted line and each point should be marked with a black square marker. You do not need to label or title your plot, nor do you need to save it. x = 0:pi/0:2*pi; plot(cos(2*x), sin(x), k:s ); Write an anonymous function to solve for the distance d between two points (x, y ) and (x 2, y 2 ) on a Cartesian coordinate plane. Note that the distance can be given by: d = (x 2 x ) 2 + (y 2 y ) 2 Then, show the command used to have your function calculate the distance between a point (0.2, 0.4) and a point (0., 0.8). % Have d as a four-input anonymous function d = @(x, y, x2, y2) sqrt( (x2-x).^2 + (y2-y).^2 ) Distance = d(0.2, 0.4, 0., 0.8) % OR - have each point entered as a x2 matrix d = @(p, p2) sqrt( (p2()-p()).^2 + (p2(2)-p(2)).^2 ) Distance = d(0.2, 0.4, 0., 0.8)

Problem II: 20 pts. Matrix Creation and Manipulation For each of the following sections, show what the matrices A, B, and C will look like at the of the snippet of code. (a) >> clear >>A(3, 3) = 7 >>B = A(3 2, 3 3) >>C = B (b) >>A=- 2; 20 5; 3 6 >>B=eye(2,3) >>C=A.*B A = 0 0 0 0 0 0 B = 7 7 0 0 C = 0 0 7 0 0 7 0 0 7 0 0 (c) A = 20 3 2 5 6 >>A=.6, -2.8; -4.2, 0.8 >>B=fix(A) >>C=floor(A) B = 0 0 0 0 C = 0 0 0 5 0 A =.6 2.8 4.2 0.8 B = 2 4 0 C = 3 5 0 (d) >>A = zeros(, 3); ones(, 3); zeros(3, ) >>B = A(2:5) >>C = A(:2, 2:) (e) >>A=linspace(-3, 3, 7) >>B=logspace(-3, 3, 7) >>C=length(A) * size(b) A = 0 0 0 B = 0 0 C = 0 0 0 0 0 A = 3 2 0 2 3 B = 0.00 0.0 0. 0 00 000 C = 7 49

Problem III: 20 pts. Managing the Nitrogen Cycle One of the Grand Challenges for Engineering involves managing the nitrogen cycle. To do this, you must first understand how the nitrogen cycle works. A paper on modeling gives the following equation for the mineralization rate f as a function of the water content θ (Greek letter theta): ( 0 θ θ W θ θw θ W θ θ L f(θ) = θ L θ W ) m ( ) θ L θ θ H m f s + ( f s ) θs θ θ θh S θ H θ θ S and states that m is an empirical constant, θ S is the saturated water content, θ W is water content below which no activity is possible, and f S is rate at soil saturation. θ L and θ H are constants describing the lower and upper boundaries of some optimal water content range. Basically, this means that m, θ S, θ W, θ L, θ H, and f S are all constants. Your first job is to write a function file that uses logical masks to take seven inputs (θ, m, θ S, θ W, θ L, θ H, and f S ) and return the appropriate mineralization rate. Only θ will be an array - all other values will be x constant matrices. Your second job will be to write a script that plots f as a function of θ assuming: m = 0.75 θ S = 0.494 θ W = 0.5 θ L = 0.3 θ H = 0.39 f S =.5 Your θ values should go from 0 to θ S and there should be 00 points to make the graph. You do not need to add a title or labels to this plot. Use a black solid line for this graph. Function: function f_out = NCycle(t, m, ts, tw, tl, th, fs) f_out =... (t<=tw).* (0) +... (tw<t & t<=tl).* (((t-tw)./(tl-tw)).^m) +... (tl<t & t<=th).* () +... (th<t & t<=ts).* (fs + (-fs).*((ts-t)./(ts-th)).^m); Script (first line already done for you): m=0.75; thetas=0.494; thetaw=0.5; thetal=0.3; thetah=0.39; fs=.5; theta = linspace(0, thetas, 00); f = NCycle(theta, m, thetas, thetaw, thetal, thetah, fs); plot(theta, f, k- ) Modelling water flow, nitrogen transport and root uptake including physical non-equilibrium and optimization of the root water potential. F. Lafolie. Fertilizer Research, Kluwer Academic Publishers. Vol 27, pp. 25-23. 99.

Problem IV: 25 pts. Advancing Health Informatics One of the Grand Challenges for Engineering is to advance health informatics. In this problem, you will be doing that by helping to write an analysis and filing system for health data. A data set containing a rectangular array of blood pressure values has been saved, as a text file, to BP.data, and you have copied this file to your current working directory. You will be writing a script to load the data, process it, then potentially save the processed data into a MATLAB file. The original data file can be any size between x to 0x2 (and any rectangular size in between). Start your script by loading the data. First, calculate the average of all the data in the matrix and store it in a matrix called AvgPressure. Next, calculate the highest value for all the data and store it in a matrix called HighBP. Once you have generated those two entries, you will report them back to the user in the following formatted way: Average Pressure: NNN.NN Highest Pressure: NNN.NN where the N s represent locations where the pressures will print out. For example, if the average is calculated as 97.2343 and the high is 82.68234, the program should produce: Average Pressure: 97.23 Highest Pressure: 82.68 Your program must properly line up the numbers - note that all pressures will be under 000.00. Finally, you need to ask the user whether the data should be saved - the user should be told that the options areyes or no and your program should make sure the user enters one of those two values - anything else and the program should keep asking until a valid entry is received. Should the user say yes, then the program should save the AvgPressure and the HighBP only into a MATLAB-formatted datafile called Processed.mat; otherwise, the program should just. Note - in your code, be sure to clearly indicate any spaces in any strings you use using the underscore, or character. load BP.data AvgPressure = mean(bp(:)); % or mean(mean(bp)) HighBP = max(bp(:)); % or max(max(bp)) fprintf( Average_Pressure:_%6.2f\n, AvgPressure); fprintf( Highest_Pressure:_%6.2f\n, HighBP); ToSave = input( Save (yes/no)?, s ); while ~(strcmp(tosave, yes ) strcmp(tosave, no )) % OR: (~strcmp(tosave, yes ) & ~strcmp(tosave, no )) ToSave = input( Save? Answer yes or no, please:, s ); if strcmp(tosave, yes ) save Processed AvgPressure HighBP

Problem V: 25 pts. Engineering the Tools of Scientific Discovery Part of the job of engineering the tools of scientific discovery will be to teach computers how to compute new functions by using old ones. For example, the value of + x can be evaluated with the infinite series: y = + x N n=0 ( ) n (2n)! ( 2n)(n!) 2 4 n xn for x < where N is the number of terms to use in the summation. Note that a! is the factorial of a, and that MATLAB has a function called factorial that will compute this. For instance, factorial(4) will compute 4! or 4*3*2*=24. You are to write a script that asks the user for a number with a magnitude less than one and that checks to make sure the number does, in fact, have a magnitude less than one - if not, keep asking until the user gives valid input. Then ask the user how many terms to display - for this one, you may assume the user enters an integer greater than 0. Finally, once you have a valid value for x and an integer N for the number of terms, have your program print out the first through N th approximation to the square root. You should format the printout so that four digits are shown after the decimal point and so the computer displays how many terms have been used. For example, if the user gave 4 for N, the computer would calculate: N = N = 2 N = 3 N = 4 + x + x + 2 x + x + 2 x 8 x2 + x + 2 x 8 x2 + 6 x3 and, if the user had put in 0.5 for x, the computer would display 2 y =.0000 with term y =.2500 with 2 terms y =.288 with 3 terms y =.2266 with 4 terms x = input( Enter a number x <: ); while abs(x)>= x = input( Magnitude less than, please! ); N = input( Enter a positive integer: ); y=0; for n=0:(n-) y = y + ( (-).^n * factorial(2*n) ) /... ( (-2*n) * factorial(n).^2 * 4.^n ) * x^n; fprintf( y = %0.4f with %0.0f term, y, n+) if n>0 fprintf( s ) fprintf( \n ) 2 Small warning - there is a tiny bit of trickiness to this...