MATLAB Answers

could you please help to solve this question?

1 view (last 30 days)
Gizem Soylu
Gizem Soylu on 12 Sep 2021
Edited: Image Analyst on 12 Sep 2021
The 10 𝑚 × 10 𝑚 titanium plate with a thermal conductivity of k=17 W/mK and thermal diffusivity of 𝛼=9.843 mm2 /s is shown above. At the boundaries, temperatures are as given below: x=0, 𝑇 = 150°𝐾 y=0, 𝑇 = 250°𝐾 x=10, 𝑇 = 390°𝐾 y=10, 𝑇 = 390°𝐾 Write a code to plot the temperature distribution as contour plot using
1. Jacobi Method
2. Gauss-Siedel Method
3. Successive Overrelaxation Method
4. Successive Line Overrelaxation Method
Solve the problem with each method for two cases: a. ∆𝑥 = ∆𝑦 = 0.1 𝑚 b. ∆𝑥 = 0.1𝑚, ∆𝑦 = 0.05
I wrote this code for Gauss-Shield but it is giving end error not only for end do but also while using just end. What is wrong?
dx = 0.1;
dy = 0.1;
dt = 1;
n= numel(x);
k = 17;
alpha = 9.843*10^(-6); rho_cp = k/alpha;
A = zeros(n*n);
C = zeros(n*n,1);
T(1:n*n,1) = 300;
residual = 100;
iterations = 0;
while (residual > 0.0001)
iterations = iterations+1;
Told = T;
do while (Etot.le.Etol)
do x=(2,n-1)
do y=(2,m-1)
end do
end do
end do

Accepted Answer

Image Analyst
Image Analyst on 12 Sep 2021
Edited: Image Analyst on 12 Sep 2021
There is no "do" statement in MATLAB. There is a "while" and a "for" but no "do while" or "end do".
For example
do while (Etot.le.Etol)
% code
end do
would be
while Etot <= Etol
% Code

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!