You are on page 1of 2

Table of Contents

........................................................................................................................................................ 1
Q1 (a) Solution ................................................................................................................................... 1
Q1 (b) Solution ................................................................................................................................... 1
Q2 Solution ........................................................................................................................................ 2

clc
clear all
close all

Q1 (a) Solution
disp(' Answer 1(a)')
A = [1 -0.25 0 -0.25 0 0;
-0.25 1 -0.25 0 -0.25 0;
0 -0.5 1 0 0 -0.25;
-0.5 0 0 1 -0.25 0;
0 -0.5 0 -0.25 1 -0.25;
0 0 -0.5 0 -0.5 1];
B = [165.625 90.625 90.625 90.625 15.625 15.625]';
C = inv(A)*B;
Temperatures = C

Answer 1(a)

Temperatures =

348.4628
368.9433
374.6042
362.4080
390.2062
398.0302

Q1 (b) Solution
disp(' Answer 1(b)')
A = [1 -0.25 0 -0.25 0 1;
-0.25 1 -0.25 0 -0.25 1;
0 -0.5 1 0 0 1;
-0.5 0 0 1 -0.25 1;
0 -0.5 0 -0.25 1 1;
0 0 -0.5 0 -0.5 1];
B = [150 75 225 75 150 -600]';
C = inv(A)*B;
q = C(6)/(-3.125*10^(-7))
fprintf(' Temperatures T1 to T5\n')

1
Temperatures = C(1:5)

Answer 1(b)

q =

1.5301e+08

Temperatures T1 to T5

Temperatures =

448.3099
510.9859
528.3099
490.9859
576.0563

Q2 Solution
disp(' Answer 2')
A = [-4 2 0 0;
1 -4 1 0;
0 1 -4 1;
0 0 2 -4];
B = [-375 -375 -375 -50]';
C = inv(A)*B;
fprintf(' Temperatures T1 to T4\n')
Temperatures = C

Answer 2
Temperatures T1 to T4

Temperatures =

183.8889
180.2778
162.2222
93.6111

Published with MATLAB® R2022b

You might also like