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...
Your C program will do the following : Must use at least 2 function prototypes &...
Your C program will do the following : Must use at least 2 function prototypes & definitions . You can also use repetitions , control structures . You re not allowed any type of global arrays, or global variables. You are only allowed to use 2 dimensional arrays. 1. In your main program, create a array of size 7 X 7. 2. Create a function that accepts the empty array. The function will initiate the to zero. Then, the function...
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...
2). Question with methods use scanner (Using Java): You are going to invest the amount, then...
2). Question with methods use scanner (Using Java): You are going to invest the amount, then you going to compute that amount with annual interest rate. 1) Prompt the user to enter student id, student name, student major 2) Declare variables consistent with names that you are prompting and relate them to the scanner 3) Declare the amount invested in college, prompt the user to ask for amount and declare variable and scanner to input 4) Declare the annual interest...
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....
Problem: Our Armstrong number Please write code for C language So far we have worked on...
Problem: Our Armstrong number Please write code for C language So far we have worked on obtaining individual digits from 4 digits or 5 digit numbers. Then added them to find the sum of digits in various examples and assignments. However, the process of extracting individual digits is actually can be solved using a loop as you were doing a repetitive task by using mod operation and division operation. Now, we know how loops work and we can remove the...
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...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an array of ints, an int value named element, and an int value named end. Return a bool based on whether the element appears in the array starting from index 0 and up to but not including the end index. Generate Random Array Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT