Change solution from 1D to 2D

2 Ansichten (letzte 30 Tage)
Omar Alqubori
Omar Alqubori am 23 Feb. 2021
Beantwortet: SaiDileep Kola am 26 Feb. 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--');

Antworten (1)

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

Community Treasure Hunt

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

Start Hunting!

Translated by