APPOROXIMATE SOLUTION OF LAPLACE'S EQUATION

20 Ansichten (letzte 30 Tage)
Anie Ekpes
Anie Ekpes am 9 Jan. 2012
Beantwortet: nick am 14 Apr. 2025
PLEASE I HAVE THIS QUESTION:
APPROXIMATE THE SOLUTION OF LAPLACE'S EQUATION IN THE SQUARE ABCD FOR THE BOUNDARY CONDITIONS INDICATED BELOW WITH THE SPACING h=1/6 for the following values of the parameters.
α=0.9+0.1,k; k=0,1,2; β=1.01+0.02,n; n=0,1,2;
Carry out Iterations to within 10-²
J= 1 2 3 4 5 6
u/AD 0 17.28 29.05α 40.00 29.05β 17.28
u/BC 0 9.81 17.98 α 29.12 38.25 β 42.31
u/AB 0 0 0 0 0 0
u/DC 4.31 6.98 12.38 β 19.14 30.10 α 40.16
CAN YOU PLEASE HELP ME ON A PROGRAM TO GET IT SOLVED USING GAUSS SEIDEL I NEED TO SUBMIT IT IN 3 DAYS TIME, THANKS THESE ARE THE EQUATION I USED MANUALLY:
L1=0.25*(0+L6+L2+17.28)
L2=0.25*(L1+L7+L3+29.05α
L3=0.25*(L2+L8+L4+40)
L4=0.25*(L3+L9+L5+29.05β
L5=0.25*(L4+L10+6.98+17.28)
L6=0.25*(0+L11+L7+L1)
L7=0.25*(L6+L12+L8+L12)
L8=0.25*(L7+L13+L9+L3)
L9=0.25*(L8+L14+L10+L4)
L10=0.25*(L9+L15+12.38β+L5)
L11=0.25*(0+L16+L12+L6)
L12=0.25*(L11+L17+L13+L7)
L13=0.25*(L12+L18+L14+L8)
L14=0.25*(L13+L19+L15+L9)
L15=0.25*(L14+L20+19.14+L10)
L16=0.25*(0+L21+L17+L11)
L17=0.25*(L16+L22+L18+L12)
L18=0.25*(L17+L23+L19+L13)
L19=0.25*(L18+L24+L20+L14)
L20=0.25*(L19+L25+30.10α+L15)
L21=0.25*(0+0+L22+L16)
L22=0.25*(L21+9.81+L23+L17)
L23=0.25*(L22+17.98α+L24+L18)
L24=0.25*(L23+29.12+L25+L19)
L25=0.25*(L24+38.25β+40.16+L20)
  2 Kommentare
Walter Roberson
Walter Roberson am 9 Jan. 2012
Which equation are you trying to solve? In written form, not by name.
Anie Ekpes
Anie Ekpes am 10 Jan. 2012
I AM TRYING TO SOLVE THE PROBLEM USING GAUSS SEIDEL METHOD, I HAVE DONE IT MANUALLY BUT I NEED TO ITERATE IT FOR 10 TIMES AND THE MESH POINTS ARE 25, MEANING I HAVE TO SOLVE 250 EQUATIONS.
THIS IS THE EQUATION I USED MANUALLY:
L1=0.25*(0+L6+L2+17.28)
L2=0.25*(L1+L7+L3+29.05α
L3=0.25*(L2+L8+L4+40)
L4=0.25*(L3+L9+L5+29.05β
L5=0.25*(L4+L10+6.98+17.28)
L6=0.25*(0+L11+L7+L1)
L7=0.25*(L6+L12+L8+L12)
L8=0.25*(L7+L13+L9+L3)
L9=0.25*(L8+L14+L10+L4)
L10=0.25*(L9+L15+12.38β+L5)
L11=0.25*(0+L16+L12+L6)
L12=0.25*(L11+L17+L13+L7)
L13=0.25*(L12+L18+L14+L8)
L14=0.25*(L13+L19+L15+L9)
L15=0.25*(L14+L20+19.14+L10)
L16=0.25*(0+L21+L17+L11)
L17=0.25*(L16+L22+L18+L12)
L18=0.25*(L17+L23+L19+L13)
L19=0.25*(L18+L24+L20+L14)
L20=0.25*(L19+L25+30.10α+L15)
L21=0.25*(0+0+L22+L16)
L22=0.25*(L21+9.81+L23+L17)
L23=0.25*(L22+17.98α+L24+L18)
L24=0.25*(L23+29.12+L25+L19)
L25=0.25*(L24+38.25β+40.16+L20)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

nick
nick am 14 Apr. 2025
Hello Anie,
To approximate the solution of Laplace's equation using the Gauss-Seidel method in MATLAB, you can follow the steps below :
% Parameters
h = 1/6;
tol = 1e-2;
maxIter = 1000;
% Boundary conditions
uAD = [0, 17.28, 29.05, 40.00, 29.05, 17.28];
uBC = [0, 9.81, 17.98, 29.12, 38.25, 42.31];
uAB = [0, 0, 0, 0, 0, 0];
uDC = [4.31, 6.98, 12.38, 19.14, 30.10, 40.16];
% Initialize grid
L = zeros(5, 5);
alpha_values = 0.9 + 0.1 * (0:2);
beta_values = 1.01 + 0.02 * (0:2);
% Iterate over alpha and beta values
for alpha = alpha_values
for beta = beta_values
% Adjust boundary conditions with alpha and beta
uAD(3) = 29.05 * alpha;
uAD(5) = 29.05 * beta;
uBC(3) = 17.98 * alpha;
uBC(5) = 38.25 * beta;
uDC(3) = 12.38 * beta;
uDC(5) = 30.10 * alpha;
% Gauss-Seidel iteration
for iter = 1:maxIter
L_old = L;
for i = 1:5
for j = 1:5
if i == 1
top = uAB(j + 1);
else
top = L(i - 1, j);
end
if i == 5
bottom = uDC(j + 1);
else
bottom = L(i + 1, j);
end
if j == 1
left = uAD(i + 1);
else
left = L(i, j - 1);
end
if j == 5
right = uBC(i + 1);
else
right = L(i, j + 1);
end
L(i, j) = 0.25 * (top + bottom + left + right);
end
end
end
fprintf('Results for alpha=%.2f, beta=%.2f:\n', alpha, beta);
disp(L);
end
end
Results for alpha=0.90, beta=1.01:
11.4605 8.7489 7.6987 7.6721 8.3259 19.8133 15.8362 14.3740 14.6638 15.8215 25.8113 20.4089 19.2971 20.7876 24.1144 23.0229 20.6908 21.6181 25.0751 30.7283 16.2490 17.7133 21.4095 27.1664 35.0912
Results for alpha=0.90, beta=1.03:
11.4767 8.7732 7.7255 7.6973 8.3434 19.8536 15.8907 14.4314 14.7203 15.8662 25.9021 20.5045 19.3891 20.8864 24.2190 23.2503 20.8361 21.7340 25.2172 31.0033 16.3415 17.8557 21.4937 27.2451 35.1796
Results for alpha=0.90, beta=1.05:
11.4929 8.7976 7.7522 7.7225 8.3608 19.8940 15.9451 14.4888 14.7768 15.9108 25.9930 20.6001 19.4810 20.9852 24.3236 23.4777 20.9815 21.8500 25.3593 31.2784 16.4340 17.9981 21.5780 27.3238 35.2681
Results for alpha=1.00, beta=1.01:
11.7935 9.0274 7.9320 7.9050 8.5639 20.8665 16.3841 14.7956 15.1243 16.5405 26.2384 20.8469 19.7421 21.2558 24.4940 23.2401 21.0229 22.0702 25.6629 31.0596 16.3587 17.9345 21.8527 28.2661 35.4489
Results for alpha=1.00, beta=1.03:
11.8096 9.0517 7.9587 7.9302 8.5813 20.9069 16.4385 14.8530 15.1808 16.5852 26.3292 20.9425 19.8341 21.3546 24.5986 23.4675 21.1683 22.1861 25.8050 31.3346 16.4511 18.0769 21.9370 28.3448 35.5374
Results for alpha=1.00, beta=1.05:
11.8258 9.0761 7.9855 7.9554 8.5988 20.9472 16.4930 14.9104 15.2373 16.6298 26.4201 21.0382 19.9260 21.4534 24.7032 23.6949 21.3136 22.3020 25.9472 31.6097 16.5436 18.2194 22.0212 28.4235 35.6258
Results for alpha=1.10, beta=1.01:
12.1264 9.3059 8.1653 8.1380 8.8019 21.9197 16.9319 15.2173 15.5847 17.2596 26.6655 21.2849 20.1871 21.7240 24.8736 23.4573 21.3551 22.5222 26.2507 31.3909 16.4683 18.1558 22.2960 29.3658 35.8067
Results for alpha=1.10, beta=1.03:
12.1426 9.3302 8.1920 8.1631 8.8193 21.9601 16.9864 15.2747 15.6412 17.3042 26.7563 21.3805 20.2790 21.8228 24.9782 23.6847 21.5004 22.6381 26.3929 31.6659 16.5607 18.2982 22.3802 29.4445 35.8951
Results for alpha=1.10, beta=1.05:
12.1588 9.3546 8.2187 8.1883 8.8368 22.0004 17.0408 15.3321 15.6977 17.3488 26.8472 21.4762 20.3710 21.9216 25.0829 23.9122 21.6457 22.7540 26.5350 31.9410 16.6532 18.4406 22.4645 29.5233 35.9836
You can refer to the documentation by executing the following MATLAB Command Window to know more about MATLAB language fundamentals:
doc language-fundamentals

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by