How can I plot these values (result vs. time)?
Show older comments
I have written the code, however, the plot function doesn't work. Do you know what could be wrong?
clc
clear all
close all
format bank
balanceV = 2000;
IR1 = 0.07;
IR2 = 0.09;
for n = 2:31
if balanceV < 10000
balanceV(n) = balanceV(n-1)*(1+IR1)
else
balanceV(n) = balanceV(n-1)*(1+IR2)
end
end
figure
plot(n,balanceV,'r')
xlim([0 30])
ylim([0 ceil(balanceV(n))])
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!