2 The Thin Wire Problem A thin wire with a uniform crosssect
     2. The Thin Wire Problem A thin wire with a uniform cross-section will radiate heat from its sides according to Newtonian Cooling-that is, the rate of loss of heat is proportional to the difference in temperature between the object and its surroundings. If the temperature at every point in the wire remains constant, then it satisfies the second-order ODE FT where k is the thermal diffusivity, h is the thermal conductivity of the interface be- tween the object and the environment, and Te is the temperature of the environ- ment. We can approximate the second derivative using a \"central difference formula: If we apply this to a series of points in the wire, we can write down a series of equations of the form Suppose that we require that T(0) 0 and T(1) 0. That is. the temperature at both ends is held at 0°C. We can let d = 1/N, and this allows us to write down the matrix equation a b 0 0 b ab 0 0 0 0 0 b a 000T Ti hT hT hT 0 0 0 0b abTy-2 0 0 0 00 b a T-I where a = h + 2kN2 and b = _kN2 Your task is to write a MATLAB function that will do the following: Take in N, k, h, and Te as input variables e Generate the relevant matrices and/or vectors (see below), Solve the system (using chosen approach, see below), and * Plot the resulting solution T against position . 3  
  
  Solution
Choosing option 1:
N = input(\'Enter value of N: \');
 k = input(\'Enter value of k: \');
 h = input(\'Enter value of h: \');
 Te = input(\'Enter value of Te: \');
 A = zeros(N-1,N-1);
 B = h*Te*ones(N-1,1);
 a = h+2*k*N^2;
 b = -k*N^2;
 for i = 1:N-2
 A(i,i) = a;
 A(i+1,i) = b;
 A(i,i+1) = b;
 end
 A(N-1,N-1) = a;
 T = inv(A)*B;
 plot(T)

