How to make a 2-dimensional array with n-rows and two columns

Write a script file that will compute the growth in a savings account at the end of every year for n-years. The script should prompt the user to input:
  • ‘the initial account balance: ’
  • ‘the annual interest rate: ’
  • ‘the investment duration in years: ’
Use the formula n B= B (1+r) 0 &xf0d7; , where 0 B is the initial balance, r is the annual interest rate as a fraction, n is the number of years, B is the future value of the investment.
The script should display a 2-dimensional array with n-rows and two columns: The first column should display the years from 0 to n. The second column should display the account balance at the end of each corresponding year.
Test your program with $100 as the input for the initial balance; and, 6.5% as the input interest rate. The output should look like this:
0.0000 100.0000
1.0000 106.5000
2.0000 113.4225
3.0000 120.7950
4.0000 128.6466
5.0000 137.0087
. .
. .
. .

댓글 수: 2

Your formula is not understandable. Characters appear to be missing
The formula also involved the character  with unicode code point U+F0D7 which is in the Private Use range and so might mean anything depending on which program is creating the graphics. When I reformatted your question, I represented the character as &xf0d7; which is one of the HTML representations for it.

댓글을 달려면 로그인하십시오.

답변 (1개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

질문:

2015년 11월 20일

댓글:

2015년 11월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by