2) Create a new SCRIPT file called collegeSavings.m Imagine that you are a proud new parent. You decide to start a college savings plan now for your child, hoping to have enough in 18 years to pay the sharply rising cost of education. Suppose that your folks give you $1000 to get started and that each month you can contribute $100. Suppose also that the interest rate is 6% per year compounded monthly, which is equivalent to 0.5% each month. Because of interest payments and your contribution, each month your balance will increase in accordance with the formula: New balance old balance + interest + your contribution Use a for loop to find the amount in the savings account each month for the next 18 years. You will build a vector of your savings account balance for each month over 18x12 months. Before the loop starts, define savings(1) 1000. That's the initial amount in your account. Then make a for loop that starts k at 2 and ends at 18x12. Each cycle through the loop should define savings(k) given the formula for New balance above. HINT: New balance is savings(k), old balance is savings(k-1), interest is the interest rate (in percent divided by 100) times the old balance, and your contribution is 100. If we were going to "unfold" the for loop as it runs, it would work something like this: savings (2) = savings(1)+ savings(1)*(0.5/100)+100; savings(3)= savings(2) + savings(2)*(0.5/100)+100; savings(4) savings(3) + savings(3)*(0.5/100)+100; ... and so on But this is not what you are going to type in your program (if you did, you would have to repeat those lines 18x12 times!) Use a for loop to do all the calculations needed in a very compact form. After the loop ends, create a time vector for time in years that has the same length as the savings vector. Then Plot the amount in the savings account as a function of time in YEARS. (Plot time on the horizontal axis and dollars on the vertical axis.) SAVE PLOT as collegeSavings.jpg You can extract the last value in the savings vector using the special keyword end. So you can make a scalar value with your savings balance at the end of 18 years with the statement: collegeSavings savings(end) Put this line at the end of the file and copy/paste the result (a single number) into the file, commenging it out.
2) Create a new SCRIPT file called collegeSavings.m Imagine that you are a proud new parent. You decide to start a college savings plan now for your child, hoping to have enough in 18 years to pay the sharply rising cost of education. Suppose that your folks give you $1000 to get started and that each month you can contribute $100. Suppose also that the interest rate is 6% per year compounded monthly, which is equivalent to 0.5% each month. Because of interest payments and your contribution, each month your balance will increase in accordance with the formula: New balance old balance + interest + your contribution Use a for loop to find the amount in the savings account each month for the next 18 years. You will build a vector of your savings account balance for each month over 18x12 months. Before the loop starts, define savings(1) 1000. That's the initial amount in your account. Then make a for loop that starts k at 2 and ends at 18x12. Each cycle through the loop should define savings(k) given the formula for New balance above. HINT: New balance is savings(k), old balance is savings(k-1), interest is the interest rate (in percent divided by 100) times the old balance, and your contribution is 100. If we were going to "unfold" the for loop as it runs, it would work something like this: savings (2) = savings(1)+ savings(1)*(0.5/100)+100; savings(3)= savings(2) + savings(2)*(0.5/100)+100; savings(4) savings(3) + savings(3)*(0.5/100)+100; ... and so on But this is not what you are going to type in your program (if you did, you would have to repeat those lines 18x12 times!) Use a for loop to do all the calculations needed in a very compact form. After the loop ends, create a time vector for time in years that has the same length as the savings vector. Then Plot the amount in the savings account as a function of time in YEARS. (Plot time on the horizontal axis and dollars on the vertical axis.) SAVE PLOT as collegeSavings.jpg You can extract the last value in the savings vector using the special keyword end. So you can make a scalar value with your savings balance at the end of 18 years with the statement: collegeSavings savings(end) Put this line at the end of the file and copy/paste the result (a single number) into the file, commenging it out.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY