Answer:
Explanation:
(a). computing we have that;
clc% helps in clearing screen
clear all% helps in clearing history
close all% helps in closing files if any
N = 5;
T = zeros(N,N);
T(1,1) = 1;
T(end,end) = 1;
for i = 2 : N-1
T(i,i-1:i+1) = [1,-2,1];
end
b = zeros(N,1);
b(1) = 25;
b(end) = 200;
disp('Temperatures are');
Temp = T\b
the matlab image is uploaded below.
(b). same goes,
clc% helps in clearing screen
clear all% helps in clearing history
close all% helps in closing files if any
N = 20;
T = zeros(N,N);
T(1,1) = 1;
T(end,end) = 1;
for i = 2:N-1
T(i,i-1:i+1) = [1,-2,1];
end
b = zeros(N,1);
b(1) = 25;
b(end) = 200;
disp('Temperatures are');
Temp = T\b
x = linspace(0,2,N);
plot(x,Temp)
the image of the temperature distribution plot and values is shown in the second image below.
cheers, i hope this helps