Question

USE MATLAB The lump sum S to be paid when interest on a loan is compounded...


USE MATLAB
The lump sum S to be paid when interest on a loan is compounded annually is given by
where is the principal invested, is the interest rate, and is the number of years.
Write a modular program that will plot the amount S as it increases through the years from 1 to n. The main script lumpsum.m will call a function inputyears.m to prompt the user for the number of years (and error-check to make sure that the user enters a positive integer).
The script will then call a function plotlump.m that will plot S for years 1 through n. It shall use 0.05 for the interest rate and Php100,000 for P.
Run your program using:
Number of Years = - 5
Number of Years = 10

Homework Answers

Answer #1

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU WANT ANY MODIFICATION LIKE FOR SEPERATE FILE, THEN DO LET ME KNOW

function [ N ] = readNYears
        N = input('Enter a positive integer for n: ');
        while N ~= fix(N) | N < 0
                N = input('Please try again, enter a postive integer for n: ');
        end
end

function plotLumpSum(n)
        int = 0.05;
        P = 10^4;
        Y = 1:n;
        S = P*(1+int).^Y;
        plot(Y,S,'r-*')
        xlabel('Year')
        ylabel('Lump Sum S')
        title('Plot of S for years 1 through n')
end

n = readNYears;
plotLumpSum(n)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
"Allowed to use any platform" > Octave desktop app, Octave Online, MATLAB App, or MATLAB Online....
"Allowed to use any platform" > Octave desktop app, Octave Online, MATLAB App, or MATLAB Online. Create a script or a function to solve the following problem. The irrational number π can be (indirectly) approximated by an infinite series, that is π4=1-13+15-17+… The script or function should feature the following: the user can input the number of terms of the infinite series n , compute the sum of n terms of the infinite series, compute the absolute difference (error) of...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
When Jim retires at age 67, he wishes to withdraw all his superannuation as a lump...
When Jim retires at age 67, he wishes to withdraw all his superannuation as a lump sum and use that to invest in an annuity that pays him $80,000 each year for 15 years. This $80,000 income comprises of part principal draw down on the lump sum he invested and part interest he earns from the return on his lump sum. Jim can earn a 4% p.a. return on his lump sum investment. By the final year, he will have...
Part 2 (matlab) Functions Many of you will have some form of a loan during your...
Part 2 (matlab) Functions Many of you will have some form of a loan during your lifetime, either a student loan, mortgage, credit card debt, or other loan. If you never do have a loan, great! But you may have to calculate a payment for someone else, such as the company you work for. Such a loan will have a principal amount (called the present value), an interest rate, and a number of periods for the loan. The formula to...
Based on your research, state the lump sum, in $U.S., that you want to have when...
Based on your research, state the lump sum, in $U.S., that you want to have when you retire. This is the future value of your investment; denote it by F. (4 points) Future value, F $ State the time, in years, that you plan to contribute to your retirement account. Denote this by t. (4 points) Time, t Based on the first letter of your last name, choose the annual interest rate for your retirement account from the chart below....
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
One way to represent a very large integer (one that won't fit into a variable of...
One way to represent a very large integer (one that won't fit into a variable of type short, int, or even long) is to use an array. The array is of type int, so each element in the array can hold an integer -- we will store just one digit of our number per array element. So if a user entered 2375, it might be stored as -------------------------- | 2 | 3 | 7 | 5 | ... | --------------------------...
Remember that the discount rate is the interest rate that we use to find the present...
Remember that the discount rate is the interest rate that we use to find the present value of a cash flow or a lump sum. If you have $10,000 in 10 years, what would be the value of that $10,000 today. We would need to calculate the present value using 10 years as the number of periods (n), a discount rate (r) that we would need to determine, and we know the future value (fv) is $10,000. What if we...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code to initialize the CustomerAccountsDB database table and add a set of customer accounts is provided. Finish the code in these 3 methods in CustomerAccountDB.java to update or query the database: -purchase(double amountOfPurchase) -payment(double amountOfPayment) -getCustomerName() Hint: For getCustomerName(), look at the getAccountBalance() method to see an example of querying data from the database. For the purchase() and payment() methods, look at the addCustomerAccount() method...
In Chapter 9, you created a Contestant class for the Greenville Idol competition. The class includes...
In Chapter 9, you created a Contestant class for the Greenville Idol competition. The class includes a contestant’s name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three subclasses: ChildContestant, TeenContestant, and AdultContestant. Child...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT