Azzera filtri
Azzera filtri

Extract delayed variable from dde23 solver

1 visualizzazione (ultimi 30 giorni)
Jpk
Jpk il 28 Gen 2021
Modificato: Jpk il 28 Gen 2021
I'm aiming to simulate the following system in continuous time via MATLAB:
I have indeed found a dde23 to accomplish this, however I seem to be unable to get it to output the value of y(t).
sol = dde23(@(t,x,Z)ddex1de(t,x,Z),[12],@ddex1hist,[0, 100]);
figure;
plot(sol.x,sol.y)
xlabel('time t');
ylabel('solution y');
% --------------------------------------------------------------------------
function s = ddex1hist(t)
% Constant history function for DDEX1.
s = zeros(1,1);
% --------------------------------------------------------------------------
end
function [dxdt] = ddex1de(t,x,Z)
% Differential equations function for DDEX1.
y = 2*Z(:,1);
dxdt = [-2*y(1)+3;];
end
However while this code will indeed make use of the lagged variable x, it will not allow me to output y which is the a scaled and delayed version of x. Indeed if I place it in the dxdt variable this will be integrated which is not my aim.
How can I have dde23 to output and hence extract the delayed variable?

Risposte (0)

Categorie

Scopri di più su Scope Variables and Generate Names in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by