声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

12
返回列表 发新帖
楼主: 花如月

[应用数学] 经典偏微分方程求解的问题

[复制链接]
 楼主| 发表于 2007-7-12 18:52 | 显示全部楼层
多亏了各位的帮忙啊,总算是做出来一个简单的:
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 [D,f,s] = 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 [pl,ql,pr,qr] = 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)')
把这段代码复制粘贴到命令行,也能运行。照理说结果应该一样才对啊,可是实际上得出的曲线却完全不一样!高手给找一下看是什么原因、、

评分

1

查看全部评分

回复 支持 反对
分享到:

使用道具 举报

发表于 2007-7-13 06:24 | 显示全部楼层

pdex1pde
pdex1ic
pdex1bc

这三个函数单独存成三个文件就可以了

评分

1

查看全部评分

发表于 2007-12-3 21:44 | 显示全部楼层
本来想把《偏微分方程的MATLAB解法》的电子版传上去,可是还想不能上传,说文件格式不对
发表于 2009-7-10 08:25 | 显示全部楼层
请有这本书的朋友,能不能给我也传一份啊?我的邮箱是:wangyinding@163.com
发表于 2009-9-25 17:30 | 显示全部楼层
多谢
也给我传一本吧
我的邮箱liuxing28@126.com
感激
发表于 2009-10-14 10:46 | 显示全部楼层
《偏微分方程的MATLAB解法》
有这本书的朋友,麻烦也给我传一份吧,我要解一个非线性方程组。谢谢!
baolei241@163.com
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-15 14:25 , Processed in 0.062602 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表