SlideShare a Scribd company logo
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

More Related Content

What's hot

Presentation03 ss
Presentation03 ssPresentation03 ss
Presentation03 ss
nashaat algrara
 
Differential equations of first order
Differential equations of first orderDifferential equations of first order
Differential equations of first order
Uzair Saiyed
 
maths
maths maths
maths
sidpatel143
 
Heun's Method
Heun's MethodHeun's Method
Heun's Method
Rabin BK
 
Solving laplace equation using gauss seidel method in matlab
Solving laplace equation using gauss seidel method in matlabSolving laplace equation using gauss seidel method in matlab
Solving laplace equation using gauss seidel method in matlab
Mohamed Ahmed
 
ME-314- Control Engineering - Week 03-04
ME-314- Control Engineering - Week 03-04ME-314- Control Engineering - Week 03-04
ME-314- Control Engineering - Week 03-04
Dr. Bilal Siddiqui, C.Eng., MIMechE, FRAeS
 
Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1
Muhammad Waqas
 
Higher order ODE with applications
Higher order ODE with applicationsHigher order ODE with applications
Higher order ODE with applications
Pratik Gadhiya
 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx
saadhaq6
 
Gauss elimination & Gauss Jordan method
Gauss elimination & Gauss Jordan methodGauss elimination & Gauss Jordan method
Gauss elimination & Gauss Jordan method
Naimesh Bhavsar
 
trapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 ruletrapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 rule
hitarth shah
 
Finite Difference Method
Finite Difference MethodFinite Difference Method
Finite Difference Method
Syeilendra Pramuditya
 
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Aditya Deshpande
 
Presentation on application of numerical method in our life
Presentation on application of numerical method in our lifePresentation on application of numerical method in our life
Presentation on application of numerical method in our life
Manish Kumar Singh
 
Gamma function
Gamma functionGamma function
Gamma function
Solo Hermelin
 
Jacobi iteration method
Jacobi iteration methodJacobi iteration method
Jacobi iteration method
MONIRUL ISLAM
 
Numerical
NumericalNumerical
Numerical1821986
 
Neural Network Toolbox MATLAB
Neural Network Toolbox MATLABNeural Network Toolbox MATLAB
Neural Network Toolbox MATLABESCOM
 
Runge Kutta Method
Runge Kutta Method Runge Kutta Method
Runge Kutta Method
Bhavik Vashi
 

What's hot (20)

Presentation03 ss
Presentation03 ssPresentation03 ss
Presentation03 ss
 
Differential equations of first order
Differential equations of first orderDifferential equations of first order
Differential equations of first order
 
maths
maths maths
maths
 
Heun's Method
Heun's MethodHeun's Method
Heun's Method
 
Solving laplace equation using gauss seidel method in matlab
Solving laplace equation using gauss seidel method in matlabSolving laplace equation using gauss seidel method in matlab
Solving laplace equation using gauss seidel method in matlab
 
ME-314- Control Engineering - Week 03-04
ME-314- Control Engineering - Week 03-04ME-314- Control Engineering - Week 03-04
ME-314- Control Engineering - Week 03-04
 
Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1
 
Higher order ODE with applications
Higher order ODE with applicationsHigher order ODE with applications
Higher order ODE with applications
 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx
 
Gauss elimination & Gauss Jordan method
Gauss elimination & Gauss Jordan methodGauss elimination & Gauss Jordan method
Gauss elimination & Gauss Jordan method
 
trapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 ruletrapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 rule
 
Finite Difference Method
Finite Difference MethodFinite Difference Method
Finite Difference Method
 
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
Multi Objective Optimization and Pareto Multi Objective Optimization with cas...
 
Presentation on application of numerical method in our life
Presentation on application of numerical method in our lifePresentation on application of numerical method in our life
Presentation on application of numerical method in our life
 
Gamma function
Gamma functionGamma function
Gamma function
 
Maths
MathsMaths
Maths
 
Jacobi iteration method
Jacobi iteration methodJacobi iteration method
Jacobi iteration method
 
Numerical
NumericalNumerical
Numerical
 
Neural Network Toolbox MATLAB
Neural Network Toolbox MATLABNeural Network Toolbox MATLAB
Neural Network Toolbox MATLAB
 
Runge Kutta Method
Runge Kutta Method Runge Kutta Method
Runge Kutta Method
 

Similar to FDM Numerical solution of Laplace Equation using MATLAB

chp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.pptchp-1-matrices-determinants1.ppt
chp-1-matrices-determinants1.ppt
MichealMicheal11
 
chp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).pptchp-1-matrices-determinants1 (2).ppt
chp-1-matrices-determinants1 (2).ppt
rushikumar17
 
Determinants and matrices.ppt
Determinants and matrices.pptDeterminants and matrices.ppt
Determinants and matrices.ppt
SauravDash10
 
12000121056_priyankamanna_CA1_numericalmethod.pdf
12000121056_priyankamanna_CA1_numericalmethod.pdf12000121056_priyankamanna_CA1_numericalmethod.pdf
12000121056_priyankamanna_CA1_numericalmethod.pdf
PriyankaManna8
 
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
BAGARAGAZAROMUALD2
 
Operations Research Problem
Operations Research  ProblemOperations Research  Problem
Operations Research Problem
Taslima Mujawar
 
Introduction of determinant
Introduction of determinantIntroduction of determinant
Introduction of determinant
Pankaj Das
 
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_3Andrew Hair
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
Prabin Gautam
 
Unit 3-Laplace Transforms.pdf
Unit 3-Laplace Transforms.pdfUnit 3-Laplace Transforms.pdf
Unit 3-Laplace Transforms.pdf
JeancyMbolela
 
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
IRJET Journal
 
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
IRJET Journal
 
Mat lab
Mat labMat lab
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudskoCHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
SydneyJaydeanKhanyil
 
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
Prashant Khandelwal
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
AhsanIrshad8
 

Similar to 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
 

Recently uploaded

Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 

Recently uploaded (20)

Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 

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