Question: Solve in MATLAB Code!!! The interest you get at the end of n year, at a flat annual rate of r%, depend on how the

Solve in MATLAB Code!!!

The interest you get at the end of n year, at a flat annual rate of r%, depend on how the interest in compounded. If the interest is added to your account k times a year with the principal amount of X0, then at the end of n years the amount of your account X becomes: X=X0(1+ (r/k))^kn

1. Write the function, fn_interest to find the interest paid on X0. input X0, n, r, k and output the Interest which is X-X0

2. Write a script called BankInt and input X0, n, r and output the result in the following format by using the function, fn_interest. Use if-elseif statement or switch-case statement and let user choose the compound interest type by using the menu function. Users choices are: (i) quarterly (k=4) (ii)daily* (k=365) (iii) annually (k=1) (iv) user defines k (user inputs k) Output the result in display as follows by using fprintf: The principal amount of $ X0 in n years with interest rate of r % becomes $ X when interest is compounded K times a year. Your earning amount is $ (X-X0).

3. Run the script with principal of $1000 at the rate of 6% for five years term when the the interest is compounded; (i) quarterly (k=4) (ii)daily* (k=365) (iii) annually (k=1) (iv) monthly (k=12) and compare the interest paid on X0. (*Do not consider the leap year effect for daily)

4. Use fn_interest or store the above results in a vector manually then plot the bar graph which shows the interest in five years with each compound interval. Label x-axis with Compound Interval, 1: Quarterly, 2: Daily, 3: Annually, 4: Monthly, and y-axis with Interest, $. Add title with Earned interest for 5 years term with 6% interest rate. You may set the y-axis limit with ylim([min max]). For plotting bar graph, use bar instead of plot.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!