MATLAB Answers

No lines on my graph

7 views (last 30 days)
Yaneli Rubio
Yaneli Rubio on 24 Oct 2020
Commented: Star Strider on 27 Oct 2020 at 16:12
Hello,
I have gone through multiple of the post with similar problems without any luck. Can some one help? Why do no lines show on my graph?
% Assumened Values
Ti=20;
Tamb=38;
h=5.2;
d=1035; %density
c=3350;
k=0.62;
t=3600; %time in seconds
r=0.025; %radius
V=3/4*pi*r^3;
m=d*V
a= 2.3184*10^-5;
A=4*pi*r^2;
% for spherical system
Lc=r/3
%Biot Number
Bi= h*Lc/k
% Temperature after 60 minutes
T=Tamb+(exp((-h*A)/(m*c)*t)*(Ti-Tamb))
%plot T vs t
x=[0:100:3600]; %time on x-axis
plot(t,T), xlabel('time'), ylabel('Temperature'), title('Temperature vs Time')

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 24 Oct 2020
I suspect that ‘t’ is supposed to be a vector:
t=0:3600; %time in seconds
and then using element-wise division in the ‘T’ assignment:
T=Tamb+(exp((-h*A)./(m*c)*t)*(Ti-Tamb));
and the plotted ‘T’ as a function of ‘t’ curve magickally appears!

  2 Comments

Yaneli Rubio
Yaneli Rubio on 27 Oct 2020 at 15:39
I can't believe I missed that. Thank you so much!
Star Strider
Star Strider on 27 Oct 2020 at 16:12
As always, my pleasure!
No worries! I’ve done similar things and I’m certain others have as well!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!