pde mass transfer with reaction
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/996015/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/996020/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/996025/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/996030/image.png)
I think S= lamda* theat^@ but I do not know how to write it in matlab. Can you please correct the BC's
%HERE IS MY CODE
clc;clear all;close all;
L = 1;
x = linspace(0,L,50);
t = linspace(0,1,50);
% t = [linspace(0,0.05,20), linspace(0.5,5,10)];
m = 1;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
% colormap hot
sol1=1-sol;
figure(1)
surf(x,t,sol1);
% imagesc(x,t,sol)
% colorbar
% plot3(x,t,sol)
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Fig 12.1-1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx)
c = 1;
f = dudx;
s = 0;
end
function u0 = heatic(x)
u0 = 0;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = ul-1;
ql = 0;
pr = ur+1 ;
qr = 0;
end
0 commentaires
Réponses (1)
Torsten
le 12 Mai 2022
Modifié(e) : Torsten
le 12 Mai 2022
clc;clear all;close all;
L = 1;
x = linspace(0,L,50);
t = linspace(0,1,50);
% t = [linspace(0,0.05,20), linspace(0.5,5,10)];
m = 0;
lambda = 1.0;
sol = pdepe(m,@(x,t,u,dudx)heatpde(x,t,u,dudx,lambda),@heatic,@heatbc,x,t);
sol1 = 1-sol(:,:,1); % Don't know why you want to plot 1-theta instead of theta
% colormap hot
figure(1)
surf(x,t,sol1);
% imagesc(x,t,sol)
% colorbar
% plot3(x,t,sol)
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Fig 12.1-1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx,lambda)
c = 1;
f = dudx;
s = -lambda^2*u;
end
function u0 = heatic(x)
u0 = 0;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = 0.0;
ql = 1.0;
pr = ur-1 ;
qr = 0.0;
end
0 commentaires
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!