solving a system of pdes using pdepe
조회 수: 1 (최근 30일)
이전 댓글 표시
So i have the follwing system of pdes:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468185/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468190/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468195/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468200/image.png)
The symmetry boundary conditions are:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468215/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468220/image.png)
The other two boundary conditions are given by:
At ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468255/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468255/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468230/image.png)
and
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/468235/image.png)
Parameter values are: k1 = 5 ,k2 =6 , C=8.
So this is the function code:
function [c,f,s] = pdefun(x,t,u,dudx)
% Equation to solve
c = [1; 1];
if x <= 2
f = 5*dudx;
else
f = 6*dudx;
end
%k1 and k2.
end
% ---------------------------------------------
function u0 = pdeic(x) % Initial Conditions
u0 = [10; 0];
end
% ---------------------------------------------
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t) % Boundary Conditions
pl = [0; 0];
ql = [0; 0];
pr = [e; f];
qr = [g; h];
end
% ---------------------------------------------
Then to solve the equation:
x = [0 0.1 0.2 0.3 0.4 0.45 0.475 0.5 0.525 0.55 0.6 0.7 0.8 0.9 0.95 0.975 0.99 1];
t = [0 0.001 0.005 0.01 0.05 0.1 0.5 1];
m = 2;
sol = pdepe(m,@pdefun,@pdeic,@pdebc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
To plot the solution:
surf(x,t,u1) %or u_{2}
title('u_1(x,t)')
xlabel('Distance x')
ylabel('Time t')
Just asking how do you write down the boundary conditions to make it suitable for pdepe as the examples provided on the matlab website don't help much with putting the boundary conditions in the standard form?
댓글 수: 1
Bill Greene
2020년 12월 23일
I have written a short note that describes pdepe boundary conditions in more detail than the pdepe documentation.
You might find that helpful.
답변 (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!