Change solution from 1D to 2D
1 次查看(过去 30 天)
显示 更早的评论
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--');
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!