필터 지우기
필터 지우기

how i can write periodic boundary condition

조회 수: 2 (최근 30일)
lulu
lulu 2020년 1월 31일
댓글: Mahesh Taparia 2020년 2월 3일
clear
clc
xmin=0;
xmax=1;
N=10;
dt=0.001;
t=0;
tmax=0.5;
a=0.1;
L=2;
dx=(xmax-xmin)/N;
x=xmin-dx:dx:xmax+dx;
u0=exp(-(x-L/2).^2);
u=u0;
unp1=u0;
v0=exp(-(x-L/2).^2);
v=v0;
vnp1=v0;
nstep=tmax/dt;
for n=1:nstep
u(1)=u(3);
u(3+N)=u(1+N);
v(3)=v(1);
v(N+1)=v(N+3);
for i=2:N+2
unp1(i)= -a*u(i-1);
vnp1(i)=a*v(i-1);
end
t=t+dt;
u=unp1;
v=vnp1;
end
plot(u,'b');
hold on
plot(v);
hold off
  댓글 수: 1
Mahesh Taparia
Mahesh Taparia 2020년 2월 3일
Hi
Can you give more details what you want to do?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by