登录论坛

查看完整版本 : [求助]用pdepe求解偏微分方程时遇到分段边界条件的问题


WFFF
2009-04-06, 11:03
用Matlab中的pdepe函数求解偏微分方程时,左边界条件是一个分段函数。左边界开始的时候是1,在t时刻后,左边界突变为0。在写左边界的时候,试着用if语句来分段,但是运行程序的时候,出错。

整个边界条件函数如下:
function [pl,ql,pr,qr] = pdeadbc(xl,ul,xr,ur,t)
global tphase2
if t <= tphase2
u0 = 1;
end
if t > tphase2
u0 = 0;
end
pl = ul-u0;
ql = 0;
pr = 0;
qr = 1;

出错信息如下:

>> Warning: Failure at t=9.000000e+002 (该时刻是分段点). Unable to meet integration tolerances without reducing the step size below the smallest value allowed (3.197442e-012) at time t.
(Type "warning off MATLABde15s:IntegrationTolNotMet" to suppress this warning.)
> In C:\MATLAB7.0\toolbox\matlab\funfun\ode15s.m at line 743
In C:\MATLAB7.0\toolbox\matlab\funfun\pdepe.m at line 287
In C:\-
??? Subscripted assignment dimension mismatch.

Error in ==> C:\MATLAB7.0\toolbox\matlab\funfun\pdepe.m
On line 291 ==> sol(:,:,i) = y(:,i:npde:end);

Error in ==> C:\---
On line 22 ==> sol = pdepe(0,@pdead,@pdeadic,@pdeadbc,x,t); % ad

后来我看了ode15s和pdepe两个函数的编码 感觉好像是ode15s的编码需要进行修改 解决掉Unable to meet integration tolerances 这个问题

论坛上的高手们能不能帮忙给点意见 帮我解决掉这个难题 多谢了