Programming Project: Mechanical Engineering, Numerical Methods

Verified

Added on  2023/04/24

|6
|697
|259
Project
AI Summary
This document presents a solution to a mechanical engineering programming project focused on solving a system of linear equations using numerical methods. The project involves setting up and solving equations to determine temperature distribution, and it includes a detailed explanation of the mathematical formulation, including the creation of a coefficient matrix and a constant matrix. Furthermore, the solution provides a MATLAB script (LO8.m) to solve for unknown nodal temperatures, along with the relevant parameters and output. The MATLAB code is well-commented and provides the necessary steps to solve the problem. The solution is comprehensive and provides the coefficient matrix, constant matrix, and the final unknown temperature matrix. This assignment is a valuable resource for students studying mechanical engineering and numerical methods.
Document Page
Running head: PROGRAMMING PROJECT
PROGRAMMING PROJECT
Name of the Student
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
1PROGRAMMING PROJECT
Part 1:
1. i)
Given system of linear equations are
T 1
2=T 0, for m = 1
τ T m1
2 + ( 1+ 2 τ ) T m
2 τ Tm +1
2 =T m
1 + τ ˙g ( Δx ) 2
k , for m = 2,3,4
T 5
2=T L for m=5
Expanding equations for m=2, 3, 4 gives
T 1
2=T 0
τ T 1
2+ ( 1+ 2 τ ) T 2
2τ T 3
2=T 2
1+ τ ˙g ( Δx )2
k
τ T 2
2+ ( 1+ 2 τ ) T 3
2τ T 4
2 =T3
1 + τ˙g ( Δx ) 2
k
τ T 3
2+ ( 1+ 2 τ ) T 4
2 τ T5
2=T 4
1 + τ ˙g ( Δx )2
k
T 5
2=T L
Now, in standard matrix multiplication format, A T 2=b, where A = 5*5 matrix and b is 5*1
matrix is given below.
[ 1 0 0 0 0
τ ( 1+ 2 τ ) τ 0 0
0 τ ( 1+2 τ ) τ 0
0 0 τ ( 1+2 τ ) τ
0 0 0 0 1 ] [ T1
2
T2
2
T3
2
T 4
2
T5
2 ] =
[ T 0
T 2
1 + τ ˙g ( Δx ) 2
k
T 3
1 + τ ˙g ( Δx ) 2
k
T 4
1 + τ˙g ( Δx ) 2
k
T L
] (1)
Document Page
2PROGRAMMING PROJECT
ii) Now, the values of τ = 1/3, T 0 = T L = 1, ˙g ( Δx ) 2
k = 1 and T 1 =
[ 1
1
1
1
1 ] are put into matrix
equation (1). Hence, T 1
1=T 2
1 =T3
1 =T 4
1 =T 5
1=1
[ 1 0 0 0 0
1
3 ( 5
3 ) 1
3 0 0
0 1
3 (5
3 ) 1
3 0
0 0 1
3 ( 5
3 ) 1
3
0 0 0 0 1
] [T1
2
T2
2
T3
2
T 4
2
T5
2 ]=
[ 1
4
3
4
3
4
3
1
]
Part 2:
Now, a MATLAB script LO8.m is written to solve the unknown T 2 when T 1 are given. The
necessary parameters remains the same as given in part 1.
MATLAB code:
%% Defining paramters
tau = 1/3; T0 = 1; TL = 1; gdotdelxsqrbyk = 1;
%% defining initial nodal temepratures
Tsup1 = [1 1 1 1 1]';
A = [1 0 0 0 0;-tau (1+2*tau) -tau 0 0;0 -tau (1+2*tau) -tau 0;0 0 -tau (1+2*tau) -tau;0 0 0 0
1];
Document Page
3PROGRAMMING PROJECT
b = [T0 Tsup1(2)+tau*gdotdelxsqrbyk Tsup1(3)+tau*gdotdelxsqrbyk
Tsup1(4)+tau*gdotdelxsqrbyk TL]';
fprintf('The coefficient matrix is \n')
A
fprintf('The constant matrix is \n')
b
%% Solving for unknown nodal temperatures
Tsup2 = A\b;
fprintf('The unknown temperatures in matrix form is \n')
Tsup2
Output:
The coefficient matrix is
A =
1.0000 0 0 0 0
-0.3333 1.6667 -0.3333 0 0
0 -0.3333 1.6667 -0.3333 0
0 0 -0.3333 1.6667 -0.3333
0 0 0 0 1.0000
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
4PROGRAMMING PROJECT
The constant matrix is
b =
1.0000
1.3333
1.3333
1.3333
1.0000
The unknown temperatures in matrix form is
Tsup2 =
1.0000
1.2609
1.3043
1.2609
1.0000
Document Page
5PROGRAMMING PROJECT
Hence, the unknown temperature matrix is
[ T 1
2
T 2
2
T 3
2
T 4
2
T 5
2 ]=
[ 1
1.2609
1.3043
1.2609
1 ]
chevron_up_icon
1 out of 6
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]