Answer:
Desired MATLAB code is explained below
Explanation:
function savingsBalance = CalculateBalance(numberYears, savingsBalance)
% numberYears: Number of years that interest is applied to savings
% savingsBalance: Initial savings in dollars
interestRate = 0.025; % 2.5 percent annual interest rate
% Complete the for loop to iterate from 1 to numberYears (inclusive)
for (i = 1 : numberYears)
savingsBalance = savingsBalance + (savingsBalance * interestRate);
end
end