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')

 Accepted Answer

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

I can't believe I missed that. Thank you so much!
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)

Categories

Products

Community Treasure Hunt

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

Start Hunting!