Extract delayed variable from dde23 solver
1 次查看(过去 30 天)
显示 更早的评论
I'm aiming to simulate the following system in continuous time via MATLAB:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/502413/image.png)
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?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scope Variables and Generate Names 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!