Change solution from 1D to 2D

1 回表示 (過去 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 Center および File ExchangeSolver 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