How do I set the value of the heaviside function at the origin (or shifted origin) to be 1, not 0.5?
10 views (last 30 days)
Show older comments
I'm running Matlab R2014a, and I'd like to utilise the heaviside function to activate different parts of an equation at different points in time.
At a time t', a term becomes valid, so I'd like the full magnitude of that. By using heaviside as is, I get 0.5 times that term for the first array value, then the full magnitude there after. i.e. heaviside(t-t').*y, where y is a function to be acitvated at t=t'. I get 0.5*y(t'), when I would like 1*y(t').
After checking online, it seems the 'sympref' function is not on this version of matlab, so does anyone know the correct method?
4 Comments
jgg
on 15 Jan 2016
I'd suggest answering your own question with this, so people know how to solve the problem.
Accepted Answer
Oliver
on 1 Mar 2016
1 Comment
Jos (10584)
on 1 Mar 2016
t' is not a valid variable name ... the symbol ' is the conjugate transpose operator.
More Answers (2)
Jos (10584)
on 1 Mar 2016
theta2 = ceil(heaviside(t-t_origin))
which is the same as Stephens solution,
theta2 = double(t >= t_origin)
which is also much faster ...
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!