You are on page 1of 4

Name –Abhishek Sharma

Adm No- 19SCSE1010377


EXP-12
OBJECTIVE: Write a script file to solve and plot the solution of
two dimensional Laplace equation with given boundary
conditions:
PROGRAM:
clc
clear
clf
H=1
L=2
n=20
function w1=f(x)
w1=100*x*(L-x)^3
endfunction
for i=1:n
function w2=f1(x)
w2=f(x)*sin(i*%pi*x/L)
endfunction
A(i)=(2/(L*sinh(i*%pi*H/L)))*integrate('f1(x)','x',0,L)
end
function uu=u(x, y)
uu=0
for j=1:n
uu=uu+A(j)*sin(j*%pi*x/L)*sinh(j*%pi*y/L);
end
endfunction
x=[0:L/40:L],y=[0:H/20:H];
u1=feval(x,y,u)
plot3d(x,y,u1,'x@t@u(x,y)')
scf(1)
plot(x',u1(:,1),"*g",x',u1(:,3),"xr",x',u1(:,6),"-b",x',u1(:,9),"+k")
u1=feval(L/20,L/10,u)
disp(u1)
Name –Abhishek Sharma
Adm No- 19SCSE1010377
EXP-12
Name –Abhishek Sharma
Adm No- 19SCSE1010377
EXP-12
Name –Abhishek Sharma
Adm No- 19SCSE1010377
EXP-12

You might also like