prompt = 'What is the value of Area, A? ';
A = input(prompt)
prompt = 'What is the value of Heat Transfer Coefficient, h? ';
h = input(prompt)
prompt = 'What is the value of Temperature of System, Ts? ';
Ts = input(prompt)
prompt = 'What is the value of Temperature of Surroundings, Tf? ';
Tf = input(prompt)
prompt = 'What is the value of mass, m? ';
m = input(prompt)
prompt = 'What is the value of Heat Capacity, c? ';
c = input(prompt)
prompt = 'What is the value of time interval, dt? ';
dt = input(prompt)
prompt = 'What is the value of time at the end, tend? ';
tend = input(prompt)
q2 = 150;
tvals = 0 : dt : tend;
num_t = length(tvals);
Tn = zeros(1, num_t);
for tidx = 1 : num_t
t = tvals(tidx);
q1 = - A*h*(Ts - Tf);
Q = (q1+q2)*dt;
Ts = (Q/(m*c)) + Ts;
Tn(tidx) = Ts;
end
plot(tvals, Tn);
Best Answer