I need this question done in Matlab please. Show the code you used for the scrip
ID: 3727982 • Letter: I
Question
I need this question done in Matlab please. Show the code you used for the script file. Thanks a lot. QUESTION 3: (Problem 12.11) The steady-state distribution of temperature on a heated plate can be modeled by the Laplace equation: If the plate is represented by a series of nodes (Fig. P12.11), centered finite differences can be substituted for the second derivatives, which result in a system of linear algebraic equations. Use the Gauss-Seidel method to solve for the temperatures of the nodes in Fig. P12.11. (Take a unit square plate) leo . 10oC tootExplanation / Answer
clear all
clc
L= input('Enter Length:');
H= input('Enter Width:');
T1=input('Enter temperature of the bottom side:');
T2=input('Enter temperature of the right side:');
T3=input('Enter temperature of the top side:');
T4=input('Enter temperature of the left side:');
m= input('Enter the number of horizontal grid points:');
n= input('Enter the number of vertical grid points:');
dx= round(L/m);
dy= round(H/n);
T = zeros(n,m);
for i = 1 : n
for j = 1 : m
T(i,m) = T2;
T(i,1) = T4;
T(n,j) = T3;
T(1,j) = T1;
end
end
T(1,1)= (T1+T4)/2;
T(1,m)= (T1+T2)/2;
T(n,m)= (T2+T3)/2;
T(n,1)= (T3+T4)/2;
A=0;
while isequal(A,T) == 0
A=T;
for i = 2 : n-1
for j = 2 : m-1
T(i,j) = .25*( T(i+1,j)+ T(i-1,j) + T(i,j+1) + T(i,j-1) );
end
end
end
disp(T)
[C,h] = contour(T,[50:1:300]);
clabel(C,h)
colorbar
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.