How can I plot these values (result vs. time)?
이전 댓글 표시
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))])
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!