Question: Please use MATLAB and add comments to explain Consider a metal rod of length L = 1 m initially at temperature 20 C everywhere along
Please use MATLAB and add comments to explain


Consider a metal rod of length L = 1 m initially at temperature 20 C everywhere along its length. At time t = 0 the left end of the rod is fixed at 100 C while the right end of the rod is held fixed at 0 C, as shown below in Figure 1: T(x=0,t) = 100 C T(x=L,t) = 0 C L = 1 m T(x,t=0) = 20 C Figure 1: problem setup at The temperature along the rod at any x-position for any time t is a function of 2-variables (T(x,t)) and can be found by solving the heat diffusion equation (a is a material property called the thermal diffusivity and has units of m/s, for this problem use a = 1): at 22T 2 To solve this numerically, chop the bar up in to elements of length Ax such that the x location of the ith node is given by: x=iAx In a similar fashion, the time coordinate is discretized such that the time at the j" time step is: t=jAt The derivatives in the heat-diffusion equation are replaced by finite difference approximations: at 1/+1 - T! at alt T1 - 27' +T_1 2 (Ax)2 Substituting these finite-difference approximations into the heat diffusion equation and solving for Tj-l: aAt T:+1 (Ax)2 (Ti42 27+ +T_2) +T This result gives an explicit, algebraic equation for calculating the temperature at the next time value based on temperatures at the previous time value. At 5 0.5 In order to get a solution that is stable, the following condition must be met: t (4x) This restricts how large of a time-step may be taken for a fixed Ax. Implement the solution scheme described above by writing a MATLAB script to solve for T(x,t) in order to determine how long it takes for the bar to reach its steady state temperature distribution. Your results should be presented as an animation that runs until steady state is reached. Steady-state is defined as when the center of the bar is within 1 C of its final temperature. Submit your completed m-file via Brightspace. Your code must be readable and properly commented to receive full credit As this is an exam, you may NOT discuss this problem or your code with any other student. All questions should be directed to the instructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
