The code looks fine for me.
SOLVING PDE using MATLAB
2 次查看(过去 30 天)
显示 更早的评论
clc;clear all;close all;
L = 1;
x = linspace(0,L,75);
t = linspace(0,1,75);
m = 0;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
sol1=sol;
figure(1)
surf(x,t,sol1);
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Temperature Distribution in Finite Slab, Nu=1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx)
c = 1;
f = dudx;
s = 0;
end
function u0 = heatic(x)
u0 = 1;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
Nu = 1.0;
pl = 0;
ql = 1;
pr = Nu*ur;
qr = 1;
end
Can someone please verify if the plot as well as the method is correct ? I am trying to solve the pde in images using matlab
回答(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!