- Since delta is a constant parameter with a range of values, you'll need to update the domain of x to x = linspace(0, 1 + delta); to include the (1+delta) boundary.
- In the pdex4bc function, you need to adjust the boundary conditions to match the problem statement. The updated function should have ql = [0; 0; 0]; instead of ql = [1; 0; 0];
- The t variable in linspace(0, 1) should be modified to match the appropriate time range for your problem.
- “pdepe” only supports parabolic and elliptic equations, and your current PDE does not meet this requirement. By adding a small positive value epsilon in the pdex4pde function, you introduce an artificial diffusion that allows the system to be treated as a parabolic equation and can be solved using pdepe. So function pdex4pde would look like:
Plot not displayed correctly
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a system of 3 differntal equations with the boundary condition.
S'(0,t) = 0, M(0,t) = 1, P(0,t) = 0.
S(1+delta,t) = 1, M(1+delta,t) = 0, P(1+delta,t) = 0.
where delta is the constant parameter which has a range of values how to include the (1+delta) boundary can any one please correct the code. I have attached the code here.
function non_steady_mediator
m = 0;
x = linspace(0,1);
t = linspace(0,1);
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2= sol(:,:,2);
u3= sol(:,:,3);
%figure
plot(x, u1(end,:),'.',...
'MarkerEdgeColor',[0.39 0.83 0.07],...
'LineWidth',2,'MarkerSize',8)
%legend('numerical')
%surf(x,t,u2)
hold on
%title('u1(x, t)')
%xlabel('Distance x')
%ylabel('u1(x,t)')
%figure
% --------------------------------------------------------------
function [c,f,s] = pdex4pde(~,~,u,DuDx)
alpha=2;beta=5;gamma=3;sigma=0.5;varphi=2;omega=2;
c = [1;1;1];
f = [1;1;1].* DuDx;
F1=alpha^2.*u(1).*u(2)./u(1)+u(2);
F2=beta^2.*u(1).*u(2)./u(1)+u(2);
F3=gamma^2.*u(1).*u(2)./u(1)+u(2);
s = [F1;F2;F3];
% --------------------------------------------------------------
function u0 = pdex4ic(~)
u0 = [1;1;1];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(~,ul,~,ur,~)
pl = [0;ul(2)-1;ul(3)];
ql = [1;0;0];
pr = [ur(1)-1;ur(2);ur(3)];
qr = [0;0;0];
댓글 수: 0
채택된 답변
Raghav
2023년 5월 29일
Hi,
Based on the question, it can be understand that you are facing issue in plotting the differential equations while using the “pdepe” function.
There are a few corrections and modifications needed in your code to incorporate the boundary condition at (1+delta).
function [c, f, s] = pdex4pde(~, ~, u, DuDx)
alpha = 2; beta = 5; gamma = 3; sigma = 0.5; varphi = 2; omega = 2;
epsilon = 1e-5; % Small positive value for artificial diffusion
c = [1; 1; 1];
f = [1; 1; 1] .* DuDx;
F1 = alpha^2 .* u(1) .* u(2) ./ u(1) + u(2);
F2 = beta^2 .* u(1) .* u(2) ./ u(1) + u(2);
F3 = gamma^2 .* u(1) .* u(2) ./ u(1) + u(2);
s = [F1; F2; F3] + epsilon * DuDx;
end
Hope it helps,
Raghav Bansal
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 PDE Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!