Question: Here is the function euler The concept of compound interest is fundamental to finance. In compound interest calculations the interest rate to a loan or
Here is the function euler
The concept of compound interest is fundamental to finance. In compound interest calculations the interest rate to a loan or deposit is applied periodically not only to the principal amount but to that amount plus the interest. For example, if we denote the principal amount by P(t), have an interest rate r for year t, and compound annually thern the amount at the end of the first year will be P(1) - P(0) +rP(0) - (1+r)P(0). The amount at the end of the second year will be P(2)-(1+r)P(1) = (1+r)(1+r)P(0). So the amount at year t will be P(t) P(0)*(1+r)t. It is straightforward to show that if the amount is compounded k times a year the equation becomes: Pt) = P(0) (1 + t. Compounding continuously can be defined by taking the limit of the previous expression when k oo and is P(t)P(0)ert. We can also arrive at the same conclusion by differential calculus Consider compounding after a time interval M. Then P(t + ) = P(t) + rPM which can be rearranged to At taking t 0 we have the following differential expression for interest compounded continuously: dt (a) Modify the above MATLAB function M-file Euler .m so that it will solve the problem of continuous compound interest. Modify Euler.m as follows. Change the header of the MATLAB M-file to be function EulerCompound(r, PO, to, tn, n) where the constants r (rate) and PO (principal) are given as parameters, t0 is the initial time in years, tn is the final value of t for the numerical solution, and n is the number of time steps over the interval [t0, tn]. All the variables names and associated comments in the code should be changed to reflect this new specification and you will need to modify the statement that updates the velocity using Euler's method with a corresponding expression for the continuous compound interest problem. HAND IN a copy of your MATLAB M-file EulerCompound
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
