1D transient conduction
13 views (last 30 days)
Show older comments
I have trying to graph 1D transient conduction given initial condition as 80F. The right side is insulated. But the left side is tricky as it is prescribed temperature based on given graph of temperature vs time. I have been coding and getting just box like graph --which is wrong. I am trying to do Finite Difference Method based on forward explicit. The code I am using is bellow. Any suggestions on why I am not getting any iterations graphs but just initial matrix graph?

clear;
clc;
clf;
L=152; %mm
tf=100; %total time of simulation (sec)
n=152;%number of iteration
dt=0.01;%time step
dx=L/n; %change in length
k=43; %thermal conductivity
rho=7801; %density
cp=473;% heat capacity
%t=0:dt:tf; %time vector
alpha=k/(rho*cp);
d=alpha*dt/dx^2;
%Initial Conditions
Ti=80;
%Boundary Conditions
T0=1500*ones(1,n);%creates matrix with 1500s
T1=80*ones(1,n);% creates matrix with 80s
T0(1) = 80; %Initial temperature at left wall
T0(end) = 80; %Initial temperature at right wall
for j=1:n %time iteration
for i=2:n-1 %node Temperature iteration
T1(i)=T0(i)+d*(T0(i+1)-2*T0(i)+T0(i-1)); %T(x,t), Explicit forward Main equation
end
end
plot(T1)
disp(T1)
0 Comments
Answers (0)
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!