Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
49 views2 pages

1D Fin Heat Transfer Matlab Code

This Matlab program solves the heat transfer equations for a 1D fin by discretizing the equations into a matrix equation. The user inputs the fin parameters ML and dX. The program then defines the coefficient matrix P and forcing vector Q based on the discretization. It solves the matrix equation to find the non-dimensional temperature variation along the fin length and plots the results.

Uploaded by

Ishani Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views2 pages

1D Fin Heat Transfer Matlab Code

This Matlab program solves the heat transfer equations for a 1D fin by discretizing the equations into a matrix equation. The user inputs the fin parameters ML and dX. The program then defines the coefficient matrix P and forcing vector Q based on the discretization. It solves the matrix equation to find the non-dimensional temperature variation along the fin length and plots the results.

Uploaded by

Ishani Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

% Voggu Vikas Reddy,

Enroll no-09112048,CFD
B.Tech in Chemical Engg.,3
rd
yr. %
% Matlab Program to solve the discretization equations heat transfer in 1 D fin %
% The M file %


ML = input('Enter the value for ML:');
dX = input('Enter the value for dX:');
n=(1/dX);
D=(2+ML*ML*dX*dX);
P=zeros(n,n); %Defining the coefficient matrix P of required
dimensions %
Q=zeros(n,1); %Defining the matrix Q of required dimensions %
i=n;
P(i,i-1)=-2; %fixed based on the mirror image assumption boundary
condition %
P(i,i)=D; %as the equation is
i-1
-D
i
+
i+1
=0, for i=2,3,4,.n-1%
i=i-1;
while(i>1)
P(i,i-1)=-1;
P(i,i)=D;
P(i,i+1)=-1;
i=i-1;
end
P(i,i)=-1;
Q(1,1)=-1;
display(P);
display(Q);
x=P\Q % the required non dimensional temperature %
plot(x);
title('non-dimensional temperature variation of 1-D fin along
the length');
xlabel('discretized point,n');
ylabel('Non dimentional temperature');





The output:
Enter the value for ML:2
Enter the value for dX:0.25

P =

-1.0000 0 0 0
-1.0000 2.2500 -1.0000 0
0 -1.0000 2.2500 -1.0000
0 0 -2.0000 2.2500


Q =

-1
0
0
0


x =

1.0000
0.6599
0.4848
0.4310

You might also like