So I am trying to write a function that will show me a balance after every year with a compound interest of 10% until the balance has reached double the initial investment.
what I have so far is
x=input('initial investment '); b=1; for y=x*((1.1)^b) if y< 2*y b=b+1; elseif y >= 2*y disp(y); end
I'm pretty sure that my issue is trying to get 'b' to increase each year as so far it just stops. I also think I might have to use a while loop but I don't know how.
Best Answer