ex22ch3.m

来自「these codes are for solving OED with mat」· M 代码 · 共 24 行

M
24
字号
function ex22ch3clf resethold onfor i = 1:3    infinity = 5*i;    if i == 1        solinit = bvpinit(linspace(0,infinity,5),[pi 0]);    else 		solinit = bvpinit(sol,[0,infinity]);    end	sol = bvp4c(@odes,@bcs,solinit);	plot(sol.x,sol.y(1,:),sol.x(end),sol.y(1,end),'ro');	axis([0 15 0 4]);	drawnowendhold offfprintf('Initial slope of 2 is approximated by %g.\n',sol.y(2,1));%===========================================================function dydz = odes(z,y)dydz =  [ y(2); -sin(y(1)) ];function res = bcs(ya,yb)res = [ ya(1); yb(1)-pi ];

⌨️ 快捷键说明

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