延迟微分方程
第一个例子:
代码如下:
ddex1dez = @(t,y,Z) [y(1)*(1 + 0.1*sin(t)-0.1*Z(1,1) – y(2)/(1+y(1)) ); y(2)*( (2+sin(t))*10^(-5) + 9*Z(1,2)/(1+Z(1,2)) – Z(2,1) )];
%y(1)表示x_1(t),因为dde求解的结果中sol会有个x,为了区别用y(1)表示x_1(t);Z(1,1)表示时滞项x_1(t-0.1);Z(1,2)表示时滞项x_1(t-0.3)
sol = dde23(ddex1dez,[0.1, 0.3],[2 2],[0, 50]);%dde23(@….,tau,history,tspan);
%[0.1, 0.3]是时滞,[2 2]是初值,[0, 50]是时间范围
figure; % plot(sol.x,sol.y) plot(sol.x,sol.y(1,:) ) hold on plot(sol.x,sol.y(2,:),’-.’ ) hold off
title(‘时滞微分方程组’); xlabel(‘time t’); ylabel(‘solution y’); legend(‘x1′,’x2’);
第二个例子:
This example shows how to use dde23 to solve a system of DDEs with constant delays.
The differential equations are:
are solved on [0,5] with history:
for t ≤ 0.
代码如下:
ddex1dez = @(t,y,Z) [Z(1,1);Z(1,1)+Z(2,2);y(2)];
lags = [1,0.2];
sol = dde23(ddex1dez,lags,[1 1 1],[0,5]);
plot(sol.x,sol.y); title(‘An example of Wille and Baker’); xlabel(‘time t’); ylabel(‘solution y’); legend(‘y_1′,’y_2′,’y_3′,’Location’,’NorthWest’);
tint = linspace(0,5,10); Sint = deval(sol,tint)
hold on plot(tint,Sint,’o’);
或者 按如下代码执行:
clear;clc lags=[1,0.2]; history=[1;1;1]; tspan=[0,5]; sol = dde23(@myddefun,lags,history,tspan)
plot(sol.x,sol.y)
function dy = myddefun(t,y,Z) dy=[ Z(1,1); Z(1,1)+Z(2,2); y(2) ];
引用:
http://blog.sina.com.cn/s/blog_3ecbcc0701013bcd.html
http://wenku.baidu.com/view/31c21f54cc1755270722088b.html
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/187033.html原文链接:https://javaforall.cn