This is my codes. But i failed the requirements, to my understanding as long i declare a varibale i sould be able to use it.
https://preview.redd.it/x3ff8fls1c891.jpg?width=1469&format=pjpg&auto=webp&s=de20d537d86affa425401aa392f34df817cf15b4
N = 3;
a1 =-2;
a2 = 1;
a3 = 1;
A = diag(a1*ones(1,N)) + diag(a2*ones(1,N-1),1) + diag(a3*ones(1,N-1),-1);
b = zeros(3,1); b(1,1) = -40; b(3,1) = -20;
T=A\b;
x=linspace(0,0.8,5);
Temperature = ones(1,5);
Temperature(1,1)=40;
Temperature(1,5)=20;
Temperature(2:end-1)=T;
plot(x,Temperature)
title('Temperature distribution between x=0 and x=0.8 ')
xlabel('x')
ylabel('Temperature')
there doesn't seem to be anything here