How would I solve a Laplace Equation using the FDM method?

I have to use the FDM method to solve the equation on the first image.
Using FDM method as in the second image, how would I solve this equation with matlab?
condition : d = 1.
<<
>>

2 Comments

m=[1;10;500;1000;50000];
x=[0:dx:d];
figure
for j=1:5
N=m(j);
for n=1:1:N
for i=2:1:Nx
V(i)=(V(i+1)+V(i-1))/2;
end
end
plot(x,V)
hold on
V=zeros(Nx+1,1);
V(1,1)=V0;
V(Nx+1,1)=V1;
end
this is a solution when the Laplace equation equals to 0. How would I make it so that it equals 24x as in the image?
In the calculation for V(i) you reference V(i+1) which has not yet been computed. Thus your "solution" for Laplace = 0 must come out wrong.

Sign in to comment.

Answers (1)

Solve A*V=b where A, b result from the system of equations
V(1) = V0
(V(i+1)-2*V(i)+V(i-1))/h^2 = 24*x(i) (i=2,...,Nx)
V(Nx+1) = V1
with V0 = 0, V1 = 3.
Best wishes
Torsten.

Tags

Asked:

on 20 Sep 2018

Commented:

on 20 Sep 2018

Community Treasure Hunt

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

Start Hunting!