How can I implement an impulse function in simulink?

11 次查看(过去 30 天)
I've been trying to make a simulation giving a series of ODE running in simulink, but at certain times I need some variables to change abruptly, something like S(t_i + ) =S(t_i -)(1-x). I've tried to insert a matlab block function, given a series of points in time t_i , such that
for i=length(t_i)
if round(ti100)==round(t100)
dS=aux-x S;
else
dS=aux;
end
end
Such that the aux is the S'(t) without the impulse. However it does not work except for the last value of t_i, and also during the first moments of the simulation. I know there must be some other way, more easy and simple, I just haven't found it (I also tried to stop the simulation, change the initial values and start again, but I don't find this very elegant).
Can anybody illuminate me? Please? This has been quite stressful for long time and I just can't find the right help in any tutorial/previous question

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Stress and Strain 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by