⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gasbvp.m

📁 如何利用bvp4c解决微分方程的边值问题的几个例子。
💻 M
字号:
function gasbvp
%GASBVP  Exercise for Example 5 of the BVP tutorial.
%   Example 8.4 of P.B. Bailey, L.F. Shampine, and P.E. Waltman, 
%   Nonlinear Two Point Boundary Value Problems, Academic, New York,
%   1968.  This is a problem on an infinite interval with a parameter
%   alpha here taken to be 0.8.  w(z) should decrease monotonely
%   from 1 to 0.


infinity = 3;

options = bvpset('stats','on');

solinit = bvpinit(linspace(0,infinity,5),[0.5 -0.5]);
sol = bvp4c(@gasode,@gasbc,solinit,options);
z = sol.x;
w = sol.y;

clf reset
plot(z,w(1,:));
axis([0 infinity 0 1]);
xlabel('z');
ylabel('w');
title('Unsteady gas flow in a semi-infinite porous medium.');
shg

% --------------------------------------------------------------------------

function dydz = gasode(z,y)
%GASODE  ODE function for the exercise of Example 5 of the BVP tutorial.
alpha = 0.8;
dydz =  [  y(2)
          -y(2)*2*z / sqrt(1 - alpha*y(1)) ];

% --------------------------------------------------------------------------

function res = gasbc(ya,yb)
%GASBC  Boundary conditions for the exercise of Example 5 of the BVP tutorial.
res = [ ya(1) - 1 
        yb(1)     ];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -