# how i can solve the following PDE using periodic boundry coditions

8 views (last 30 days)
lulu on 28 Jan 2020
Answered: Josh Meyer on 30 Jan 2020
clear all,close all
x=linspace(0,1,50);
t=linspace(0,1,50);
m=0;
eqn=@(x,t,u,dudx)transistorPDE(x,t,u,dudx,C);
ic=@(x)transistorIC(x,C);
sol=pdepe((m,eqn,ic,transistorBC,x,t);
function [c,f,s]=transistorPDE(x,t,u,dudx,C)
a=0.1;
c=1;
f=0;
s=-a*dudx;
end
function u0=transistorIC(x,C)
L=1;
u0=exp(-(x-L/2)^2);
end
function [pl,ql,pr,qr]=transistorBC(xl,ul,xr,ur,t)
pl=ul;
ql=0;
pr=pl;
qr=0;
end

Josh Meyer on 30 Jan 2020
Periodic boundary conditions require that when something leaves one boundary with a certain velocity, it enters the boundary on the other side with the same velocity. In other words: So, you would need to modify your values for the qL and qR coefficients in transistorBC to incorporate the flux term (which generally includes the above partial derivative). The boundary conditions are written in the standardized form: The flux term f is defined in the main pdefun function. In your case, you have f = 0 so would not be able to do this without also redefining your flux term (which would also change what equation you're solving).