Event triggered control using ode45
8 次查看(过去 30 天)
显示 更早的评论
I have to solve ODE given by:
dy/dt= y- (|y|^0.5)*signum(y).
And T1=2; is some given constant.
Where event points are generated by
s_(k+1)={ t >=t and t<T1_k: y(t)=e^-(t_k)}
where t_k= s_k+ r_k, r_k is the delay term . And at t=t_k, y(t) should update the initial condition as
y(t_k)=y((t_k)^)+ 0.5*|y(s_k)|/(1+0.5*)).
And for t>=T1 we should just solve the given ODE and there is event condition for t>=T1.
And we should plot t vs y(t) for 4 seconds.
0 个评论
采纳的回答
Walter Roberson
2024-12-1
Proceed as described in https://www.mathworks.com/matlabcentral/answers/2169908-while-in-ode45#answer_1552013
%assuming r_k is a row vector of delay intervals.
tspan = cumsum([0, r_k]).';
if tspan(end) == T1; tspan(end) = []; end
tspan = [tspan, [tspan(2:end); T1]];
and then run the for loop. Within the for loop, adjust the boundary condition after each ode45() call.
更多回答(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!