Need help with loop for a heat transfer question
이전 댓글 표시
Hello, I worked on a code to calculate the temperature of the slab from a given initial temperature and a given slab thickness after some time t. Now lets say that the slab thickness wasn't given, and the question is asking to calculate the minimum thickness of a slab to satisfy a final temperature after some time t, how can i adjust my code so that it calculates the minimum thickness? im new to matlab so any help would be appreciated. Please let me know if theres something that is not clear about the code, thanks in advance for your help.
%this code calculates the temperature of the slab surface after time t
clear
clc
close
L=0.2; %slab thickness
Ti=600; %initial surface temp
Tinf=22; %surrounding temp
h=240; %convection coefficient
k=80.2; %thermal conductivity
alpha=3.31e-5;
dx=0.01;
dt=1.5;
Fo=(alpha*dt)/dx^2; %forier number
Bii=(h*dx)/k;
Bio=(h*dx)/k;
t=1800;
x=[0:dx:L];
n=length(x);
t=[0:dt:t];
T = zeros(numel(t), numel(x)); %temperature of the slab at time t (rows) and position x (columns)
T(1, :) = Ti; %temperature at t = t0;
for k = 2:numel(t)
T(k, 1) = T(k-1, 1)*(1-2*Fo-2*Bio*Fo)+2*Fo*T(k-1, 2)+2*Bio*Fo*Tinf; %node1
for i = 2:numel(x)-1
T(k, i) = T(k-1, i)*(1-2*Fo)+Fo*(T(k-1, i+1)+T(k-1, i-1)); %interior nodes
end
T(k, n) = T(k-1, n)*(1-2*Fo-2*Bii*Fo)+2*Fo*T(k-1, n-1)+2*Bii*Fo*Tinf; %exterior node
end
T(k,n)
%plot temperature for all t at a different x
plot(t, T(:, end));
댓글 수: 3
KALYAN ACHARJYA
2018년 7월 20일
편집: KALYAN ACHARJYA
2018년 7월 20일
Which term represents the final temp, is this t?
t=1800;
And your question is find L, when t reaches 1800?
Guillaume
2018년 7월 20일
KALYAN ACHARJYA
2018년 7월 20일
Oh
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!