Matrix input for Delayed Differential Equations
10 次查看(过去 30 天)
显示 更早的评论
Hello, could you please help me with solving system of Delayed Differential equations with matrix input?
Initially my equation is looks like 

τ - constant delay
X - is vector of n elements
c - constant
- diag. matrix of n elements
- vector of zeros, only first element is equal to 
I decided to choose DDE23 solver, but I'm not sure is it correct or not. Would be great to here some comments.
I put "lags" as constant = [1], I'm not sure is it correct or not, my idea was to get data from previous timestep which is in my case is 1 as I put in tspan vector.
Also I decrease order of differential equation as
Could you please tell me is it correct solver for this task? I noticed that nothing is changes with changing delay value.
How can I display movement of last element of my system (n th element). Is it correct way how I did below?
Below is my Matlab Code with some comments:
tspan = 1:1:5;
%%sol = dde23( ddefile, lags, history, tspan);
sol = dde23( @dde, [1], @history, tspan);
ax1 = subplot(2,1,1);
plot(sol.x,sol.y);
grid on;
title('sol.x, sol.y')
xlabel('time t');
ylabel('x(t)');
ax2 = subplot(2,1,2);
grid on;
title('deval')
xplot = 1:1:10;
yplot = deval(sol,xplot,size(n));
plot(xplot,yplot);
xlabel('time t');
ylabel('x(t)');
function xdot=dde(t,x,Z) % x - state of system (position of each block)
n=3; %number of elements for simplicity put 3 for now
v0=zeros(n,1);
v0(1)=1;
% c matrix
c=1;
C=zeros(n);
C(end,end)=c;
% D Matrix
d=1;
D=d*eye(n);
% M Matrix
m=1;
M=m*eye(n);
%% The differential equations:
xlag = Z(1:n,1);
x1 = zeros(n,1);
x2 = zeros(n,1);
x1dot = zeros(n,1);
x2dot = zeros(n,1);
xdot = zeros(2*n,1);
x1 = xdot(1:n);
x2 = xdot(n+1:end);
x1dot = x2;
x2dot = v0*t-M*xlag-D*x1-C*x2;
xdot = [x1dot; x2dot];
end
function s = history(t)
n=3
s=zeros(2*n,1)
for i=1:2*n
s(i,1)=1;
end
end
4 个评论
madhan ravi
2018-12-25
Basically I don't see any equations at all , all I see is zeros in those equations
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
