# 具有状态依赖时滞的 DDE

`${{\mathit{y}}_{1}}^{\prime }\left(\mathit{t}\right)={\mathit{y}}_{2}\left(\mathit{t}\right),$`

`${{\mathit{y}}_{2}}^{\prime }\left(\mathit{t}\right)=-{\mathit{y}}_{2}\left({\mathit{e}}^{1-{\mathit{y}}_{2}\left(\mathit{t}\right)}\right)\cdot {\mathit{y}}_{2}{\left(\mathit{t}\right)}^{2}\cdot {\mathit{e}}^{1-{\mathit{y}}_{2}\left(\mathit{t}\right)}.$`

$\mathit{t}\le 0.1$ 的历史解函数是解析解

`${\mathit{y}}_{1}\left(\mathit{t}\right)=\mathrm{log}\left(\mathit{t}\right),$`

`${\mathit{y}}_{2}\left(\mathit{t}\right)=\frac{1}{\mathit{t}}.$`

### 编写时滞代码

```function d = dely(t,y) d = exp(1 - y(2)); end ```

### 编写方程代码

• `t` 是时间（自变量）。

• `y` 是解（因变量）。

• `Z(n,j)` 对时滞 ${\mathit{y}}_{\mathit{n}}\left(\mathit{d}\left(\mathit{j}\right)\right)$ 求近似值，其中时滞 $\mathit{d}\left(\mathit{j}\right)$`dely(t,y)` 的分量 `j` 给出。

• `Z(2,1)`$\text{}\to {\mathit{y}}_{2}\left({\mathit{e}}^{1-{\mathit{y}}_{2}\left(\mathit{t}\right)}\right)$

```function dydt = ddefun(t,y,Z) dydt = [y(2); -Z(2,1)*y(2)^2*exp(1 - y(2))]; end ```

### 编写历史解代码

```function v = history(t) % history function for t < t0 v = [log(t); 1./t]; end ```

### 求解方程

```tspan = [0.1 5]; sol = ddesd(@ddefun, @dely, @history, tspan);```

### 对解进行绘图

```ta = linspace(0.1,5); ya = history(ta); plot(ta,ya,sol.x,sol.y,'o') legend('y_1 exact','y_2 exact','y_1 ddesd','y_2 ddesd') xlabel('Time t') ylabel('Solution y') title('D1 Problem of Enright and Hayashi')```

### 局部函数

```function dydt = ddefun(t,y,Z) % equation being solved dydt = [y(2); -Z(2,1).*y(2)^2.*exp(1 - y(2))]; end %------------------------------------------- function d = dely(t,y) % delay for y d = exp(1 - y(2)); end %------------------------------------------- function v = history(t) % history function for t < t0 v = [log(t); 1./t]; end %-------------------------------------------```

### 参考

[1] Enright, W.H. and H. Hayashi.“The Evaluation of Numerical Software for Delay Differential Equations.”In Proceedings of the IFIP TC2/WG2.5 working conference on Quality of numerical software: assessment and enhancement.(R.F. Boisvert, ed.).London, UK:Chapman & Hall, Ltd., pp. 179-193.