understanding DDE23 function format

4 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 5 月 1 日
編集済み: alpedhuez 2020 年 5 月 4 日
DDE23 function has a format of
ddex1de(t,y,Z)
How should one understand Z?

採用された回答

Guru Mohanty
Guru Mohanty 2020 年 5 月 4 日
I understand you are trying to solve system of differential equation using ‘dde23’. To do this you need to do following steps.
  1. Define constant delays.
In this system of equation there are two lags i.e. (t-1) and (t-0.2).
lags = [1 0.2];
2. Define Solution History.
It Defines the first solution from which the solver starts iterations.
function s = history(t)
s = ones(3,1);
end
3. Form the equation.
function dydt = ddex1de(t,y,Z)
ylag1 = Z(:,1);
ylag2 = Z(:,2);
dydt = [ylag1(1);
ylag1(1)+ylag2(2);
y(2)];
end
Here In the call to ddex1de,
‘t’ is a scalar indicates the current ‘t’ in the equation
‘y’ is a column vector approximates y(t)
‘Z’ is a column vector approximates y(t – αj) for delay αj= lags(J).
In the following example Solution history is [1;1;1]. So Approximate values of lag ie ‘Z’ will be a matrix of size 3x2.In ‘Z’ Row defines the number of equations and column defines Number of lags.
4. Solve using ‘dde23’.
tspan = [0 5];
sol = dde23(@ddefun, lags, @history, tspan);
  2 件のコメント
alpedhuez
alpedhuez 2020 年 5 月 4 日
編集済み: alpedhuez 2020 年 5 月 4 日
Thank you.
1. Would you write down the content of this 3*2 matrix Z?
2. Another question:
function dydt = ddex1de(t,y,Z)
ylag1 = Z(:,1);
ylag2 = Z(:,2);
dydt = [ylag1(1);
ylag1(1)+ylag2(2);
y(2)];
end
I would think intuitively we define ddex1de by dydt so it should be like
function ddex1de = dydt(t,y,Z)
ylag1 = Z(:,1);
ylag2 = Z(:,2);
dydt = [ylag1(1);
ylag1(1)+ylag2(2);
y(2)];
end
Woud you explain why this is not the case?
Guru Mohanty
Guru Mohanty 2020 年 5 月 4 日
As it is a System of 3 Equations, 'y', 'dydt', 'ylag1' 'ylag2' have dimension 3x1. There are two constant Delay present, So The dimention of 'Z' is 3x2.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by