Exercise 20 Solution

yeargrid = [0:maxyear];
S = principal.*(1+intrate).^yeargrid;
figure(1);
plot(yeargrid,S,'b-o');
xlabel('Time (y)');
ylabel('Amount (USD)');
xlim([0 maxyear]);
ylim([0 max(S).*1.2]);
set(gca,'fontsize',12)
end


For more details, please contact me here.