function shuzhi
m = 0;
z = linspace(0,6,20);%轴向长度
t = linspace(0,50,5);%时间刻度
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,z,t);
% Extract the first solution component as u.
c = sol(:,:,1);
% A surface plot is often a good way to study a solution.
surf(z,t,c)
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance z')
ylabel('Time t')
% A solution profile can also be illuminating.
figure
plot(z,c(end,:))
title('Solution at z = 2')
xlabel('Distance z')
ylabel('c(z,2)')
% --------------------------------------------------------------
function = pdex1pde(x,t,c,DcDz)
T=298;%环境温度(室温)
D = 396*(T/273)^1.75;%水分扩散系数
f = DcDz;
s = 0;
% --------------------------------------------------------------
function c0 = pdex1ic(x)
c0 = 34.37;%初始水分含量
% --------------------------------------------------------------
function = pdex1bc(xl,ul,xr,ur,t)
a=0.355;%轴向扩系系数
pl = ul;
ql = 0;
pr = a*(34.37-11.20)/461.6*exp(-t);
qr = 6;
文件存成shuzhi.m在命令行键入shuzhi就会有结果并绘图。不过发现一个问题:
m = 0;
z = linspace(0,6,20);%轴向长度
t = linspace(0,50,5);%时间刻度
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,z,t);
% Extract the first solution component as u.
c = sol(:,:,1);
% A surface plot is often a good way to study a solution.
surf(z,t,c)
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance z')
ylabel('Time t')
% A solution profile can also be illuminating.
figure
plot(z,c(end,:))
title('Solution at z = 2')
xlabel('Distance z')
ylabel('c(z,2)')
把这段代码复制粘贴到命令行,也能运行。照理说结果应该一样才对啊,可是实际上得出的曲线却完全不一样!高手给找一下看是什么原因、、 把
pdex1pde
pdex1ic
pdex1bc
这三个函数单独存成三个文件就可以了 本来想把《偏微分方程的MATLAB解法》的电子版传上去,可是还想不能上传,说文件格式不对 请有这本书的朋友,能不能给我也传一份啊?我的邮箱是:wangyinding@163.com 多谢
也给我传一本吧
我的邮箱liuxing28@126.com
感激 《偏微分方程的MATLAB解法》
有这本书的朋友,麻烦也给我传一份吧,我要解一个非线性方程组。谢谢!
baolei241@163.com
页:
1
[2]