Graphing does not appear

1 view (last 30 days)
Lena Weisman
Lena Weisman on 12 Mar 2019
Answered: Star Strider on 12 Mar 2019
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)

Star Strider
Star Strider on 12 Mar 2019
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

Find more on 2-D and 3-D Plots 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!