This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Homework #4: While Loops Reading: 4.1 Homework: This assignment will be done entirely in MATLAB. When asked for a “program” you should create an m-file (script). Be sure to turn-in the completed script along with any runs you are asked for. In addition, you need a flow diagram for each program. Turn problems in IN THE ORDER THEY ARE ASSIGNED. Each problem needs to be labeled so the TA can find your work. Do the following exercises from your textbook 1. 4.18 After each calculation you should display the value of y ( x ) in a “nice” way. Also you should alert the user when they have entered an illegal value. For example, >> E4_18 Enter a value for x: -3 y(-3) = -1.38629 Enter a value for x: 10 You have entered an illegal value for x. PROGRAM TERMINATED. Test your code with x = 0.9, 0.5, 0, -1, -10, -500 and end with x = 1. Write a MATLAB script (m-file) that 2. Calculates the number of years it will take your bank account to accumulate at least $100,000 if you begin with s number of dollars, and you add that same amount at the end of each...
View Full Document
- Spring '07
- bank account, Hot air balloon, Lighter than air