Please help me solve this material balance
이전 댓글 표시

댓글 수: 8
Rachael
2023년 9월 12일
Rachael
2023년 9월 12일
You can follow the example of solving a system of PDEs in this link:
Use the template below to define the parameters and code the equations in the 'Local functions' section. If there is an error message, show the code.
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
m = 0;
sol = pdepe(m, @pdefun, @pdeic, @pdebc, x, t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
surf(x,t,u1)
title('u_1(x,t)')
xlabel('Distance x')
ylabel('Time t')
surf(x,t,u2)
title('u_2(x,t)')
xlabel('Distance x')
ylabel('Time t')
%% -------------- Local functions --------------
% Partial Differential Equation to solve
function [c, f, s] = pdefun(x, t, u, dudx)
c = [1; 1];
f = [0.024; 0.17].*dudx;
y = u(1) - u(2);
F = exp(5.73*y) - exp(- 11.47*y);
s = [-F; F];
end
% Initial Conditions
function u0 = pdeic(x)
u0 = [1; 0];
end
% Boundary Conditions
function [pl, ql, pr, qr] = pdebc(xl, ul, xr, ur, t)
pl = [0; ul(2)];
ql = [1; 0];
pr = [ur(1)-1; 0];
qr = [0; 1];
end
Rachael
2023년 9월 13일
Rachael
2023년 9월 13일
채택된 답변
추가 답변 (1개)
Sam Chak
2023년 9월 13일
2 개 추천
카테고리
도움말 센터 및 File Exchange에서 Electromagnetics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








