Graphing does not appear

Please Help my graph wont appear and my Y-axis intervals are off
clc;
clear all;
close all;
B=2500; %starting Balance of the account
C=50; %amount added per month
I=B*0.004; %claculating the interest of accoungt
t=0:1:216;%time intervals for graph counting by month
for i=0:1:216 %There are 216 months in 18 years, incrementing by 1 so per month
Bf=B+I+C; %calculating the New Balance of the Account
fprintf('%6.2f \n',Bf)
end
plot(t,Bf) %graphing values
xlabel('Time in Months')
ylabel('Balance of the Acount ($)')
title('College Fund')

Answers (1)

The plot will appear if you subscript ‘Bf’:
for i=1:numel(t) %There are 216 months in 18 years, incrementing by 1 so per month
Bf(i)=B+I+C; %calculating the New Balance of the Account
fprintf('%6.2f \n',Bf(i))
end
However your code has other problems (the amount does not accrue), and since this appears to be homework, I will leave you to it.

Categories

Asked:

on 12 Mar 2019

Answered:

on 12 Mar 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!