ex26ch2.m
来自「these codes are for solving OED with mat」· M 代码 · 共 24 行
M
24 行
function ex26ch2options = odeset('Stats', 'on', 'Events', @ex19ach1e);tspan = [0 2];yzero = [0 ; 0];[t,y,te,ye,ie] = ode45(@ex26ch2f, tspan, yzero, options);exactt = zeros(9,1);for i = 1 : 9 exactt(i) = 2 * sqrt(i/10);enddisp('ie follows: '), disp(ie)disp('ye follows: '), disp(ye)disp('Approximate t follows: '), disp(te)disp('Exact t follows: '), disp(exactt)%===========================================================function yprime = ex26ch2f(t,y)yprime = [y(2) ; 1/2];function [value, isterminal, direction] = ex19ach1e(t,y)isterminal = [0;0;0;0;0;0;0;0;0];direction = [0;0;0;0;0;0;0;0;0];value = zeros(9,1);for i = 1 : 9 value(i) = y(1) - i / 10;end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?