Using Euler's method to solve temperature distribution for triangular fin

조회 수: 7 (최근 30일)
Michael Pine
Michael Pine 2022년 4월 16일
답변: Ravi 2023년 12월 28일
The cross section of the triangle changes with x, i am trying to plot a code that plots T against all values of x with a change in cross section.
Please if someone could help get this code working would be much appreciated.
%Maths CODE for heat transfer using Euler's method.
%rectangular based triangular fin
clear; clc
%variables we know
L=0.05; %Length in m
t=0.005; %Diameter in m
w=0.05; %width
K=237; %Thermal Conductivity
H=50; %Heat transfer coefficient
p=w*t; %Perimeter
Tb=60; %base temperature(celcius)
Ta=15; %Ambient Temperature
To=Tb-Ta;
m1=(2*H/K*t)^1/2; %fin parameter
x1=(0:0.0004:L); %x values
I0=0.48951; %Bessel equation values
I1=0.2024;
Ac=w*t(x1,:/L); %Cross,sectional,area m^2
Af=2*w.*[L^2+(t/2)^2]^1/2; %Area of Fin
n_f=(1/m1*L)*(I1(2*m1*L)/I0*(2*m1*L)); %fin efficiency
%Inputs
h = 0.0004; %Step size(m)
x_final = 0.05; %Total length of split pin
N = x_final/h; %Number of steps
q=n_f*H*Af*(Tb-Ta);
dx=L/(N-1);
%Initial conditions.
x(1)=0;
T(1)=60;
z(1)=0;
z10=0;
m=1;
%loop for euler's
while m > 0.00001
for i = 1:N
x(i+1)=x(i)+h;
T(i+1)=T(i)+h*z(i);
z(i+1)=z(i)+h*(((H*p)/(K*Ac))*(T(i)-Ta));
end
z(1)=z(1)-z(i+1);
m=abs(z(i+1)-z10);
end
disp(z(1))
disp(T(i+1))
disp(z(i+1))
disp(q)
figure(1); clf(1)
plot(x,T)
xlabel('length(m)')
ylabel('Temperature(C)')
  댓글 수: 3
Michael Pine
Michael Pine 2022년 4월 16일
편집: Michael Pine 2022년 4월 16일
The equation for Ac produces an error, as invalid use of operator

댓글을 달려면 로그인하십시오.

답변 (1개)

Ravi
Ravi 2023년 12월 28일
Hi Michael Pine,
I understand that you are facing an issue in plotting the temperature change across the cross-sections.
Please find the below modification that would resolve the issue you are facing.
Depending on whether the “x” values are computed from tip to base or base to tip of the triangular cross-section, please use the piece of code respectively.
Ac=w*t*(x1/L); % if x1 is calculated from tip to base
Ac=w*t*(1 - x1/L); % otherwise
Hope this helps.
Thanks,
Ravi Chandra

카테고리

Help CenterFile Exchange에서 Thermal Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by