need Matlab code for these 2 questions that I am having trouble with....please m
ID: 3850384 • Letter: N
Question
need Matlab code for these 2 questions that I am having trouble with....please make sure it works on Matlab r2016a
Explanation / Answer
PLEASE POST AS SEPARATE QUESTIONS:
4.5) MATLAB CODE:
---------------------------------------------------------------------------------
P = 250000;
Ir = 4.5;
A = 25000;
R = zeros(1,100);
remain = 0;
for years = 1:100
if years == 1
R(1,years)=P-A;
else
R(1,years)=(R(1,years-1)*(1+(Ir/100)))-A;
if R(1,years) < A
remain = R(1,years);
break
end
end
end
remain = round(remain);
disp('Principal Annuity Interest No. Remain')
disp(' ($) ($/yr) (%) years ($) ')
X = sprintf(' %d %d %.2f %d %d',P,A,Ir,years,remain);
disp(X)
--------------------------------------------------------------------------------------------------------
DO THUMBS UP ^_^
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.