Please help me solve this material balance
Afficher commentaires plus anciens

8 commentaires
Rachael
le 12 Sep 2023
Rachael
le 12 Sep 2023
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
le 13 Sep 2023
Rachael
le 13 Sep 2023
Réponse acceptée
Plus de réponses (1)
Sam Chak
le 13 Sep 2023
2 votes
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








