clear; close all % % Compounding at various intervals % P = 100; %% Principal n = 365 %% Number of times per year balance is compounded t = 10; %% Number of years r = 0.05; %% Interest rate B = P*(1+r/n)^(n*t) B = P*exp(r*t)