急求用matlab求解一阶偏微分方程组的程序! 100
最好给出一个双曲型的方程组(两个方程)。求高手救救我啊!!如果写的好,我追加200分。sj_z0514@163.com...
最好给出一个双曲型的方程组(两个方程)。
求高手救救我啊!!
如果写的好,我追加200分。
sj_z0514@163.com 展开
求高手救救我啊!!
如果写的好,我追加200分。
sj_z0514@163.com 展开
展开全部
程序比较长,俺试着运行了一下,还好用。是俺去年写的,现在自己看也费劲,好在当时注释了一下,慢慢看啊。用的pdepe()函数。
function pdex4
%PDEX4 Example 4 for PDEPE
% This example illustrates the solution of a system of partial differential
% equations with PDEPE. It is a problem from electrodynamics that has boundary
% layers at both ends of the interval. Also, the solution changes rapidly for
% small t. This is Example 1 of [1].
%
% The PDEs are
%
% D(u1)/Dt = 0.024*D^2(u1)/Dx^2 - F(u1 - u2)
% D(u2)/Dt = 0.170*D^2(u2)/Dx^2 + F(u1 - u2)
%
% where F(y) = exp(5.73*y) - exp(-11.46*y).
%
% In the form expected by PDEPE, the equations are
%
% |1| |u1| | 0.024*D(u1)/Dx | |- F(u1 - u2) |
% | | .* D_ | | = D_ | | + | |
% |1| Dt |u2| Dx | 0.170*D(u2)/Dx | |+ F(u1 - u2) |
%
% --- --- ------------------ ---------------
% c u f(x,t,u,Du/Dx) s(x,t,u,Du/Dx)
%
% The initial condition is u1(x,0) = 1 and u2(x,0) = 0 for 0 <= x <= 1.
% The left boundary condition is D(u1)/Dx = 0, u2(0,t) = 0. The
% condition on the partial derivative of u1 has to be written in terms
% of the flux. In the form expected by PDEPE, the left bc is
%
% |0 | |1| | 0.024*D(u1)/Dx | |0|
% | | + | | .* | | = | |
% |u2| |0| | 0.170*D(u2)/Dx | |0|
%
% --- --- ------------------ ---
% p(0,t,u) q(0,t) f(0,t,u,Du/Dx) 0
%
% The right boundary condition is u1(1,t) = 1, D(u2)/Dx = 0:
%
% |u1 - 1| |0| | 0.024*D(u1)/Dx | |0|
% | | + | | .* | | = | |
% | 0 | |1| | 0.170*D(u2)/Dx | |0|
%
% ------- ----- ------------------ ---
% p(1,t,u) q(1,t) f(1,t,u,Du/Dx) 0
%
% See the subfunctions PDEX4PDE, PDEX4IC, and PDEX4BC for the coding of the
% problem definition.
%
% The solution changes rapidly for small t. The program selects the step
% size in time to resolve this sharp change, but to see this behavior in
% the plots, output times must be selected accordingly. There are boundary
% layers in the solution at both ends of [0,1], so mesh points must be
% placed there to resolve these sharp changes.
%
% [1] D03PBF, NAG Library Manual, Numerical Algorithms Group, Oxford.
%
% See also PDEPE, @.
% Lawrence F. Shampine and Jacek Kierzenka
% Copyright 1984-2002 The MathWorks, Inc.
% $Revision: 1.6 $ $Date: 2002/04/08 20:04:50 $
m = 0;
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure;
surf(x,t,u1);
title('u1(x,t)');
xlabel('Distance x');
ylabel('Time t');
figure;
surf(x,t,u2);
title('u2(x,t)');
xlabel('Distance x');
ylabel('Time t');
% ------------------------------------------------------------------
function [c,f,s] = pdex4pde(x,t,u,DuDx)
c = [1; 1];
f = [0.024; 0.17] .* DuDx;
y = u(1) - u(2);
F = exp(5.73*y)-exp(-11.47*y);
s = [-F; F];
% ------------------------------------------------------------------
function u0 = pdex4ic(x);
u0 = [1; 0];
% ------------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
pl = [0; ul(2)];
ql = [1; 0];
pr = [ur(1)-1; 0];
qr = [0; 1];
function pdex4
%PDEX4 Example 4 for PDEPE
% This example illustrates the solution of a system of partial differential
% equations with PDEPE. It is a problem from electrodynamics that has boundary
% layers at both ends of the interval. Also, the solution changes rapidly for
% small t. This is Example 1 of [1].
%
% The PDEs are
%
% D(u1)/Dt = 0.024*D^2(u1)/Dx^2 - F(u1 - u2)
% D(u2)/Dt = 0.170*D^2(u2)/Dx^2 + F(u1 - u2)
%
% where F(y) = exp(5.73*y) - exp(-11.46*y).
%
% In the form expected by PDEPE, the equations are
%
% |1| |u1| | 0.024*D(u1)/Dx | |- F(u1 - u2) |
% | | .* D_ | | = D_ | | + | |
% |1| Dt |u2| Dx | 0.170*D(u2)/Dx | |+ F(u1 - u2) |
%
% --- --- ------------------ ---------------
% c u f(x,t,u,Du/Dx) s(x,t,u,Du/Dx)
%
% The initial condition is u1(x,0) = 1 and u2(x,0) = 0 for 0 <= x <= 1.
% The left boundary condition is D(u1)/Dx = 0, u2(0,t) = 0. The
% condition on the partial derivative of u1 has to be written in terms
% of the flux. In the form expected by PDEPE, the left bc is
%
% |0 | |1| | 0.024*D(u1)/Dx | |0|
% | | + | | .* | | = | |
% |u2| |0| | 0.170*D(u2)/Dx | |0|
%
% --- --- ------------------ ---
% p(0,t,u) q(0,t) f(0,t,u,Du/Dx) 0
%
% The right boundary condition is u1(1,t) = 1, D(u2)/Dx = 0:
%
% |u1 - 1| |0| | 0.024*D(u1)/Dx | |0|
% | | + | | .* | | = | |
% | 0 | |1| | 0.170*D(u2)/Dx | |0|
%
% ------- ----- ------------------ ---
% p(1,t,u) q(1,t) f(1,t,u,Du/Dx) 0
%
% See the subfunctions PDEX4PDE, PDEX4IC, and PDEX4BC for the coding of the
% problem definition.
%
% The solution changes rapidly for small t. The program selects the step
% size in time to resolve this sharp change, but to see this behavior in
% the plots, output times must be selected accordingly. There are boundary
% layers in the solution at both ends of [0,1], so mesh points must be
% placed there to resolve these sharp changes.
%
% [1] D03PBF, NAG Library Manual, Numerical Algorithms Group, Oxford.
%
% See also PDEPE, @.
% Lawrence F. Shampine and Jacek Kierzenka
% Copyright 1984-2002 The MathWorks, Inc.
% $Revision: 1.6 $ $Date: 2002/04/08 20:04:50 $
m = 0;
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure;
surf(x,t,u1);
title('u1(x,t)');
xlabel('Distance x');
ylabel('Time t');
figure;
surf(x,t,u2);
title('u2(x,t)');
xlabel('Distance x');
ylabel('Time t');
% ------------------------------------------------------------------
function [c,f,s] = pdex4pde(x,t,u,DuDx)
c = [1; 1];
f = [0.024; 0.17] .* DuDx;
y = u(1) - u(2);
F = exp(5.73*y)-exp(-11.47*y);
s = [-F; F];
% ------------------------------------------------------------------
function u0 = pdex4ic(x);
u0 = [1; 0];
% ------------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
pl = [0; ul(2)];
ql = [1; 0];
pr = [ur(1)-1; 0];
qr = [0; 1];
参考资料: 《化工计算》
富港检测技术(东莞)有限公司_
2024-04-02 广告
2024-04-02 广告
正弦振动多用于找出产品设计或包装设计的脆弱点。看在哪一个具体频率点响应最大(共振点);正弦振动在任一瞬间只包含一种频率的振动,而随机振动在任一瞬间包含频谱范围内的各种频率的振动。由于随机振动包含频谱内所有的频率,所以样品上的共振点会同时激发...
点击进入详情页
本回答由富港检测技术(东莞)有限公司_提供
展开全部
用parabolic函数、matlab本身的偏微分函数库有很多的,这个最常用。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
parabolic函数、matlab本身的偏微分函数库有很多的,这个最常用。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
3楼只是抛物线方程组求解而已,楼主求双曲的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询