4/7/21 2:22 AM D:/matlab Term3/ex - Soldiffwith - BC.M 1 of 1: For End
4/7/21 2:22 AM D:/matlab Term3/ex - Soldiffwith - BC.M 1 of 1: For End
m 1 of 1
clear all
clc
%% define the known information
h = 0.01; %heat transfer coeficient
Ta = 20; %Surrounding temp
T0 = 200; %B.C.1: T(x=0)==200
Tn = 40; %B.C.2: T(x=L)=40
L = 10; %length of the metal rod
%% Discretization
x0 = 0; %Initial x, x=0
dx = 2; %Step size
seg = L/dx; %Number of segment
n = seg+1 %total number of node
xn = L; %Final x, x = L
disp(A)
disp(b)
T = A\b'
disp(T)