Change solution from 1D to 2D

2 visualizaciones (últimos 30 días)
Omar Alqubori
Omar Alqubori el 23 de Feb. de 2021
Respondida: SaiDileep Kola el 26 de Feb. de 2021
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--');

Respuestas (1)

SaiDileep Kola
SaiDileep Kola el 26 de Feb. de 2021
Check the discussion here if it helps

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by