PDE with pdepe
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear Forum,
I have two partial differential equations that describe heat conduction. I want to solve it with pdepe, just like in the example given in Matlab Help under System of PDEs. The Equations are:
- DTp/Dt = ALPHAp* DTp/Dx + BETA*(Tm-Tp)
- DTm/Dt = -ALPHAm*DTm/Dx - BETA* (Tm-Tp)
My Code is:
function [c,f,s]= unserepde ( x,t,u,DuDx)
c=[1;1];
%f = [0.024; 0.17] .* DuDx;
f=[10;0.15].*DuDx;
y=u(1)-u(2);
%F = exp(5.73*y)-exp(-11.47*y);
F=0.15*y;
s=[F;-F];
end
Initial Conditions:
function u0 = unsereic(x)
u0 = [20; 120];
Boundary Conditions:
function [pl,ql,pr,qr] = unserebc(xl,ul,xr,ur,t)
pl = [-20*10; ul(2)-120];
ql = [1; 0];
pr = [ur(1)-20; -120*0.15];
qr = [0; 1];
Plotting and solving would be:
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.01 0.1 0.5 1 1.5 2 5 10 15 20 50 100 150];
m = 0;
sol = pdepe(m,@unserepde,@unsereic,@unserebc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure
surf(x,t,u1)
title('u1(x,t)')
xlabel('Distance x')
ylabel('Time t')
figure
surf(x,t,u2)
title('u2(x,t)')
xlabel('Distance x')
ylabel('Time t')
The Problem: the behaviour of the results doesn't make any sense. I have to use a negative alpha on 2. but Matlab doesn't allow to do so. I think I translated the two equations wrong into the Matlab Solver form. Could anybody help?
Thanks for your help, Yours sincerely, Markus
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur PDE Solvers dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!