MATLAB: How to change an ODE parameter at a determinate time

ode

I would like be able to perturb (change the numeric value) to one variable from a set of ODEs at a particular time different to the initial time. The change can be made from the command window prompt?
Thanks in advance !

Best Answer

For example,
ode45(@(t,y) MyFun(t,y,var1,var2,@fun4var3), ...)
Then in MyFun,
var3 = fun4var3(t)
and also,
function var3 = fun4var3(t)
if t < YourKeyTime
var3 = InitialValue;
else
var3 = AlternateValue;
end
end