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')
답변 (1개)
Star Strider
2019년 3월 12일
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.
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!