Change solution from 1D to 2D

조회 수: 2 (최근 30일)
Omar Alqubori
Omar Alqubori 2021년 2월 23일
답변: SaiDileep Kola 2021년 2월 26일
Hi,
Can anyone please help to change the solution from 1D to 2D.
Here is the part from my code
% % %applay analytic solution:
DDDD=0.23;
TT=1; %The exact solution changing by change the value of TT or DDDD
aaaa=0; %lower bound of space variable.
ll=10; %upper bound of space variable. %upper bound of time variable
NXxx = 30; %the number of subdivision of space interval.
NTtt=80; %the number of subdivision of time interval.
QQQQ=zeros(NTtt+1,NXxx+2); %matrix include Initial condition and Boundary conditions
%apply the initial condition
nnnn=0;
QQQQ(1,:) = nnnn;
%apply the Dirichlet boundary condition
QQQQ(:,1) = 0; %all value in rows in first coulmn=0
QQQQ(:,NXxx+2) = 0; %all value in rows in last coulmns =0
NNNNn=35;
U1=0.4;
TT=3000;
for ii=1:TT %The loop start for 2 because the satisfies the explict Euler method.
%the time loop first because one point in t we need three point from x
for jj=1:100
QQQQ(ii,jj)=(2*NNNNn/sqrt(pi))*sqrt(DDDD*ii*TT)+U1*ii;
end
end
plot(QQQQ,'k--');

답변 (1개)

SaiDileep Kola
SaiDileep Kola 2021년 2월 26일
Check the discussion here if it helps

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by