How to code heat transfer expansion of erf ?

2 views (last 30 days)
Henry B.
Henry B. on 28 May 2021
Commented: Torsten on 28 May 2021
%mainp3
clear all
clc
k=30;%Wm^-1K^-1
p=3950;%kg m^-3
c = 880; %J kg^-1 K^-1
L = 0.10;%m
Tin = 1200;%K
Tout = 300;%k
ti=0;
N0=1;
nsteps = 5;
N = zeros(1,nsteps+1);
N(1) = N0;
ap=0.1;
x=1;
for (tf=10:50)
tf= tf+1;
t = linspace(ti, tf, nsteps);
[Theta] = InfConduct(x,ap,t)
pause(0.5)
plot(t,Theta)
end
hold off
figure(2)
plot(t, Theta)
In this problem I dont understand why we defined all the variables in the top portion if my InfConduct function from the last problem uses the right side of equation 3?
function [Theta] = InfConduct(x,ap,t)
tfh = @(t) erfc(x./sqrt(4 .*ap.*t));
Theta = tfh(t(1));
for k = 2:numel(t)-1
Theta(k+1) = Theta(k) + tfh(t(k+1))
end
end
  2 Comments
Henry B.
Henry B. on 28 May 2021
I didn't include the output because its changing in periods of 0.5.
Torsten
Torsten on 28 May 2021
Because you are supposed to calculate alpha from k, rho and cp in the calling program and to call InfConduct with this value of alpha.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!