SlideShare une entreprise Scribd logo
1  sur  19
Numerical Analysis
Visit my BlogSpot
http://ayaozaki.blogspot.com/2014/06/
fdm-numerical-solution-of-laplace.html
6/25/2014 Aya Zaki 1
A Finite Difference Method for
Laplace’s Equation
• A MATLAB code is introduced to solve Laplace
Equation.
• 2 computational methods are used:
– Matrix method
– Iteration method
• Advantages of the proposed MATLAB code:
– The number of the grid point can be freely chosen
according to the required accuracy.
– The boundary conditions can simply be changed.
6/25/2014 Aya Zaki 2
A Finite Difference Method for
Laplace’s Equation (cont.)
• Example (Sheet 4)
• Grid: N=3
• B.C. shown
6/25/2014 Aya Zaki 3
50
37.5
25
12.5
37.52512.5
000
0
0
0
0
0
200mm
200mm
T(i,j)
I. Matrix computation method
• Example (Sheet 4)
• Grid: N=3
• The code generates the equations to be solved: 𝑨 𝑼 = 𝑩
6/25/2014 Aya Zaki 4
k
-4 1 0 1 0 0 0 0 0
1 -4 1 0 1 0 0 0 0
0 1 -4 0 0 1 0 0 0
1 0 0 -4 1 0 1 0 0
0 1 0 1 -4 1 0 1 0
0 0 1 0 1 -4 0 0 1
0 0 0 1 0 0 -4 1 0
0 0 0 0 1 0 1 -4 1
0 0 0 0 0 1 0 1 -4
0
0
-12.5
0
0
-25. 0
-12.5
-25.0
-75.0
T11
T21
T31
T21
T22
T23
T31
T32
T33
=
U = inv(A)*B;
%Re-arrange
for j= 1:N
for i=1:N
T(j+1,i+1)= U((j-
1)*N+i);
end
end
for i= 1:N
for j=1:N
k= (j-1)*N +i;
A(k,k)= -4;
for m = i-1: 2:i+1
if ((m<1) ||(m>N))
B(k)= B(k) -T(m+1,j+1);
else
l = (j-1)*N+m;
A(k,l)= 1;
end
end
for n = j-1: 2:j+1
if ((n<1) ||(n>N))
B(k)= B(k)- T(i+1,n+1);
else
l = (n-1)*N+i;
A(k,l)= 1;
end
end
end
end
I. Matrix computation method(cont.)
• Code
6/25/2014 Aya Zaki 5
N=3;
T = zeros(N+2, N+2);
x = linspace(0,200e-3, N+2);
y = linspace(0,200e-3, N+2);
%Boundary Conditions
% Y- left
T(:,N+2) = linspace(0,50,N+2)
% Top
T(N+2,:)= linspace(0,50,N+2)
A , B
• T=
I. Matrix computation method(cont.)
6/25/2014 Aya Zaki 6
0 0 0 0 0
0 3.125 6.25 9.375 12.5
0 6.25 12.5 18.75 25
0 9.375 18.75 28.125 37.5
0 12.5 25 37.5 50
50
37.5
25
12.5
37.52512.5
000
0
0
0
0
0 3.125 6.25 9.375
6.25
9.375
12.5 18.75
18.75 28.125
I. Matrix computation method(cont.)
6/25/2014 Aya Zaki 7
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed with solving the Matrix.
Distance y
surf(x,y,T);
• Plotting T
• Plotting T
I. Matrix computation method(cont.)
6/25/2014 Aya Zaki 8
contour(x,y,T);
Temperature plot (contourf)
0 0.05 0.1 0.15 0.2
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
0
5
10
15
20
25
30
35
40
45
• N= 50
I. Matrix computation method(cont.)
6/25/2014 Aya Zaki 9
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed with solving the Matrix.
Distance y
for k=1:20
for i=2:N+1
for j=2:N+1
un(i,j)=(un(i+1,j)+un(i-1,j)+un(i,j+1)+un(i,j-1))/4;
end
end
end
II. Iteration computation method
• Code
– Number of iterations = 20
– The better the initial guess, the faster the computation is.
– For simplicity, the initial value for all points is chosen as zero.
6/25/2014 Aya Zaki 10
N=3;
T = zeros(N+2, N+2);
x = linspace(0,200e-3, N+2);
y = linspace(0,200e-3, N+2);
%Boundary Conditions
% Y- left
T(:,N+2) = linspace(0,50,N+2)
% Top
T(N+2,:)= linspace(0,50,N+2)
• T=
II. Iteration computation method
(cont.)
6/25/2014 Aya Zaki 11
0 0 0 0 0
0 3.125 6.25 9.375 12.5
0 6.25 12.5 18.75 25
0 9.375 18.75 28.125 37.5
0 12.5 25 37.5 50
• Plotting T
II. Iteration computation method
(cont.)
6/25/2014 Aya Zaki 12
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed with 20 iteration.
Distance y
The same results were obtained as before.
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
• Plotting T
II. Iteration computation method
(cont.)
6/25/2014 Aya Zaki 13
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed with 20 iteration.
Distance y
The same results were obtained as before.
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
• Plotting T
II. Iteration computation method
(cont.)
6/25/2014 Aya Zaki 14
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed with 20 iteration.
Distance y
The same results were obtained as before.
A Finite Difference Method for
Laplace’s Equation (cont.)
• Example (Sheet 4)
• Grid: N=3
• B.C. with lower
edge insulated.
6/25/2014 Aya Zaki 15
50
37.5
25
12.5
37.52512.5
000
0
0
0
0
0
200mm
200mm
T(i,j)
Lower Edge Insulated
• Example (Sheet 4)
• Grid: N=3
• B.C. with lower
edge insulated.
6/25/2014 Aya Zaki 16
50
37.5
25
12.5
37.52512.5
0
0
0
0
T
0 5.0367 8.6453 8.6450 0
0 5.7508 10.4498 12.9673 12.5000
0 7.5166 14.4358 20.2743 25.0000
0 9.8797 19.5024 28.6942 37.5000
0 12.5000 25.0000 37.5000 50.0000
Lower Edge Insulated
• Plot of T
6/25/2014 Aya Zaki 17
N =3
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed.
Distance y
Lower Edge Insulated
• N = 100
6/25/2014 Aya Zaki 18
0
0.05
0.1
0.15
0.2
0
0.05
0.1
0.15
0.2
0
10
20
30
40
50
Distance x
Numerical solution computed.
Distance y
0 0.05 0.1 0.15 0.2
0
10
20
30
40
50
Distance y
Temperature(C)
Plot of Temperature at different x points
0mm
100mm
200mm
Lower Edge Insulated
• N = 100
6/25/2014 Aya Zaki 19
Temperature plot (contourf)
0 0.05 0.1 0.15 0.2
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
0
5
10
15
20
25
30
35
40
45

Contenu connexe

Tendances

S6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysisS6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysis
Shaikh Mohsin
 
Ode powerpoint presentation1
Ode powerpoint presentation1Ode powerpoint presentation1
Ode powerpoint presentation1
Pokkarn Narkhede
 

Tendances (20)

S6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysisS6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysis
 
Laplace transforms
Laplace transformsLaplace transforms
Laplace transforms
 
Fundamentals of Finite Difference Methods
Fundamentals of Finite Difference MethodsFundamentals of Finite Difference Methods
Fundamentals of Finite Difference Methods
 
Partial Differential Equation - Notes
Partial Differential Equation - NotesPartial Differential Equation - Notes
Partial Differential Equation - Notes
 
Bisection method
Bisection methodBisection method
Bisection method
 
Numerical Methods and Analysis
Numerical Methods and AnalysisNumerical Methods and Analysis
Numerical Methods and Analysis
 
Laplace transform
Laplace transformLaplace transform
Laplace transform
 
Z transform
Z transformZ transform
Z transform
 
Finite Difference Method
Finite Difference MethodFinite Difference Method
Finite Difference Method
 
Iterative methods
Iterative methodsIterative methods
Iterative methods
 
Line integral,Strokes and Green Theorem
Line integral,Strokes and Green TheoremLine integral,Strokes and Green Theorem
Line integral,Strokes and Green Theorem
 
Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
 
Ode powerpoint presentation1
Ode powerpoint presentation1Ode powerpoint presentation1
Ode powerpoint presentation1
 
digital control Chapter 2 slide
digital control Chapter 2 slidedigital control Chapter 2 slide
digital control Chapter 2 slide
 
Numerical solution of ordinary differential equations GTU CVNM PPT
Numerical solution of ordinary differential equations GTU CVNM PPTNumerical solution of ordinary differential equations GTU CVNM PPT
Numerical solution of ordinary differential equations GTU CVNM PPT
 
Gaussian quadratures
Gaussian quadraturesGaussian quadratures
Gaussian quadratures
 
The method of frobenius
The method of frobeniusThe method of frobenius
The method of frobenius
 
Jacobi method for MATLAB
Jacobi method for MATLAB Jacobi method for MATLAB
Jacobi method for MATLAB
 
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-II
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-IIEngineering Mathematics-IV_B.Tech_Semester-IV_Unit-II
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-II
 
Properties of Fourier transform
Properties of Fourier transformProperties of Fourier transform
Properties of Fourier transform
 

Similaire à FDM Numerical solution of Laplace Equation using MATLAB

Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
PremanandS3
 
Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3
Andrew Hair
 

Similaire à FDM Numerical solution of Laplace Equation using MATLAB (20)

chp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.pptchp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.ppt
 
chp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).pptchp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).ppt
 
2.ppt
2.ppt2.ppt
2.ppt
 
Determinants and matrices.ppt
Determinants and matrices.pptDeterminants and matrices.ppt
Determinants and matrices.ppt
 
12000121056_priyankamanna_CA1_numericalmethod.pdf
12000121056_priyankamanna_CA1_numericalmethod.pdf12000121056_priyankamanna_CA1_numericalmethod.pdf
12000121056_priyankamanna_CA1_numericalmethod.pdf
 
Matrix
MatrixMatrix
Matrix
 
18-21 Principles of Least Squares.ppt
18-21 Principles of Least Squares.ppt18-21 Principles of Least Squares.ppt
18-21 Principles of Least Squares.ppt
 
Operations Research Problem
Operations Research  ProblemOperations Research  Problem
Operations Research Problem
 
Introduction of determinant
Introduction of determinantIntroduction of determinant
Introduction of determinant
 
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
 
Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3Andrew_Hair_Assignment_3
Andrew_Hair_Assignment_3
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
Unit 3-Laplace Transforms.pdf
Unit 3-Laplace Transforms.pdfUnit 3-Laplace Transforms.pdf
Unit 3-Laplace Transforms.pdf
 
IRJET- Solving Quadratic Equations using C++ Application Program
IRJET-  	  Solving Quadratic Equations using C++ Application ProgramIRJET-  	  Solving Quadratic Equations using C++ Application Program
IRJET- Solving Quadratic Equations using C++ Application Program
 
SCS-MCSA- Based Architecture for Montgomery Modular Multiplication
SCS-MCSA- Based Architecture for Montgomery Modular MultiplicationSCS-MCSA- Based Architecture for Montgomery Modular Multiplication
SCS-MCSA- Based Architecture for Montgomery Modular Multiplication
 
Mat lab
Mat labMat lab
Mat lab
 
gmrit-cse
gmrit-csegmrit-cse
gmrit-cse
 
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudskoCHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
 
Ap for b.tech. (mechanical) Assignment Problem
Ap for b.tech. (mechanical) Assignment Problem Ap for b.tech. (mechanical) Assignment Problem
Ap for b.tech. (mechanical) Assignment Problem
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
 

Dernier

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Dernier (20)

(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

FDM Numerical solution of Laplace Equation using MATLAB

  • 1. Numerical Analysis Visit my BlogSpot http://ayaozaki.blogspot.com/2014/06/ fdm-numerical-solution-of-laplace.html 6/25/2014 Aya Zaki 1
  • 2. A Finite Difference Method for Laplace’s Equation • A MATLAB code is introduced to solve Laplace Equation. • 2 computational methods are used: – Matrix method – Iteration method • Advantages of the proposed MATLAB code: – The number of the grid point can be freely chosen according to the required accuracy. – The boundary conditions can simply be changed. 6/25/2014 Aya Zaki 2
  • 3. A Finite Difference Method for Laplace’s Equation (cont.) • Example (Sheet 4) • Grid: N=3 • B.C. shown 6/25/2014 Aya Zaki 3 50 37.5 25 12.5 37.52512.5 000 0 0 0 0 0 200mm 200mm T(i,j)
  • 4. I. Matrix computation method • Example (Sheet 4) • Grid: N=3 • The code generates the equations to be solved: 𝑨 𝑼 = 𝑩 6/25/2014 Aya Zaki 4 k -4 1 0 1 0 0 0 0 0 1 -4 1 0 1 0 0 0 0 0 1 -4 0 0 1 0 0 0 1 0 0 -4 1 0 1 0 0 0 1 0 1 -4 1 0 1 0 0 0 1 0 1 -4 0 0 1 0 0 0 1 0 0 -4 1 0 0 0 0 0 1 0 1 -4 1 0 0 0 0 0 1 0 1 -4 0 0 -12.5 0 0 -25. 0 -12.5 -25.0 -75.0 T11 T21 T31 T21 T22 T23 T31 T32 T33 =
  • 5. U = inv(A)*B; %Re-arrange for j= 1:N for i=1:N T(j+1,i+1)= U((j- 1)*N+i); end end for i= 1:N for j=1:N k= (j-1)*N +i; A(k,k)= -4; for m = i-1: 2:i+1 if ((m<1) ||(m>N)) B(k)= B(k) -T(m+1,j+1); else l = (j-1)*N+m; A(k,l)= 1; end end for n = j-1: 2:j+1 if ((n<1) ||(n>N)) B(k)= B(k)- T(i+1,n+1); else l = (n-1)*N+i; A(k,l)= 1; end end end end I. Matrix computation method(cont.) • Code 6/25/2014 Aya Zaki 5 N=3; T = zeros(N+2, N+2); x = linspace(0,200e-3, N+2); y = linspace(0,200e-3, N+2); %Boundary Conditions % Y- left T(:,N+2) = linspace(0,50,N+2) % Top T(N+2,:)= linspace(0,50,N+2) A , B
  • 6. • T= I. Matrix computation method(cont.) 6/25/2014 Aya Zaki 6 0 0 0 0 0 0 3.125 6.25 9.375 12.5 0 6.25 12.5 18.75 25 0 9.375 18.75 28.125 37.5 0 12.5 25 37.5 50 50 37.5 25 12.5 37.52512.5 000 0 0 0 0 0 3.125 6.25 9.375 6.25 9.375 12.5 18.75 18.75 28.125
  • 7. I. Matrix computation method(cont.) 6/25/2014 Aya Zaki 7 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed with solving the Matrix. Distance y surf(x,y,T); • Plotting T
  • 8. • Plotting T I. Matrix computation method(cont.) 6/25/2014 Aya Zaki 8 contour(x,y,T); Temperature plot (contourf) 0 0.05 0.1 0.15 0.2 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0 5 10 15 20 25 30 35 40 45
  • 9. • N= 50 I. Matrix computation method(cont.) 6/25/2014 Aya Zaki 9 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed with solving the Matrix. Distance y
  • 10. for k=1:20 for i=2:N+1 for j=2:N+1 un(i,j)=(un(i+1,j)+un(i-1,j)+un(i,j+1)+un(i,j-1))/4; end end end II. Iteration computation method • Code – Number of iterations = 20 – The better the initial guess, the faster the computation is. – For simplicity, the initial value for all points is chosen as zero. 6/25/2014 Aya Zaki 10 N=3; T = zeros(N+2, N+2); x = linspace(0,200e-3, N+2); y = linspace(0,200e-3, N+2); %Boundary Conditions % Y- left T(:,N+2) = linspace(0,50,N+2) % Top T(N+2,:)= linspace(0,50,N+2)
  • 11. • T= II. Iteration computation method (cont.) 6/25/2014 Aya Zaki 11 0 0 0 0 0 0 3.125 6.25 9.375 12.5 0 6.25 12.5 18.75 25 0 9.375 18.75 28.125 37.5 0 12.5 25 37.5 50
  • 12. • Plotting T II. Iteration computation method (cont.) 6/25/2014 Aya Zaki 12 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed with 20 iteration. Distance y The same results were obtained as before. 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50
  • 13. • Plotting T II. Iteration computation method (cont.) 6/25/2014 Aya Zaki 13 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed with 20 iteration. Distance y The same results were obtained as before. 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50
  • 14. • Plotting T II. Iteration computation method (cont.) 6/25/2014 Aya Zaki 14 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed with 20 iteration. Distance y The same results were obtained as before.
  • 15. A Finite Difference Method for Laplace’s Equation (cont.) • Example (Sheet 4) • Grid: N=3 • B.C. with lower edge insulated. 6/25/2014 Aya Zaki 15 50 37.5 25 12.5 37.52512.5 000 0 0 0 0 0 200mm 200mm T(i,j)
  • 16. Lower Edge Insulated • Example (Sheet 4) • Grid: N=3 • B.C. with lower edge insulated. 6/25/2014 Aya Zaki 16 50 37.5 25 12.5 37.52512.5 0 0 0 0 T 0 5.0367 8.6453 8.6450 0 0 5.7508 10.4498 12.9673 12.5000 0 7.5166 14.4358 20.2743 25.0000 0 9.8797 19.5024 28.6942 37.5000 0 12.5000 25.0000 37.5000 50.0000
  • 17. Lower Edge Insulated • Plot of T 6/25/2014 Aya Zaki 17 N =3 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed. Distance y
  • 18. Lower Edge Insulated • N = 100 6/25/2014 Aya Zaki 18 0 0.05 0.1 0.15 0.2 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance x Numerical solution computed. Distance y 0 0.05 0.1 0.15 0.2 0 10 20 30 40 50 Distance y Temperature(C) Plot of Temperature at different x points 0mm 100mm 200mm
  • 19. Lower Edge Insulated • N = 100 6/25/2014 Aya Zaki 19 Temperature plot (contourf) 0 0.05 0.1 0.15 0.2 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0 5 10 15 20 25 30 35 40 45