Hi BLI (Bernt?).
Thanks again for your persistence. tspan' in this context is the current time (as you correctly point out - t`).
I have worked on this problem further now and apart from not really understanding how to ‘assign’ the value of a derivative to the expression, i.e. u[3] = 1*floor(tspan/p[6]) I decided to try a different approach.
To that end, I create a function sig(t) that uses nested ifelse. to determine when the input is on or off and then re-use this function inside my perfadap function.
# Function that turns signal on and off
function sig(t)
ifelse.(t<4,0,
ifelse.(t>=4&&t<5,1,
ifelse.(t>=8&&t<9,1,
ifelse.(t>=12&&t<13,1,
ifelse.(t>=16&&t<17,1,0)
)
)
)
)
end
Output ![]()
Thanks again (and to Chris R)
Ben
