ex04ch3.m
来自「these codes are for solving OED with mat」· M 代码 · 共 28 行
M
28 行
function sol = ex04ch3global yatdd = 0.001;yatd = asymp(d);solinit = bvpinit(linspace(d,1/2,10),@guess);sol = bvp4c(@odes,@bcs,solinit);xint = linspace(d,1/2);yint = deval(sol,xint);x = [0 xint];y = [0 yint(1,:)];asympy = [0 asymp(xint)];plot(x,y,x,asympy)axis([0 0.5 0 0.5])legend('Computed','Asymptotic',4)%========================================================function v = guess(x)v = [x*(1-x); 1-2*x];function dydx = odes(x,y)dydx = [y(2); -1/y(1)];function res = bcs(ya,yb)global yatdres = [ya(1)-yatd; yb(2)];function v = asymp(x)v = x.*sqrt(-2*log(x));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?