Basic/Introduction level MATLAB 1. If a certain amount of money (called the prin
ID: 3789228 • Letter: B
Question
Basic/Introduction level MATLAB
1. If a certain amount of money (called the principal P) is invested in a bank account, earning an interest rate percentage i compounded annually, the total amount of money Tn that will be in the account after n years is given by:
Tn = P (1 + i)n
Write an m-file script that prompts the user for the principal amount P and the annual interest rate percentage i (between 0 and 100), and outputs the total amount of money Tn for years n=3, 7, 13.
2.
A substance is said to be subject to exponential decay if it decreases at a rate proportional to its value. Symbolically, this can be expressed as the following differential equation, where N is the quantity and L (lambda) is a positive number called the decay constant:
dN = -LN dt
The solution to this equation is: N(t) = N(0)e-Lt
Here N(t) is the quantity at integer time t, and N(0) is the (initial) quantity (at time t=0) and L is the decay constant.
Larger decay constants make the quantity vanish much more rapidly. Use this fact to create a test table and then write the function called expDecay (with three arguments N(0), L, t and one return value N(t)) to solve the problem.
Explanation / Answer
1.
p=input('enter principal value: ');
i=input('enter interest rate between 0 to 100: ');
Tn3=p*(1+i/100)*3
fprintf('after 3 year total amount of money will be %f ',Tn3);
Tn7=p*(1+i/100)*5
fprintf('after 7 year total amount of money will be %f ',Tn7);
Tn13=p*(1+i/100)*13
fprintf('after 13 year total amount of money will be %f ',Tn13);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.